Problems¶
The description of an optimization problem.
Problem ¶
Bases: NamedTuple
A nonlinear optimization problem over a pytree of variables.
Without an objective the problem asks for a feasible point.
variables
instance-attribute
¶
A pytree with a Variable at every leaf, which fixes the structure of x.
objective
class-attribute
instance-attribute
¶
A function with a scalar output.
jacobian_pattern
class-attribute
instance-attribute
¶
Where the Jacobian of the constraints is nonzero, or None to detect it.
hessian_pattern
class-attribute
instance-attribute
¶
Where the Hessian of the Lagrangian is nonzero, or None to detect it.
Variable ¶
Bases: NamedTuple
An array of continuous decision variables with bounds.
Its shape is the broadcast of shape and the shapes of the bounds.
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. Equal bounds make an
equality constraint.
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.
Pattern
module-attribute
¶
Where a derivative can be nonzero, given in one of four forms.
- A boolean matrix,
Bool[np.ndarray, "rows columns"]. - A pair
(rows, columns)of integer vectors, one entry per nonzero. - An
asdex.SparsityPattern, which has to carry itsinput_avalswhen it is built. - A
jax.experimental.sparse.BCOOmatrix, whose stored entries are the nonzeros.
The rows of a Jacobian pattern are the entries of the constraints in the order of
Problem.constraints, and the columns are the flattened variables. A Hessian pattern is
square over the flattened variables and may list one triangle or both.
Sense ¶
Bases: IntEnum
Direction of optimization.