module documentation

Reduce the data size of COCO experiment folder(s) from the default logger.

Data are copied into a new folder and then reduced in place.

Usage on a system shell:

python -m cocopp.reduce_size folder_name

folder_name may be a single experiment folder or may contain several full experiment folders. In either case, the reduction is applied to all admissible single data files found anywhere under folder_name.

Further arguments denote the functions applied to the files, by default reduce_dat reduce_tdat remove_x.

Usage in an IPython/Python shell:

import cocopp
cocopp.reduce_size.main(folder_name)

A second argument may contain a tuple or list of the functions names applied to the files, by default ("reduce_dat", "reduce_tdat", "remove_x").

Under a *nix shell, the result can then be check with du -sh *.

Details: this script removes lines in the data files which are not needed with cocopp.main. Comment lines starting with # or % are unchanged. The first and third columns are considered as evaluations (costs) and f-values (quality indicator to be minimized) respectively.

Class TargetHit mininal class to indicate target hits based on file lines.
Function is_comment Undocumented
Function is_empty Undocumented
Function main folder_name contains output of a single COCO experiment, usually a folder in exdata
Function reduce_dat return a new list with fewer lines, remove everything after a negative target was hit too
Function reduce_dat_condition Undocumented
Function reduce_tdat return a new list with first and last data lines only.
Function reduce_tdat_condition Undocumented
Function remove_x change lines in place, keep only first 5 entries of data lines
Function remove_x_condition define on which files to apply remove_x
Variable allowed_x_names Undocumented
Variable final_ftarget Undocumented
Variable number_of_ftargets Undocumented
Function _condition should transform be applied to filename?
Function _rewrite read in file_path, apply transform to its lines, and rewrite it
def is_comment(s):

Undocumented

def is_empty(s):

Undocumented

def main(folder_name, apply=('reduce_dat', 'reduce_tdat', 'remove_x')):

folder_name contains output of a single COCO experiment, usually a folder in exdata

def reduce_dat(lines):

return a new list with fewer lines, remove everything after a negative target was hit too

def reduce_dat_condition(filename):

Undocumented

def reduce_tdat(lines):

return a new list with first and last data lines only.

Evaluations are assumed to be in the first column.

def reduce_tdat_condition(filename):

Undocumented

def remove_x(lines):

change lines in place, keep only first 5 entries of data lines

def remove_x_condition(filename):

define on which files to apply remove_x

allowed_x_names: list[str] =

Undocumented

final_ftarget: float =

Undocumented

number_of_ftargets: int =

Undocumented

def _condition(filename, transform):

should transform be applied to filename?

Call the condition function for this transform on filename.

def _rewrite(file_path, transform):

read in file_path, apply transform to its lines, and rewrite it