class documentation
Observer which can be "attached to" one or several problems, however not necessarily at the same time.
The typical observer records data to be used in the COCO post-processing
module cocopp
afterwards.
>>> import cocoex as ex >>> suite = ex.Suite("bbob", "", "") >>> assert len(suite) == 2160 >>> f = suite.get_problem(33) >>> assert f.id.endswith('f003_i04_d02') >>> observer = ex.Observer("bbob", ... "result_folder: doctest") >>> f.observe_with(observer) # the same as observer.observe(f) # doctest: +ELLIPSIS <cocoex... >>> # work work work with observed f >>> f.free()
Details
- f.free() in the above example must be called before to observe another problem with the "bbob" observer. Otherwise the Python interpreter will crash due to an error raised from the C code.
- Due to technical sublties between Python/Cython/C, the pointer to the underlying C observer is passed by global assignment with
_update_current_observer_global()
Method | __init__ |
options can be a string or a dict |
Method | observe |
observe(problem) let self observe the problem: Problem by calling problem.observe_with(self) . |
Method | signal |
Undocumented |
Property | name |
name of the observer as used with Observer(name, ...) to instantiate self before |
Property | options |
Undocumented |
Property | result |
name of the output folder. |
Property | state |
Undocumented |