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¶
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
- strategy –
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 – solver to use, defaults to ipopt
- solver_args – Dictionary of keyword arguments to pass to the solver.
- iterations – Specify the number of iterations, defaults to 10. If -1 is specified, the high confidence stopping rule will be used
- stopping_mass – 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 – 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 – True to suppress warning for skipping unbounded variables.
- HCS_max_iterations – Maximum number of iterations before interrupting the high confidence stopping rule.
- HCS_tolerance – Tolerance on HCS objective value equality. Defaults to Python float equality precision.
Check if solver is available.
TODO: For now, it is always available. However, sub-solvers may not always be available, and so this should reflect that possibility.
- strategy –