adelie.constraint.one_sided#

adelie.constraint.one_sided(D: ndarray, b: ndarray, *, method: str = 'proximal-newton', configs: dict | None = None, dtype: float32 | float64 | None = None)[source]#

Creates a one-sided bound constraint.

The one-sided bound constraint is given by \(D x \leq b\) where \(D\) is a diagonal matrix with \(\pm 1\) along the diagonal and \(b \geq 0\).

Parameters:
D(d,) ndarray

Diagonal matrix \(D\).

b(d,) ndarray

Bound \(b\).

methodstr, optional

Method for solve(). It must be one of the following:

  • "proximal-newton": proximal Newton algorithm.

  • "admm": ADMM algorithm.

Default is "proximal-newton".

configsdict, optional

Configurations specific to method. For each method type, the following arguments are used:

  • "proximal-newton":
    max_itersint, optional

    Maximum number of proximal Newton iterations. Default is 100.

    tolfloat, optional

    Convergence tolerance for proximal Newton. Default is 1e-9.

    nnls_max_itersint, optional

    Maximum number of non-negative least squares iterations. Default is int(1e5).

    nnls_tolfloat, optional

    Maximum number of non-negative least squares iterations. Default is 1e-9.

    cs_tolfloat, optional

    Complementary slackness tolerance. Default is 1e-9.

    slackfloat, optional

    Slackness for backtracking when proximal Newton overshoots the boundary where primal is zero. The smaller the value, the less slack so that the backtrack takes the iterates closer to (but outside) the boundary.

    Warning

    If this value is too small, solve() may not converge!

    Default is 1e-4.

  • "admm":
    max_itersint, optional

    Maximum number of ADMM iterations. Default is int(1e5).

    tol_absfloat, optional

    Absolute convergence tolerance. Default is 1e-7.

    tol_relfloat, optional

    Relative convergence tolerance. Default is 1e-7.

    rhofloat, optional

    ADMM penalty parameter. Default is 1.

If None, the default values are used. Default is None.

dtypeUnion[float32, float64], optional

The underlying data type. If None, it is inferred from b, in which case b must have an underlying data type of numpy.float32 or numpy.float64. Default is None.

Returns:
wrap

Wrapper constraint object.