class Problem(_Problem):
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 | add |
add_observer(self, observer: Observer) , see observe_with . |
Method | constraint |
return constraint values for x . |
Method | free |
Free the given test problem. |
Method | initial |
return feasible initial solution proposals. |
Method | logger |
Feed the given solution to logger_biobj in order to reconstruct its output. |
Method | observe |
observe_with(self, observer: Observer) attaches an Observer instance to this problem. |
Property | best |
Undocumented |
Property | dimension |
alias for number_of_variables of the input space |
Property | evaluations |
number of times this Problem instance was evaluated |
Property | final |
Undocumented |
Property | final |
return 1 if the final target is known and has been hit, 0 otherwise |
Property | id |
ID as string without spaces or weird characters |
Property | id |
function number inferred from id |
Property | id |
instance number inferred from id |
Property | id |
unique problem id triplet (function, dimension, instance) |
Property | index |
problem index in the benchmark Suite of origin |
Property | info |
human readible info, alias for str(self). |
Property | initial |
return feasible initial solution |
Property | is |
problem p is observed p.is_observed times. |
Property | lower |
depending on the test bed, these are not necessarily strict bounds |
Property | name |
human readible short description with spaces |
Property | number |
number of constraints |
Property | number |
number of objectives, if equal to 1, call returns a scalar |
Property | number |
Number of variables this problem instance expects as input. |
Property | observers |
list of observers wrapped around this problem |
Property | suite |
benchmark suite this problem is from |
Property | upper |
depending on the test bed, these are not necessarily strict bounds |
Method | _f0 |
"inofficial" interface to self with target f-value of zero. |
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.
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.
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.
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
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)