decogo.pyomo_input_model.master_problem_base

This module implements base class for Pyomo master problems used in MINLP primal heuristics.

Classes

MasterProblemBase(sub_models, cuts)

A base class for master problems in original space.

class decogo.pyomo_input_model.master_problem_base.MasterProblemBase(sub_models, cuts)[source]

A base class for master problems in original space.

Parameters:
  • sub_models (list) – List of sub-models

  • cuts (CutPool) – Container which stores all linear constraints (global and local) and objective function

__init__(sub_models, cuts)[source]

Constructor method

block_rule(component, k)[source]
set_default_objective()[source]

Abstract method for setting the objective function

set_new_objective(direction)[source]

Sets linear objective function with given direction vector

Parameters:

direction (BlockVector) – Given vector

relax_integers(block_id=None)[source]

Relaxes all variables to continuous in pyomo model

Parameters:

block_id (int ot None) – Block identifier, defaults to None. If this parameter is given, then relaxation is set only for this block

set_integers(block_id=None)[source]

Sets integer varaibles as in original formulation

Parameters:

block_id (int ot None) – Block identifier, defaults to None. If this parameter is given, then setting back is done only for this block

fix_all_variables(point, block_id)[source]

Fixes all variables to some values, except for one block

Parameters:
  • point (BlockVector) – Given to fix at

  • block_id (int) – Block identifier where are NOT fixed

unfix_all_variables()[source]

Unfixes all variables

fix_integers(point, blocks=None)[source]

Fixes integer variables using the given point. Integer variables can be fixed either in all block or at some of the blocks

Parameters:
  • point (BlockVector) – Given point to fix

  • blocks (list or set) – Blocks where to fix the integer variables, defaults to None. If this value is None in all blocks integers are fixed

add_linear_local_constraint(block_id)[source]

Adds linear local constraint which is already stored in BlockModel

Parameters:

block_id (int) – Block identifier

update_optimality_cut(rhs)[source]

Adds an optimality cut, i.e. \(c^Tx \leq c_0\)

Parameters:

rhs (float) – Right hand side of the constraint (in fact, primal bound)

update_var_lower_bound(index)[source]

Updates the lower bound by given index

Parameters:

index (tuple) – Index as pair (block_id, index)

update_var_upper_bound(index)[source]

Updates the upper bound by given index

Parameters:

index (tuple) – Index as pair (block_id, index)

deactivate_blocks(kt)[source]
activate_blocks(kt)[source]
deactivate_global_constraints(indices)[source]
activate_global_constraints(indices)[source]
solve(solver_name, start_point=None, solver_options=None)[source]

Solves the model by calling an external solver and gets back the result

Parameters:
  • solver_name (str) – External solver name

  • start_point (BlockVector or None) – Starting point for the solver, defaults to None

  • solver_options (list or None) – External solver options, defaults to None

Returns:

Solution point, objective value, dual solution and flag indicating whether the solution is feasible

Return type:

tuple