decogo.pyomo_problem.pyomo_master_problem

This module manages all Pyomo master problems

Classes

PyomoMasterProblems(block_model, ...)

A container class for managing all master problems

class decogo.pyomo_problem.pyomo_master_problem.PyomoMasterProblems(block_model, approx_data, strategy)[source]

A container class for managing all master problems

Parameters:
  • inner_master_problem – Inner Approximation master problem

  • compact_oa_master_problem – Compact OA master problem

  • oa_master_problem – OA master problem with valid cuts generated after solving the sub-problems

  • mip_oa_master_problem – MIP OA master with linearization cuts

  • slack_mip_oa_problem (SlackMipOaMasterProblem) – MIP OA master with linearization cuts used for solving regarding fixed variables

  • nlp_problem (PyomoNlpProblem) – NLP master problem

  • mip_projection_master_problem – MIP projection master problem

  • nlp_resource_projection_problem (NlpResourceProjectionProblem) – NLP projection master problem

__init__(block_model, approx_data, strategy)[source]

Constructor method

solve_ia(solver_name, slack_weights=None)[source]

Solves InnerMasterProblem

Parameters:
  • solver_name (str) – External solver name

  • slack_weights (ndarray) – Slack weights, defaults to None

Returns:

Active (selected) cells, weights for inner points, solution point in original space, solution in image space, slack values, dual solution, objective value

Return type:

tuple

solve_mini_ia(solver_name, hyper_block, dir_im_space)[source]
solve_compact_oa(solver_name, direction=None, bounds=None, solver_options=None)[source]

Solves CompactOaMasterProblem

Parameters:
  • solver_name (str) – External solver name

  • direction (ndarray) – Direction vector, defaults to None

  • bounds (tuple) – Tuple of upper and lower resource bounds, defaults to None

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

Returns:

Solution point, dual solution and objective value

Return type:

tuple

solve_mip_proj_problem(solver_name, point_to_project, target_value=inf, pool_solutions=100)[source]

Solves MipProjectionMasterProblem

Parameters:
  • solver_name (str) – External solver name

  • point_to_project (BlockVector) – Point to project from, it is in the original space

Returns:

Solution point, objective value

Return type:

tuple

solve_agg_mip_proj_problem(solver_name, point_to_project, agg_blocks, target_value=inf, pool_solutions=10)[source]

Solves aggregated sub-problem of MipProjectionMasterProblem. It is not full master problem anymore, instead it is an aggregated sub-problem with several blocks

Parameters:
  • solver_name (str) – External solver name

  • point_to_project (BlockVector) – Point to project from, it is in the original space

  • agg_blocks (tuple or list) – indices of atomic blocks to aggregate

  • glob_con_indices (tuple or list) – indices of global constraints to consider in aggregated subproblem

Returns:

Solution point, objective value

Return type:

tuple

nlp_solve(solver_name, point_to_fix=None, start_point=None, cut_direction=None)[source]

Solves NlpProblem. Solved mostly with fixed integer variables

Parameters:
  • solver_name (str) – External solver name

  • point_to_fix (BlockVector) – Point to be fixed using the integer variables

  • start_point (BlockVector) – Point for the warm start for the external solver

  • cut_direction (BlockVector) – Objective direction

Returns:

Solution point, objective value, flag if the solution point is feasible

Return type:

tuple

agg_nlp_solve(solver_name, agg_blocks, point_to_fix=None, start_point=None, cut_direction=None)[source]

Solves NlpProblem. Solved mostly with fixed integer variables

Parameters:
  • solver_name (str) – External solver name

  • agg_blocks (tuple or list) – indices of atomic blocks to aggregate

  • glob_con_indices (tuple or list) – indices of global constraints to consider in aggregated subproblem

  • point_to_fix (BlockVector) – Point to be fixed using the integer variables

  • start_point (BlockVector) – Point for the warm start for the external solver

  • cut_direction (BlockVector) – Objective direction

Returns:

Solution point, objective value, flag if the solution point is feasible

Return type:

tuple

solve_nlp_resource_proj_problem(solver_name, point_to_project, target_value=inf, start_point=None)[source]

Solves NlpResourceProjectionProblem

Parameters:
  • solver_name (str) – External solver name

  • point_to_project (BlockVector) – Point to project from, it is in the image space

  • start_point (BlockVector) – Starting point for external solver

Returns:

Solution point, objective value, flag indicating if the solution point is infeasible, slack value of the soft fixing of target cut

Return type:

tuple

solve_agg_nlp_resource_proj_problem(solver_name, point_to_project, agg_blocks, glob_con_indices, target_value=inf, start_point=None)[source]

Solves NlpResourceProjectionProblem

Parameters:
  • solver_name (str) – External solver name

  • point_to_project (BlockVector) – Point to project from, it is in the image space

  • agg_blocks (tuple or list) – indices of atomic blocks to aggregate

  • glob_con_indices (tuple or list) – indices of global constraints to consider in aggregated subproblem

  • start_point (BlockVector) – Starting point for external solver

Returns:

Solution point, objective value, flag indicating if the solution point is infeasible, slack value of the soft fixing of target cut

Return type:

tuple

agg_minlp_solve(solver_name, agg_blocks, solver_options=None, cut_direction=None)[source]

Solves NlpProblem as aggregated MINLP subproblem

Parameters:
  • solver_name (str) – External solver name

  • agg_blocks (tuple or list) – indices of atomic blocks to aggregate

  • glob_con_indices (tuple or list) – indices of global constraints to consider in aggregated subproblem

  • cut_direction (BlockVector) – Objective direction

Returns:

Solution point, objective value, flag if the solution point is feasible

Return type:

tuple

solve_mip_oa(solver_name)[source]

Solves MipOaMasterProblem

Parameters:
  • solver_name (str) – External solver name

  • start_point (BlockVector) – Point for the warm start for the external solver

Returns:

Solution point, objective value

Return type:

tuple

solve_integer_relaxed_oa(solver_name)[source]

Solves MipOaMasterProblem with relaxed integer variables

Parameters:

solver_name (str) – External solver name

Returns:

Solution point, objective value

Return type:

tuple

solve_mipoa_with_slacks(solver_name, x, block_id)[source]

Solves MipOaMasterProblemWithSlacks with k-th unfixed or set of unfixed blocks

Parameters:
  • solver_name (str) – External solver name

  • x (BlockVector) – Point for fixing

  • block_id (int or set) – Blocks not to fix

Returns:

Solution point, objective value, flag if the slacks are zero

Return type:

tuple

solve_outer_master_problem(solver_name)[source]

Solves OaMasterProblem

Parameters:

solver_name – External solver name

Returns:

Solution point, objective value, dual solution

Return type:

tuple

add_linearization_cuts(number_of_cuts)[source]

Adds the last \(n\) linearization cuts

Parameters:

n (dict) – Number of cuts to add

update_var_lower_bound(index)[source]

Updates lower bound of the variable by calling update_var_lower_bound()

Parameters:

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

update_var_upper_bound(index)[source]

Updates lower bound of the variable by calling update_var_upper_bound()

Parameters:

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

add_inner_point(block_id)[source]

Adds inner point to the InnerMasterProblem by calling add_column()

Parameters:

block_id (int) – Block identifier

add_lin_local_constr(block_id)[source]

Adds linear local constraints. It takes the last local constraint stored in the model.block_model.BlockModel

Parameters:

block_id (int) – Block identifier

add_compact_lin_local_constr(block_id, lhs, relation, rhs)[source]

Adds compact linear constraint to master problems

Parameters:
  • block_id (int) – Block identifier

  • lhs (ndarray) – Left hand side of the constraints

  • relation (str) – Relation of the constraint

  • rhs (float) – Right hand side of the constraint