BasicProjection#

class BasicProjection(relaxation=1, idx=None, proximity_flag=True, _use_gpu=False)[source]#

Bases: Projection, ABC

BasicProjection is an abstract base class that extends the Projection class. It allows for projecting onto a subset of the input array based on provided indices.

Parameters:
  • relaxation (float, optional) – Relaxation parameter for the projection, by default 1.

  • idx (ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]] | None) – Indices to apply the projection, by default None.

  • proximity_flag (bool) – Flag to indicate whether to take this object into account when calculating proximity, by default True.

Attributes:
relaxationfloat

Relaxation parameter for the projection.

proximity_flagbool

Flag to indicate whether to take this object into account when calculating proximity.

idxnpt.NDArray

Subset of the input vector to apply the projection on.

Methods

project(x)

Perform the (possibly relaxed) projection of input array 'x' onto the constraint.

proximity(x, proximity_measures)

Calculate proximity measures of point x to the set.

step(x)

Perform the (possibly relaxed) projection of input array 'x' onto the constraint.

project(x)#

Perform the (possibly relaxed) projection of input array ‘x’ onto the constraint.

Parameters:

x (ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]) – The input array to be projected.

Return type:

ndarray

Returns:

The (possibly relaxed) projection of ‘x’ onto the constraint.

proximity(x, proximity_measures)#

Calculate proximity measures of point x to the set.

Parameters:

x (ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]) – Input array for which the proximity measure is to be calculated.

Return type:

float

Returns:

The proximity measures of the input array x.

step(x)#

Perform the (possibly relaxed) projection of input array ‘x’ onto the constraint.

Parameters:

x (ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]]) – The input array to be projected.

Return type:

ndarray

Returns:

The (possibly relaxed) projection of ‘x’ onto the constraint.