Multistart Solver
The multistart solver is used in cases where the objective function is known to be non-convex but the global optimum is still desired. It works by running a non-linear solver of your choice multiple times at different starting points, and returns the best of the solutions.
Using Multistart Solver
To use the multistart solver, define your Pyomo model as usual:
Required import
>>> from pyomo.environ import *
Create a simple model
>>> m = ConcreteModel()
>>> m.x = Var()
>>> m.y = Var()
>>> m.obj = Objective(expr=m.x**2 + m.y**2)
>>> m.c = Constraint(expr=m.y >= -2*m.x + 5)
Invoke the multistart solver
>>> SolverFactory('multistart').solve(m)
Multistart wrapper implementation and optional arguments
- class pyomo.contrib.multistart.multi.MultiStart[source]
Solver wrapper that initializes at multiple starting points.
# TODO: also return appropriate duals
For theoretical underpinning, see https://www.semanticscholar.org/paper/How-many-random-restarts-are-enough-Dick-Wong/55b248b398a03dc1ac9a65437f88b835554329e0
Keyword arguments below are specified for the
solve
function.- Keyword Arguments:
strategy (In(dict_keys(['rand', 'midpoint_guess_and_bound', 'rand_guess_and_bound', 'rand_distributed', 'midpoint'])), default='rand') –
Specify the restart strategy.
”rand”: random choice between variable bounds
”midpoint_guess_and_bound”: midpoint between current value and farthest bound
”rand_guess_and_bound”: random choice between current value and farthest bound
”rand_distributed”: random choice among evenly distributed values
”midpoint”: exact midpoint between the bounds. If using this option, multiple iterations are useless.
solver (default='ipopt') – solver to use, defaults to ipopt
solver_args (default={}) – Dictionary of keyword arguments to pass to the solver.
iterations (default=10) – Specify the number of iterations, defaults to 10. If -1 is specified, the high confidence stopping rule will be used
stopping_mass (default=0.5) – Maximum allowable estimated missing mass of optima for the high confidence stopping rule, only used with the random strategy. The lower the parameter, the stricter the rule. Value bounded in (0, 1].
stopping_delta (default=0.5) – 1 minus the confidence level required for the stopping rule for the high confidence stopping rule, only used with the random strategy. The lower the parameter, the stricter the rule. Value bounded in (0, 1].
suppress_unbounded_warning (bool, default=False) – True to suppress warning for skipping unbounded variables.
HCS_max_iterations (default=1000) – Maximum number of iterations before interrupting the high confidence stopping rule.
HCS_tolerance (default=0) – Tolerance on HCS objective value equality. Defaults to Python float equality precision.