class documentation
The non-anytime problem class.
Serves to benchmark a "budgeted" algorithm whose behavior decisively depends on a budget input parameter.
Usage:
# given: suite and observer instances, budget_list, fmin
for index in range(len(suite)):
with ProblemNonAnytime(suite, observer, index) as problem:
x0 = problem.initial_solution # or whatever fmin needs as input
for budget in sorted(budget_list):
x = fmin(problem, x0, budget) # minimize
problem.delivered(x) # prepares for next budget also
if problem.final_target_hit:
break
Details: This class maintains two problems - one observed and the other unobserved. It switches from unobserved to observed when p_unobserved.evaluations >= p_observed.evaluations.
| Method | __call__ |
Undocumented |
| Method | __enter__ |
Undocumented |
| Method | __exit__ |
Undocumented |
| Method | __init__ |
Undocumented |
| Method | delivered |
to be called with the solution returned by the solver. |
| Method | free |
Undocumented |
| Method | print |
Undocumented |
| Method | reset |
prepare the problem to be run on the next budget |
| Class Variable | inherited |
Undocumented |
| Instance Variable | evaluations |
Undocumented |
| Instance Variable | p |
Undocumented |
| Instance Variable | p |
Undocumented |
| Instance Variable | suite |
Undocumented |
| Property | best |
Undocumented |
| Property | final |
Undocumented |
| Property | random |
Undocumented |
| Instance Variable | _number |
Undocumented |
| Instance Variable | _p |
Undocumented |
to be called with the solution returned by the solver.
The method records the delivered solution (if necessary) and
prepares the problem to be run on the next budget by calling
reset.
Whether the evaluation is done is based on the comparison with the best so-far fvalue, which is a hack. When the behavior of the solver is known, it is better to use:
problem(x) # depending on whether this is necessary or not problem.reset()