GDP_LDSDA_Solver

(class from pyomo.contrib.gdpopt.ldsda)

class pyomo.contrib.gdpopt.ldsda.GDP_LDSDA_Solver(**kwds)[source]

Bases: _GDPoptAlgorithm

The GDPopt (Generalized Disjunctive Programming optimizer) LD-SDA (Logic-based Discrete-Steepest Descent Algorithm) solver.

This solver accepts models that can include nonlinear, continuous variables and constraints, as well as logical conditions. It uses a discrete steepest descent approach to explore the space of discrete variables (disjunctions) while solving NLP subproblems for the continuous variables.

References

Ovalle, D.; Liñán, D. A.; Lee, A.; Gómez, J. M.; Ricardez-Sandoval, L.; Grossmann, I. E.; Bernal Neira, D. E. Logic-Based Discrete-Steepest Descent: A Solution Method for Process Synthesis Generalized Disjunctive Programs. Computers & Chemical Engineering 2025, 195, 108993. https://doi.org/10.1016/j.compchemeng.2024.108993.

__init__(**kwds)

This is a common init method for all the GDPopt algorithms, so that we correctly set up the config arguments and initialize the generic parts of the algorithm state.

Methods

__init__(**kwds)

This is a common init method for all the GDPopt algorithms, so that we correctly set up the config arguments and initialize the generic parts of the algorithm state.

any_termination_criterion_met(config)

Check if any termination criteria (iteration limit or time limit) have been met.

available([exception_flag])

Solver is always available.

bounds_converged(config)

fix_disjunctions_with_external_var(...)

Fix the disjunctions in the working model based on external variable values.

get_external_information(util_block, config)

Extract information from the model to perform the reformulation with external variables.

license_is_valid()

line_search(config)

Perform a line search along the best direction found by the neighbor search.

neighbor_search(config)

Evaluate immediate neighbors of the current point to find a better solution.

primal_bound()

reached_iteration_limit(config)

reached_time_limit(config)

relative_gap()

Returns current relative optimality gap.

solve(model, **kwds)

Solve the model.

update_incumbent(util_block)

version()

Return a 3-tuple describing the solver version.

Attributes

CONFIG

algorithm

objective_sense

Member Documentation

any_termination_criterion_met(config)[source]

Check if any termination criteria (iteration limit or time limit) have been met.

Parameters:

config (ConfigBlock) – The configuration block containing limits.

Returns:

True if either the iteration limit or time limit has been reached, False otherwise.

Return type:

bool

available(exception_flag=True)

Solver is always available. Though subsolvers may not be, they will raise an error when the time comes.

fix_disjunctions_with_external_var(external_var_values_list)[source]

Fix the disjunctions in the working model based on external variable values.

Maps the integer values in external_var_values_list to the corresponding Boolean variables in the model, fixing the selected one to True and others to False for each logical group.

Parameters:

external_var_values_list (list or tuple) – The list of integer values representing the active disjunct index for each external variable.

get_external_information(util_block, config)[source]

Extract information from the model to perform the reformulation with external variables.

Identifies logical constraints (specifically ExactlyExpression) or disjunctions to map them to external integer variables used for the discrete search.

Parameters:
  • util_block (Block) – The GDPopt utility block of the model where metadata is stored.

  • config (ConfigBlock) – The configuration block containing logical constraint or disjunction lists.

Raises:

ValueError – If a logical constraint is not an ExactlyExpression. If an Exactly(N) constraint has N > 1. If the length of the starting point does not match the number of external variables derived.

Perform a line search along the best direction found by the neighbor search.

Continues moving in self.best_direction as long as the objective function value improves.

Parameters:

config (ConfigBlock) – The configuration block containing solver options.

Evaluate immediate neighbors of the current point to find a better solution.

Iterates through all search directions, generates neighbors, and solves their subproblems. Uses a tie-breaking mechanism favoring points farther away (Euclidean distance) if objective values are within tolerance.

Parameters:

config (ConfigBlock) – The configuration block containing solver options.

Returns:

True if the current point is locally optimal (no better neighbor found), False if a better neighbor was found (current point updated).

Return type:

bool

relative_gap()

Returns current relative optimality gap.

Note that this gap is not necessarily monotonically decreasing if at some point the primal bound changes signs.

solve(model, **kwds)[source]

Solve the model.

Parameters:

model (Block) – the Pyomo model or block to be solved

Keyword Arguments:
  • iterlim (NonNegativeInt, optional) – Iteration limit.

  • time_limit (PositiveInt, optional) – Seconds allowed until terminated. Note that the time limit can currently only be enforced between subsolver invocations. You may need to set subsolver time limits as well.

  • tee (bool, default=False) – Stream output to terminal.

  • logger (a_logger, default=<Logger pyomo.contrib.gdpopt (WARNING)>) – The logger object or name to use for reporting.

  • mip_solver (default='gurobi') – Mixed-integer linear solver to use. Note that no persistent solvers other than the auto-persistent solvers in the APPSI package are supported.

  • mip_solver_args (dict, optional) – Keyword arguments to send to the MILP subsolver solve() invocation

  • nlp_solver (default='ipopt') – Nonlinear solver to use. Note that no persistent solvers other than the auto-persistent solvers in the APPSI package are supported.

  • nlp_solver_args (dict, optional) – Keyword arguments to send to the NLP subsolver solve() invocation

  • minlp_solver (default='baron') – Mixed-integer nonlinear solver to use. Note that no persistent solvers other than the auto-persistent solvers in the APPSI package are supported.

  • minlp_solver_args (dict, optional) – Keyword arguments to send to the MINLP subsolver solve() invocation

  • local_minlp_solver (default='bonmin') – Mixed-integer nonlinear solver to use. Note that no persistent solvers other than the auto-persistent solvers in the APPSI package are supported.

  • local_minlp_solver_args (dict, optional) – Keyword arguments to send to the local MINLP subsolver solve() invocation

  • small_dual_tolerance (default=1e-08) – When generating cuts, small duals multiplied by expressions can cause problems. Exclude all duals smaller in absolute value than the following.

  • integer_tolerance (default=1e-05) – Tolerance on integral values.

  • constraint_tolerance (default=1e-06) –

    Tolerance on constraint satisfaction.

    Increasing this tolerance corresponds to being more conservative in declaring the model or an NLP subproblem to be infeasible.

  • variable_tolerance (default=1e-08) – Tolerance on variable bounds.

  • subproblem_initialization_method (default=<function restore_vars_to_original_values at 0x79e90042ccc0>) –

    Callback to specify custom routines for initializing the (MI)NLP subproblems. This method is called after the discrete problem solution is fixed in the subproblem and before the subproblem is solved (or pre-solved).

    For algorithms with a discrete problem relaxation: This method accepts three arguments: the solver object, the subproblem GDPopt utility block and the discrete problem GDPopt utility block. The discrete problem contains the most recent discrete problem solution.

    For algorithms without a discrete problem relaxation: This method accepts four arguments: the list of Disjuncts that are currently fixed as being active, a list of values for the non-indicator BooleanVars (empty if force_nlp_subproblem=False), and a list of values for the integer vars (also empty if force_nlp_subproblem=False), and last the subproblem GDPopt utility block.

    The return of this method will be unused: The method should directly set the value of the variables on the subproblem

  • call_before_subproblem_solve (default=<class 'pyomo.contrib.gdpopt.util._DoNothing'>) –

    Callback called right before the (MI)NLP subproblem is solved. Takes three arguments: The solver object, the subproblem and the GDPopt utility block on the subproblem.

    Note that unless you are very confident in what you are doing, the subproblem should not be modified in this callback: it should be used to interrogate the problem only.

    To initialize the problem before it is solved, please specify a method in the ‘subproblem_initialization_method’ argument.

  • call_after_subproblem_solve (default=<class 'pyomo.contrib.gdpopt.util._DoNothing'>) –

    Callback called right after the (MI)NLP subproblem is solved. Takes three arguments: The solver object, the subproblem, and the GDPopt utility block on the subproblem.

    Note that unless you are very confident in what you are doing, the subproblem should not be modified in this callback: it should be used to interrogate the problem only.

  • call_after_subproblem_feasible (default=<class 'pyomo.contrib.gdpopt.util._DoNothing'>) –

    Callback called right after the (MI)NLP subproblem is solved, if it was feasible. Takes three arguments: The solver object, the subproblem and the GDPopt utility block on the subproblem.

    Note that unless you are very confident in what you are doing, the subproblem should not be modified in this callback: it should be used to interrogate the problem only.

  • force_subproblem_nlp (default=False) – Force subproblems to be NLP, even if discrete variables exist.

  • subproblem_presolve (bool, default=True) – Flag to enable or disable subproblem presolve. Default=True.

  • tighten_nlp_var_bounds (bool, default=False) – Whether or not to do feasibility-based bounds tightening on the variables in the NLP subproblem before solving it.

  • round_discrete_vars (default=True) – Flag to round subproblem discrete variable values to the nearest integer. Rounding is done before fixing disjuncts.

  • max_fbbt_iterations (PositiveInt, default=3) – Maximum number of feasibility-based bounds tightening iterations to do during NLP subproblem preprocessing.

  • bound_tolerance (NonNegativeFloat, default=1e-06) – Tolerance for bound convergence.

  • direction_norm (In['L2', 'Linf'], default='L2') – The norm to use for the search direction

  • starting_point (optional) – The value list of external variables.

  • logical_constraint_list (ComponentDataSet(LogicalConstraint), optional) – The list of logical constraints to be reformulated into external variables. The logical constraints should be in the same order of provided starting point. The provided logical constraints should be ExactlyExpressions.

  • disjunction_list (ComponentDataSet(Disjunction), optional) – The list of disjunctions to be reformulated into external variables. The disjunctions should be in the same order of provided starting point.

version()

Return a 3-tuple describing the solver version.