enumerate_linear_solutions

(function from pyomo.contrib.alternative_solutions.lp_enum)

pyomo.contrib.alternative_solutions.lp_enum.enumerate_linear_solutions(model, *, num_solutions=10, rel_opt_gap=None, abs_opt_gap=None, zero_threshold=1e-05, search_mode='optimal', solver='gurobi', solver_options={}, tee=False, seed=None)[source]

Finds alternative optimal solutions a (mixed-integer) linear program.

This function implements the technique described here:

S. Lee, C. Phalakornkule, M.M. Domach, and I.E. Grossmann, “Recursive MILP model for finding all the alternative optima in LP models for metabolic networks”, Computers and Chemical Engineering, 24 (2000) 711-716.

Parameters:
  • model (ConcreteModel) – A concrete Pyomo model

  • num_solutions (int) – The maximum number of solutions to generate.

  • rel_opt_gap (float or None) – The relative optimality gap for the original objective for which variable bounds will be found. None indicates that a relative gap constraint will not be added to the model.

  • abs_opt_gap (float or None) – The absolute optimality gap for the original objective for which variable bounds will be found. None indicates that an absolute gap constraint will not be added to the model.

  • zero_threshold (float) – The threshold for which a continuous variables’ value is considered to be equal to zero.

  • search_mode ('optimal', 'random', or 'norm') – Indicates the mode that is used to generate alternative solutions. The optimal mode finds the next best solution. The random mode finds an alternative solution in the direction of a random ray. The norm mode iteratively finds solution that maximize the L2 distance from previously discovered solutions.

  • solver (string) – The solver to be used.

  • solver_options (dict) – Solver option-value pairs to be passed to the solver.

  • tee (boolean) – Boolean indicating that the solver output should be displayed.

  • seed (int) – Optional integer seed for the numpy random number generator

Returns:

A list of Solution objects. [Solution]

Return type:

solutions