Problem instances are usually generated using class Suite.

The main feature of a problem instance is that it is callable, returning the objective function value when called with a candidate solution as input.

It provides other useful properties and methods like dimension, number_of_constraints, observe_with, initial_solution_proposal...

Method __init__ Undocumented
Method constraint return constraint values for x.
Method logger_biobj_feed_solution Feed the given solution to logger_biobj in order to reconstruct its output.
Method add_observer add_observer(self, observer: Observer), see observe_with.
Method observe_with observe_with(self, observer: Observer) attaches an Observer instance to this problem.
Method initial_solution_proposal return feasible initial solution proposals.
Method initial_solution return feasible initial solution
Method observers list of observers wrapped around this problem
Method is_observed problem p is observed p.is_observed times.
Method number_of_variables Number of variables this problem instance expects as input.
Method dimension alias for number_of_variables of the input space
Method number_of_objectives number of objectives, if equal to 1, call returns a scalar
Method number_of_constraints number of constraints
Method lower_bounds depending on the test bed, these are not necessarily strict bounds
Method upper_bounds depending on the test bed, these are not necessarily strict bounds
Method evaluations number of times this Problem instance was evaluated
Method final_target_hit return 1 if the final target is known and has been hit, 0 otherwise
Method final_target_fvalue1 Undocumented
Method best_observed_fvalue1 Undocumented
Method free Free the given test problem.
Method id ID as string without spaces or weird characters
Method id_function function number inferred from id
Method id_instance instance number inferred from id
Method name human readible short description with spaces
Method index problem index in the benchmark Suite of origin
Method suite benchmark suite this problem is from
Method info human readible info, alias for str(self).
Method _f0 "inofficial" interface to self with target f-value of zero.
def __init__(self):
Undocumented
def constraint(self, x):

return constraint values for x.

By convention, constraints with values <= 0 are satisfied.

def logger_biobj_feed_solution(self, evaluation, y):

Feed the given solution to logger_biobj in order to reconstruct its output.

Return 1 if the given solution updated the archive and 0 otherwise.

Used by preprocessing when updating the .info, .dat and .tdat files with new indicator reference values.

def add_observer(self, observer):
add_observer(self, observer: Observer), see observe_with.
def observe_with(self, observer):

observe_with(self, observer: Observer) attaches an Observer instance to this problem.

Attaching an observer can be considered as wrapping the observer around the problem. For the observer to be finalized, the problem must be free'd (implictly or explicitly).

Return the observed problem self.

Details: observer can be None, in which case nothing is done.

See also: class Observer

def _f0(self, x):
"inofficial" interface to self with target f-value of zero.
def initial_solution_proposal(self, restart_number=None):

return feasible initial solution proposals.

For unconstrained problems, the proposal is different for each consecutive call without argument and for each restart_number and may be different under repeated calls with the same restart_number. self.initial_solution_proposal(0) is the same as self.initial_solution.

Conceptual example:

# given: a suite instance, a budget, and fmin
for problem in suite:
    # restart until budget is (over-)exhausted
    while problem.evaluations < budget and not problem.final_target_hit:
        fmin(problem, problem.initial_solution_proposal())

Details: by default, the first proposal is the domain middle or the (only) known feasible solution. Subsequent proposals are coordinate-wise sampled as the sum of two iid random variates uniformly distributed within the domain boundaries. On the 'bbob' suite their density is 0.2 * (x / 5 + 1) for x in [-5, 0] and 0.2 * (1 - x / 5) for x in [0, 5] and zero otherwise.

@property
def initial_solution(self):
return feasible initial solution
@property
def observers(self):
list of observers wrapped around this problem
@property
def is_observed(self):

problem p is observed p.is_observed times.

See also: the list of observers in property observers.

@property
def number_of_variables(self):
Number of variables this problem instance expects as input.
@property
def dimension(self):
alias for number_of_variables of the input space
@property
def number_of_objectives(self):
number of objectives, if equal to 1, call returns a scalar
@property
def number_of_constraints(self):
number of constraints
@property
def lower_bounds(self):
depending on the test bed, these are not necessarily strict bounds
@property
def upper_bounds(self):
depending on the test bed, these are not necessarily strict bounds
@property
def evaluations(self):
number of times this Problem instance was evaluated
@property
def final_target_hit(self):
return 1 if the final target is known and has been hit, 0 otherwise
@property
def final_target_fvalue1(self):
Undocumented
@property
def best_observed_fvalue1(self):
Undocumented
def free(self, force=False):

Free the given test problem.

Not strictly necessary (unless, possibly, for the observer). free ensures that all files associated with the problem are closed as soon as possible and any memory is freed. After free()ing the problem, all other operations are invalid and will raise an exception.

@property
def id(self):
ID as string without spaces or weird characters
@property
def id_function(self):
function number inferred from id
@property
def id_instance(self):
instance number inferred from id
@property
def name(self):
human readible short description with spaces
@property
def index(self):
problem index in the benchmark Suite of origin
@property
def suite(self):
benchmark suite this problem is from
@property
def info(self):

human readible info, alias for str(self).

The format of this info string is not guarantied and may change in future.

See also: repr(self)

API Documentation for cocoex, generated by pydoctor at 2020-01-21 17:05:05.