decogo.problem.approx_data

This module stores approximation data generated during the solution process.

Classes

ApproxData(block_model)

A wrapper class for storing approximation data, i.e. inner points, linearization cuts, valid compact cuts and cells.

CompactCuts(block_model)

A class that stores valid compact linear cuts got after solving the subproblems.

InnerPoints(block_model)

This class stores inner points and corresponding columns

LinearizationCuts(block_model)

This class computes and stores the linearization cuts which are used for OA solver

class decogo.problem.approx_data.ApproxData(block_model)[source]

A wrapper class for storing approximation data, i.e. inner points, linearization cuts, valid compact cuts and cells.

Parameters:
__init__(block_model)[source]

Constructor method

add_linearization_cuts(y, eps, x=None, block_id=None)[source]

Adds linearization cuts by calling :meth:LinearizationCuts.add_linearization_cuts

add_inner_point(block_id, point, min_inner_point_distance=None)[source]

Adds inner point by calling InnerPoints.add_point()

get_min_inner_point(block_id, direction)[source]

Gets inner point with respect to the minimum value computed with some direction in original space by calling InnerPoints.get_min_inner_point()

get_min_column(block_id, direction)[source]

Gets column with respect to the minimum value computed with some direction in image space by calling InnerPoints.get_min_column()

get_inner_points_size(block_id)[source]

Gets inner points size by calling InnerPoints.get_size()

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

Add valid compact cut by calling CompactCuts.add()

get_compact_cuts_size()[source]

Gets compact cut size by calling CompactCuts.get_length()

class decogo.problem.approx_data.InnerPoints(block_model)[source]

This class stores inner points and corresponding columns

Parameters:

block_model (BlockModel) – Block model

__init__(block_model)[source]

Constructor method

__getitem__(item)[source]

Index operator

Parameters:

item (tuple) – Given index as tuple (block_id, index)

Returns:

tuple (point, column), i.e point and corresponding column

Return type:

tuple

is_new_point(block_id, column, min_inner_point_distance=None)[source]

Computes minimum distance (based on the infinity norm) of column to all columns in one block

Parameters:
  • block_id (int) – Block identifier

  • column (ndarray) – Given possibly new column

  • min_inner_point_distance (float or None) – Threshold for identifying if the column is new

Returns:

Result if the column is new

Return type:

bool

add_point(block_id, point, min_inner_point_distance=None)[source]

Adds the new point and column. If min_inner_point_distance is None, the column is always added (based on the reduced cost computation)

Parameters:
  • block_id (int) – Block identifier

  • point (ndarray) – Given new point

  • min_inner_point_distance (float or None) – Threshold for identifying if the column is new

Returns:

Tuple which containes the flag if the column is new, point and corresponding column

Return type:

tuple

get_min_inner_point(block_id, dir_orig_space)[source]

Get the inner point based on the minimum value regarding the direction in original space, i.e. \(y = {\mathrm{argmin\ }} d^Tx, x \in S\), where \(S\) is the set of inner points

Parameters:
  • block_id (int) – Block identifier

  • dir_orig_space (ndarray) – Given direction

Returns:

Point and corresponding minimum value

Return type:

tuple

get_min_column(block_id, dir_im_space)[source]

Get the column based on the minimum value regarding the direction in image space, i.e. \(y = {\mathrm{argmin\ }} d^Tx, x \in S\), where \(S\) is the set of inner points

Parameters:
  • block_id (int) – Block identifier

  • dir_im_space (ndarray) – Given direction

Returns:

Column and corresponding minimum value

Return type:

tuple

get_size(block_id)[source]

Gets the size of inner points of the given block

Parameters:

block_id (int) – Block identifier

Returns:

Size of the inner points

Return type:

int

get_estimated_nadir_point(block_id)[source]

Gets maximum value for each component of the existing columns

Parameters:

block_id (int) – Block identifier

Returns:

Vector with maximum components

Return type:

ndarray

get_estimated_ideal_point(block_id)[source]

Gets minimum value for each component of the existing columns

Parameters:

block_id (int) – Block identifier

Returns:

Vector with minimum components

Return type:

ndarray

check_block(kt)[source]
get_num_blocks()[source]
class decogo.problem.approx_data.LinearizationCuts(block_model)[source]

This class computes and stores the linearization cuts which are used for OA solver

Parameters:

block_model (BlockModel) – Block model

__init__(block_model)[source]

Constructor method

add_linearization_cuts(y, eps, x=None, block_id=None)[source]

This method decides for which cases to compute linearization cuts. The cuts are computed with formula \(g(y) + \nabla g(y)^T(x-y) \leq 0\), where \(y\) is a linearization point.

Depending on the input values the cuts are added in the following cases:

  • if x is None, then the cuts are added to active constraint at point y.

  • if x is not None, then the cuts are added only for constraint which are violated at point x and are active at point y

  • if block_id is None, then linearization cuts are added to the all blocks

Parameters:
  • y (BlockVector or ndarray) – Linearization point

  • eps (float) – Accuracy for checking if the constraint is active

  • x (BlockVector or ndarray or None) – point of OA solution

  • block_id (int or None) – Block identifier

Returns:

Number of new added cuts

Return type:

int

compute_and_add_linearization_cut(block_id, j, y)[source]

Method which computes the linearization cut for nonlinear constraint of the k-th block regarding a reference point y

Parameters:
  • block_id (int) – Block identifier

  • j (int) – Nonlinear constraint index

  • y (ndarray) – Reference point

Returns:

positive integer, which correspond to the number of added cuts, if all gradient values are ok (and the cut was possible to compute), i.e. no \(\infty\) numbers, 0 - otherwise

Return type:

int

num_cuts(block_id)[source]

Get number of cuts

Parameters:

block_id (int) – Block identifier

Returns:

Number of the cuts

Return type:

int

__getitem__(item)[source]

Index operator

Parameters:

item (tuple) – Given index

Returns:

The cuts associated with the index

Return type:

LinearConstraint

class decogo.problem.approx_data.CompactCuts(block_model)[source]

A class that stores valid compact linear cuts got after solving the subproblems. They are defined with \(a^Tw \leq b\), where \(a, w \in \mathbb{R}^{m+1}, m\) is the number of global linear constraints

Parameters:

block_model (BlockModel) – Block model

__init__(block_model)[source]

Constructor method

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

Add new compact linear cut

Parameters:
  • block_id (int) – Block identifier

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

  • relation (str) – Relation of the constraint

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

__getitem__(key)[source]

Index operator

Parameters:

key (tuple) – Given index as tuple: (block_id, index)

Returns:

Cut associated with index

Return type:

tuple

__setitem__(key, value)[source]

Index operator

Parameters:
  • item (tuple) – Given index as tuple: (block_id, index)

  • value (tuple) – Left hand side, relation, right hand side

Returns:

Cut associated with index

Return type:

tuple

get_length()[source]

Get number of the cuts for each block

Returns:

List of the cuts number blockwise

Return type:

list