Problems¶
Problem ¶
Bases: NamedTuple
An optimization problem over a pytree of variables.
Without an objective the problem is a feasibility problem.
Variable ¶
Bases: NamedTuple
An array of decision variables with bounds and a domain.
Its shape is the broadcast of shape and the shapes of the bounds. Estimators of a
nonlinear function need finite bounds on its variables.
Domain ¶
Bases: IntEnum
Values a variable may take, with SCIP's SCIP_VARTYPE values.
Sense ¶
Bases: IntEnum
Direction of optimization, with SCIP's SCIP_OBJSENSE values.
Constraint ¶
Bases: NamedTuple
The constraint lower ≤ function(x, params) ≤ upper, one row per output entry.
lower and upper broadcast to the shape of the output.
rows ¶
rows(
function: RowFunction,
inputs: Int[ArrayLike, "rows k"],
params: PyTree[ArrayLike] = None,
) -> Callable[
[Float[ArrayLike, " n"]], Float[Array, " rows"]
]
Returns a function of a vector that evaluates rows of one form.
Row r is function(vector[inputs[r]], params_r), where params_r is the r-th slice
of every leaf of params, a pytree of arrays whose leading axis has one entry per row,
or None. The returned function takes the vector and returns the vector of the rows.
A Constraint over it gives each row only its own variables as children, when the
vector is made of variables alone, and params may depend on the parameters of the
problem. The function of a row is split like any function of a problem: its affine part
becomes linear terms of the row, and each nonlinear summand reads only its own entries.
ParametricFunction ¶
Bases: Protocol
A JAX function f(x, params) of the variables and the parameters of a problem.
x has the structure of Problem.variables with an array in place of every Variable.
params is the pytree passed to compile and solve.
RowFunction ¶
Bases: Protocol
A JAX function f(x, params) of one row of rows.
x is the vector of the row's entries and params is the row's slice of the
parameters of rows.