decogo.model.input_model_base

This modules implement abstract base classes of user-defined input models.

Classes

InputModelBase(sub_problems, ...)

An abstract base class which stores data of the input model and solver of sub-problems and original problem (primal heuristics).

OriginalProblemBase()

An abstract base class for original_problem with user-defined solver

SubModelBase(vars_in_block, block_id)

An abstract base class which stores the variables from the single block and local nonlinear constraints.

SubProblemsBase(block_id)

An abstract base class for constructing a generalised model of sub-problems with user-defined solvers.

class decogo.model.input_model_base.InputModelBase(sub_problems, original_problem, cuts, sub_models)[source]

An abstract base class which stores data of the input model and solver of sub-problems and original problem (primal heuristics).

Parameters
  • sub_problems (list) – list of SubProblems blockwise

  • original_problem (subclass of OriginalProblemBase) – container of original problem

  • cuts (decogo.model.constraints.CutPool) – container of linear constraints

  • sub_models (list) – list of containers for variables from a single block and local nonlinear constraints blockwise

__init__(sub_problems, original_problem, cuts, sub_models)[source]
abstract _construct_cut_pool()[source]

An abstract method for generating the parameters of cut_pool

Returns

block_sizes, blocks, obj, global_cuts, local_cuts

Return type

tuple

__abstractmethods__ = frozenset({'_construct_cut_pool'})
_abc_impl = <_abc_data object>
class decogo.model.input_model_base.OriginalProblemBase[source]

An abstract base class for original_problem with user-defined solver

__init__()[source]

Constructor method

abstract local_solve(start_point, result, problem, iter=None)[source]

Abstract method for solving original problem non-optimal/heuristically/locally

Parameters
  • start_point (ndarray) – Starting point for the solver, defaults to None

  • result (Results) – stores and makes some manipulations with the CG results

  • problem (DecomposedProblem) – stores all problem objects

  • iter (int) – index of iterations in main algorithm

abstract local_solve_fast(start_point, result, problem, iter=None)[source]

Abstract method for fast solving original problem non-optimal/heuristically/locally

Parameters
  • start_point (ndarray) – Starting point for the solver, defaults to None

  • result (Results) – stores and makes some manipulations with the CG results

  • problem (DecomposedProblem) – stores all problem objects

  • iter (int) – index of iterations in main algorithm

__abstractmethods__ = frozenset({'local_solve', 'local_solve_fast'})
_abc_impl = <_abc_data object>
class decogo.model.input_model_base.SubModelBase(vars_in_block, block_id)[source]

An abstract base class which stores the variables from the single block and local nonlinear constraints.

Parameters
  • vars_in_block (list) – List of original variable names from the model

  • block_id (int) – Identifier for block

  • variables (list) – List of all variables with all necessary properties

  • block_size (int) – Number of variables in the sub-model

  • integer (bool) – Indicates if the current sub-model contains variable of integer type

  • nonlin_constr (list) – List of local nonlinear constraints

__init__(vars_in_block, block_id)[source]

Constructor method

__abstractmethods__ = frozenset({})
_abc_impl = <_abc_data object>
class decogo.model.input_model_base.SubProblemsBase(block_id)[source]

An abstract base class for constructing a generalised model of sub-problems with user-defined solvers.

Parameters

block_id (int) – Block identifier

__init__(block_id)[source]

Constructor method

abstract local_solve(result, direction, start_point=None)[source]

An abstract method for solving sub-problem non-optimal/heuristically/locally

Parameters
  • result (Results) – stores and makes some manipulations with the CG results

  • direction (ndarray) – Given vector

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

Returns

Solution point (ndarray), primal bound, dual bound, flag if the primal bound is feasible

Return type

tuple

abstract global_solve(result, direction, start_point=None)[source]

An abstract method for solving sub-problem globally/near-optimal or calling an exact solver

Parameters
  • result (Results) – stores and makes some manipulations with the CG results

  • direction (ndarray) – Given vector

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

Returns

Solution point (ndarray), primal bound, dual bound, flag if the primal bound is feasible

Return type

tuple

__abstractmethods__ = frozenset({'global_solve', 'local_solve'})
_abc_impl = <_abc_data object>