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.

    pinball_max_itersint, optional

    Maximum number of coordinate descent iterations for the pinball least squares solver. Default is int(1e5).

    pinball_tolfloat, optional

    Convergence tolerance for the pinball least squares solver. Default is 1e-7.

    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.