adelie.constraint.box#

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

Creates a box constraint.

The box constraint is given by \(\ell \leq x \leq u\) where \(\ell \leq 0 \leq u\).

Parameters:
lower(d,) ndarray

Lower bound \(\ell\).

upper(d,) ndarray

Upper bound \(u\).

methodstr, optional

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

  • "proximal-newton": proximal Newton 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.

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

dtypeUnion[float32, float64], optional

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

Returns:
wrap

Wrapper constraint object.