GDPopt logic-based solver¶
The GDPopt solver in Pyomo allows users to solve nonlinear Generalized Disjunctive Programming (GDP) models using logic-based decomposition approaches, as opposed to the conventional approach via reformulation to a Mixed Integer Nonlinear Programming (MINLP) model.
GDPopt currently implements an updated version of the logic-based outer approximation (LOA) algorithm originally described in Turkay & Grossmann, 1996. Usage and implementation details for GDPopt can be found in the PSE 2018 paper Chen et al., 2018, or via its preprint.
The paper contains the following flowchart, taken from the preprint version:
Usage of GDPopt to solve a Pyomo.GDP concrete model involves:
An example which includes the modeling approach may be found below.
Required imports >>> from pyomo.environ import * >>> from pyomo.gdp import * Create a simple model >>> model = ConcreteModel() >>> model.x = Var(bounds=(-1.2, 2)) >>> model.y = Var(bounds=(-10,10)) >>> model.fix_x = Disjunct() >>> model.fix_x.c = Constraint(expr=model.x == 0) >>> model.fix_y = Disjunct() >>> model.fix_y.c = Constraint(expr=model.y == 0) >>> model.c = Disjunction(expr=[model.fix_x, model.fix_y]) >>> model.objective = Objective(expr=model.x, sense=minimize) Solve the model using GDPopt >>> SolverFactory('gdpopt').solve(model, mip_solver='glpk')
The solution may then be displayed by using the commands
>>> model.objective.display() >>> model.display() >>> model.pprint()
When troubleshooting, it can often be helpful to turn on verbose
output using the
>>> SolverFactory('gdpopt').solve(model, tee=True)
GDPopt implementation and optional arguments¶
GDPopt optional arguments should be considered beta code and are subject to change.
Decomposition solver for Generalized Disjunctive Programming (GDP) problems.
The GDPopt (Generalized Disjunctive Programming optimizer) solver applies a variety of decomposition-based approaches to solve Generalized Disjunctive Programming (GDP) problems. GDP models can include nonlinear, continuous variables and constraints, as well as logical conditions.
These approaches include:
- Outer approximation
- Partial surrogate cuts [pending]
- Generalized Bender decomposition [pending]
This solver implementation was developed by Carnegie Mellon University in the research group of Ignacio Grossmann.
For nonconvex problems, the bounds self.LB and self.UB may not be rigorous.
Questions: Please make a post at StackOverflow and/or contact Qi Chen <https://github.com/qtothec>.
Keyword arguments below are specified for the
- iterlim – Iteration limit.
- time_limit – Seconds allowed until terminated. Note that the time limit cancurrently only be enforced between subsolver invocations. You mayneed to set subsolver time limits as well.
- strategy – Decomposition strategy to use.
- init_strategy – Selects the initialization strategy to use when generating the initial cuts to construct the master problem.
- custom_init_disjuncts – List of disjunct sets to use for initialization.
- max_slack – Upper bound on slack variables for OA
- OA_penalty_factor – Penalty multiplication term for slack variables on the objective value.
- set_cover_iterlim – Limit on the number of set covering iterations.
- mip_solver – Mixed integer linear solver to use.
- mip_presolve – Flag to enable or diable Pyomo MIP presolve. Default=True.
- mip_solver_args –
- nlp_solver – Nonlinear solver to use
- nlp_solver_args –
- subproblem_presolve – Flag to enable or disable subproblem presolve. Default=True.
- minlp_solver – MINLP solver to use
- minlp_solver_args –
- call_before_master_solve – callback hook before calling the master problem solver
- call_after_master_solve – callback hook after a solution of the master problem
- call_before_subproblem_solve – callback hook before calling the subproblem solver
- call_after_subproblem_solve – callback hook after a solution of the nonlinear subproblem
- call_after_subproblem_feasible – callback hook after feasible solution of the nonlinear subproblem
- algorithm_stall_after – number of non-improving master iterations after which the algorithm will stall and exit.
- tee – Stream output to terminal.
- logger – The logger object or name to use for reporting.
- calc_disjunctive_bounds – Calculate special disjunctive variable bounds for GLOA. False by default.
- obbt_disjunctive_bounds – Use optimality-based bounds tightening rather than feasibility-based bounds tightening to compute disjunctive variable bounds. False by default.
- bound_tolerance – Tolerance for bound convergence.
- small_dual_tolerance – When generating cuts, small duals multiplied by expressions can cause problems. Exclude all duals smaller in absolue value than the following.
- integer_tolerance – Tolerance on integral values.
- constraint_tolerance – Tolerance on constraint satisfaction.
- variable_tolerance – Tolerance on variable bounds.
- zero_tolerance – Tolerance on variable equal to zero.
- round_discrete_vars – flag to round subproblem discrete variable values to the nearest integer. Rounding is done before fixing disjuncts.
- force_subproblem_nlp – Force subproblems to be NLP, even if discrete variables exist.
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.
Solve the model.
Warning: this solver is still in beta. Keyword arguments subject to change. Undocumented keyword arguments definitely subject to change.
This function performs all of the GDPopt solver setup and problem validation. It then calls upon helper functions to construct the initial master approximation and iteration loop.
Parameters: model (Block) – a Pyomo model or block to be solved
Return a 3-tuple describing the solver version.