MindtPy_ECP_Solver

(class from pyomo.contrib.mindtpy.extended_cutting_plane)

class pyomo.contrib.mindtpy.extended_cutting_plane.MindtPy_ECP_Solver(**kwds)[source]

Bases: _MindtPyAlgorithm

Decomposition solver for Mixed-Integer Nonlinear Programming (MINLP) problems.

The MindtPy (Mixed-Integer Nonlinear Decomposition Toolbox in Pyomo) solver applies a variety of decomposition-based approaches to solve Mixed-Integer Nonlinear Programming (MINLP) problems. This class includes:

  • Extended Cutting Plane (ECP)

__init__(**kwds)

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

Methods

MindtPy_initialization()

Initializes the decomposition algorithm.

MindtPy_iteration_loop()

Main loop for MindtPy Algorithms.

__init__(**kwds)

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

add_cuts_components(model)

add_regularization()

algorithm_should_terminate()

Checks if the algorithm should terminate at the given point.

all_nonlinear_constraint_satisfied()

available([exception_flag])

Solver is always available.

bounds_converged()

build_ordered_component_lists(model)

Define lists used for future data transfer.

check_config()

Checks if the configuration options make sense.

check_subsolver_validity()

Check if the subsolvers are available and licensed.

create_utility_block(model, name)

fix_dual_bound(last_iter_cuts)

Fix the dual bound when no-good cuts or tabu list is activated.

fp_loop()

Feasibility pump loop.

get_dual_integral()

Calculate the dual integral.

get_integral_info()

Obtain primal integral, dual integral and primal dual gap integral.

get_primal_integral()

Calculate the primal integral.

get_solution_name_obj(main_mip_results)

handle_feasibility_subproblem_tc(...)

Handles the result of the latest iteration of solving the feasibility NLP subproblem.

handle_fp_main_tc(fp_main_results)

Handle the termination condition of the feasibility pump main problem.

handle_fp_subproblem_optimal(fp_nlp)

Copies the solution to the working model, updates bound, adds OA cuts / no-good cuts / increasing objective cut, calculates the duals and stores incumbent solution if it has been improved.

handle_main_infeasible()

This function handles the result of the latest iteration of solving the MIP problem given an infeasible solution.

handle_main_max_timelimit(main_mip, ...)

This function handles the result of the latest iteration of solving the MIP problem given that solving the MIP takes too long.

handle_main_mip_termination(main_mip, ...)

handle_main_optimal(main_mip[, update_bound])

This function copies the results from 'solve_main' to the working model and updates the upper/lower bound.

handle_main_unbounded(main_mip)

This function handles the result of the latest iteration of solving the MIP problem given an unbounded solution due to the relaxation.

handle_nlp_subproblem_tc(fixed_nlp, result)

This function handles different terminaton conditions of the fixed-NLP subproblem.

handle_regularization_main_tc(main_mip, ...)

Handles the result of the regularization main problem.

handle_subproblem_infeasible(fixed_nlp[, cb_opt])

Solves feasibility problem and adds cut according to the specified strategy.

handle_subproblem_optimal(fixed_nlp[, ...])

This function copies the result of the NLP solver function ('solve_subproblem') to the working model, updates the bounds, adds OA and no-good cuts, and then stores the new solution if it is the new best solution.

handle_subproblem_other_termination(...[, ...])

Handles the result of the latest iteration of solving the fixed NLP subproblem given a solution that is neither optimal nor infeasible.

init_max_binaries()

Modifies model by maximizing the number of activated binary variables.

init_rNLP()

Initialize the problem by solving the relaxed NLP and then store the optimal variable values obtained from solving the rNLP.

initialize_mip_problem()

Deactivate the nonlinear constraints to create the MIP problem.

initialize_subsolvers()

Initialize and set options for MIP and NLP subsolvers.

iteration_cycling()

license_is_valid()

load_solution()

model_is_valid()

Determines whether the model is solvable by MindtPy.

objective_reformulation()

process_objective([update_var_con_list])

Process model objective function.

reached_iteration_limit()

reached_stalling_limit()

reached_time_limit()

set_appsi_solver_update_config()

Set update config for APPSI solvers.

set_up_lazy_OA_callback()

Sets up the lazy OA using LazyConstraintCallback.

set_up_logger()

Set up the formatter and handler for logger.

set_up_mip_solver()

Set up the MIP solver.

set_up_solve_data(model)

Set up the solve data.

set_up_tabulist_callback()

Sets up the tabulist using IncumbentCallback.

setup_fp_main()

Set up main problem for Feasibility Pump method.

setup_main()

Set up main problem/main regularization problem for OA, ECP, Feasibility Pump and ROA methods.

setup_regularization_main()

Set up main regularization problem for ROA method.

solve(model, **kwds)

Solve the model.

solve_feasibility_subproblem()

Solves a feasibility NLP if the fixed_nlp problem is infeasible.

solve_fp_main()

This function solves the MIP main problem.

solve_fp_subproblem()

Solves the feasibility pump NLP subproblem.

solve_main()

This function solves the MIP main problem.

solve_regularization_main()

This function solves the MIP main problem.

solve_subproblem()

Solves the Fixed-NLP (with fixed integers).

update_dual_bound(bound_value)

Update the dual bound.

update_gap()

Update the relative gap and the absolute gap.

update_primal_bound(bound_value)

Update the primal bound.

update_result()

update_suboptimal_dual_bound(results)

If the relaxed problem is not solved to optimality, the dual bound is updated according to the dual bound of relaxed problem.

version()

Return a 3-tuple describing the solver version.

Attributes

CONFIG

Member Documentation

MindtPy_initialization()

Initializes the decomposition algorithm.

This function initializes the decomposition algorithm, which includes generating the initial cuts required to build the main MIP.

MindtPy_iteration_loop()[source]

Main loop for MindtPy Algorithms.

This is the outermost function for the Extended Cutting Plane algorithm in this package; this function controls the progress of solving the model.

Raises:

ValueError – The strategy value is not correct or not included.

algorithm_should_terminate()[source]

Checks if the algorithm should terminate at the given point.

This function determines whether the algorithm should terminate based on the solver options and progress. (Sets the self.results.solver.termination_condition to the appropriate condition, i.e. optimal, maxIterations, maxTimeLimit).

Returns:

True if the algorithm should terminate, 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.

build_ordered_component_lists(model)

Define lists used for future data transfer.

Also attaches ordered lists of the variables, constraints to the model so that they can be used for mapping back and forth.

check_config()[source]

Checks if the configuration options make sense.

check_subsolver_validity()

Check if the subsolvers are available and licensed.

fix_dual_bound(last_iter_cuts)

Fix the dual bound when no-good cuts or tabu list is activated.

Parameters:

last_iter_cuts (bool) – Whether the cuts in the last iteration have been added.

fp_loop()

Feasibility pump loop.

This is the outermost function for the Feasibility Pump algorithm in this package; this function controls the progress of solving the model.

Raises:

ValueError – MindtPy unable to handle the termination condition of the FP-NLP subproblem.

get_dual_integral()

Calculate the dual integral. Ref: The confined primal integral. [http://www.optimization-online.org/DB_FILE/2020/07/7910.pdf]

Returns:

The dual integral.

Return type:

float

get_integral_info()

Obtain primal integral, dual integral and primal dual gap integral.

get_primal_integral()

Calculate the primal integral. Ref: The confined primal integral. [http://www.optimization-online.org/DB_FILE/2020/07/7910.pdf]

Returns:

The primal integral.

Return type:

float

handle_feasibility_subproblem_tc(subprob_terminate_cond, MindtPy)

Handles the result of the latest iteration of solving the feasibility NLP subproblem.

Parameters:
  • subprob_terminate_cond (Pyomo TerminationCondition) – The termination condition of the feasibility NLP subproblem.

  • MindtPy (Pyomo Block) – The MindtPy_utils block.

handle_fp_main_tc(fp_main_results)

Handle the termination condition of the feasibility pump main problem.

Parameters:

fp_main_results (SolverResults) – The results from solving the FP main problem.

Returns:

True if FP loop should terminate, False otherwise.

Return type:

bool

handle_fp_subproblem_optimal(fp_nlp)

Copies the solution to the working model, updates bound, adds OA cuts / no-good cuts / increasing objective cut, calculates the duals and stores incumbent solution if it has been improved.

Parameters:

fp_nlp (Pyomo model) – The feasibility pump NLP subproblem.

handle_main_infeasible()

This function handles the result of the latest iteration of solving the MIP problem given an infeasible solution.

handle_main_max_timelimit(main_mip, main_mip_results)

This function handles the result of the latest iteration of solving the MIP problem given that solving the MIP takes too long.

Parameters:
  • main_mip (Pyomo model) – The MIP main problem.

  • main_mip_results ([type]) – Results from solving the MIP main subproblem.

handle_main_optimal(main_mip, update_bound=True)

This function copies the results from ‘solve_main’ to the working model and updates the upper/lower bound. This function is called after an optimal solution is found for the main problem.

Parameters:
  • main_mip (Pyomo model) – The MIP main problem.

  • update_bound (bool, optional) – Whether to update the bound, by default True. Bound will not be updated when handling regularization problem.

handle_main_unbounded(main_mip)

This function handles the result of the latest iteration of solving the MIP problem given an unbounded solution due to the relaxation.

Parameters:

main_mip (Pyomo model) – The MIP main problem.

Returns:

main_mip_results – The results of the bounded main problem.

Return type:

SolverResults

handle_nlp_subproblem_tc(fixed_nlp, result, cb_opt=None)

This function handles different terminaton conditions of the fixed-NLP subproblem.

Parameters:
  • fixed_nlp (Pyomo model) – Integer-variable-fixed NLP model.

  • result (SolverResults) – Results from solving the NLP subproblem.

  • cb_opt (SolverFactory, optional) – The gurobi_persistent solver, by default None.

handle_regularization_main_tc(main_mip, main_mip_results)

Handles the result of the regularization main problem.

Parameters:
  • main_mip (Pyomo model) – The MIP main problem.

  • main_mip_results (SolverResults) – Results from solving the regularization main subproblem.

Raises:

ValueError – MindtPy unable to handle the regularization problem termination condition.

handle_subproblem_infeasible(fixed_nlp, cb_opt=None)

Solves feasibility problem and adds cut according to the specified strategy.

This function handles the result of the latest iteration of solving the NLP subproblem given an infeasible solution and copies the solution of the feasibility problem to the working model.

Parameters:
  • fixed_nlp (Pyomo model) – Integer-variable-fixed NLP model.

  • cb_opt (SolverFactory, optional) – The gurobi_persistent solver, by default None.

handle_subproblem_optimal(fixed_nlp, cb_opt=None, fp=False)

This function copies the result of the NLP solver function (‘solve_subproblem’) to the working model, updates the bounds, adds OA and no-good cuts, and then stores the new solution if it is the new best solution. This function handles the result of the latest iteration of solving the NLP subproblem given an optimal solution.

Parameters:
  • fixed_nlp (Pyomo model) – Integer-variable-fixed NLP model.

  • cb_opt (SolverFactory, optional) – The gurobi_persistent solver, by default None.

  • fp (bool, optional) – Whether it is in the loop of feasibility pump, by default False.

handle_subproblem_other_termination(fixed_nlp, termination_condition, cb_opt=None)

Handles the result of the latest iteration of solving the fixed NLP subproblem given a solution that is neither optimal nor infeasible.

Parameters:
  • fixed_nlp (Pyomo model) – Integer-variable-fixed NLP model.

  • termination_condition (Pyomo TerminationCondition) – The termination condition of the fixed NLP subproblem.

  • cb_opt (SolverFactory, optional) – The gurobi_persistent solver, by default None.

Raises:

ValueError – MindtPy unable to handle the NLP subproblem termination condition.

init_max_binaries()

Modifies model by maximizing the number of activated binary variables.

Note - The user would usually want to call solve_subproblem after an invocation of this function.

Raises:
  • ValueError – MILP main problem is infeasible.

  • ValueError – MindtPy unable to handle the termination condition of the MILP main problem.

init_rNLP()[source]

Initialize the problem by solving the relaxed NLP and then store the optimal variable values obtained from solving the rNLP.

Raises:

ValueError – MindtPy unable to handle the termination condition of the relaxed NLP.

initialize_mip_problem()[source]

Deactivate the nonlinear constraints to create the MIP problem.

initialize_subsolvers()

Initialize and set options for MIP and NLP subsolvers.

model_is_valid()

Determines whether the model is solvable by MindtPy.

Returns:

True if model is solvable in MindtPy, False otherwise.

Return type:

bool

process_objective(update_var_con_list=True)

Process model objective function.

Check that the model has only 1 valid objective. If the objective is nonlinear, move it into the constraints. If no objective function exists, emit a warning and create a dummy objective.

Parameters:

update_var_con_list (bool, optional) – Whether to update the variable/constraint/objective lists, by default True. Currently, update_var_con_list will be set to False only when add_regularization is not None in MindtPy.

set_appsi_solver_update_config()

Set update config for APPSI solvers.

set_up_lazy_OA_callback()

Sets up the lazy OA using LazyConstraintCallback. Currently only support CPLEX and Gurobi.

set_up_logger()

Set up the formatter and handler for logger.

set_up_mip_solver()

Set up the MIP solver.

Returns:

mainopt – The customized MIP solver.

Return type:

SolverFactory

set_up_solve_data(model)

Set up the solve data.

Parameters:

model (Pyomo model) – The original model to be solved in MindtPy.

set_up_tabulist_callback()

Sets up the tabulist using IncumbentCallback. Currently only support CPLEX.

setup_fp_main()

Set up main problem for Feasibility Pump method.

setup_main()

Set up main problem/main regularization problem for OA, ECP, Feasibility Pump and ROA methods.

setup_regularization_main()

Set up main regularization problem for ROA method.

solve(model, **kwds)

Solve the model.

Parameters:

model (Pyomo model) – The MINLP model to be solved.

Returns:

results – Results from solving the MINLP problem by MindtPy.

Return type:

SolverResults

solve_feasibility_subproblem()

Solves a feasibility NLP if the fixed_nlp problem is infeasible.

Returns:

  • feas_subproblem (Pyomo model) – Feasibility NLP from the model.

  • feas_soln (SolverResults) – Results from solving the feasibility NLP.

solve_fp_main()

This function solves the MIP main problem.

Returns:

  • self.mip (Pyomo model) – The MIP stored in self.

  • main_mip_results (SolverResults) – Results from solving the main MIP.

solve_fp_subproblem()

Solves the feasibility pump NLP subproblem.

This function sets up the ‘fp_nlp’ by relax integer variables. precomputes dual values, deactivates trivial constraints, and then solves NLP model.

Returns:

  • fp_nlp (Pyomo model) – Fixed-NLP from the model.

  • results (SolverResults) – Results from solving the fixed-NLP subproblem.

solve_main()

This function solves the MIP main problem.

Returns:

  • self.mip (Pyomo model) – The MIP stored in self.

  • main_mip_results (SolverResults) – Results from solving the main MIP.

solve_regularization_main()

This function solves the MIP main problem.

Returns:

  • self.mip (Pyomo model) – The MIP stored in self.

  • main_mip_results (SolverResults) – Results from solving the main MIP.

solve_subproblem()

Solves the Fixed-NLP (with fixed integers).

This function sets up the ‘fixed_nlp’ by fixing binaries, sets continuous variables to their initial var values, precomputes dual values, deactivates trivial constraints, and then solves NLP model.

Returns:

  • fixed_nlp (Pyomo model) – Integer-variable-fixed NLP model.

  • results (SolverResults) – Results from solving the Fixed-NLP.

update_dual_bound(bound_value)

Update the dual bound.

Call after solving relaxed problem, including relaxed NLP and MIP main problem. Use the optimal primal bound of the relaxed problem to update the dual bound.

Parameters:

bound_value (float) – The input value used to update the dual bound.

update_gap()

Update the relative gap and the absolute gap.

update_primal_bound(bound_value)

Update the primal bound.

Call after solve fixed NLP subproblem. Use the optimal primal bound of the relaxed problem to update the dual bound.

Parameters:

bound_value (float) – The input value used to update the primal bound.

update_suboptimal_dual_bound(results)

If the relaxed problem is not solved to optimality, the dual bound is updated according to the dual bound of relaxed problem.

Parameters:

results (SolverResults) – Results from solving the relaxed problem. The dual bound of the relaxed problem can only be obtained from the result object.

version()

Return a 3-tuple describing the solver version.