Parametric Oracles
Parametric oracles represent constraint sets $C(\theta)$ that depend on parameters. They are used with the $\theta$-accepting solve variants to enable differentiation through both the objective and constraint set.
Use materialize to instantiate a concrete oracle at a given $\theta$.
Example: Learning Box Bounds
Use ParametricBox to optimize over a box constraint set with learnable bounds:
using Marguerite, LinearAlgebra
f(x, θ) = 0.5 * dot(x, x) - dot(θ[1:2], x)
∇f!(g, x, θ) = (g .= x .- θ[1:2])
# Box [lb(θ), ub(θ)] with θ-dependent bounds
plmo = ParametricBox(θ -> fill(θ[3], 2), θ -> fill(θ[4], 2))
θ = [0.8, 0.2, 0.0, 1.0]
x, result = solve(f, plmo, [0.5, 0.5], θ; grad=∇f!)The rrule for this signature computes $d\theta$ through both the objective and constraint parameters via KKT adjoint differentiation.
Marguerite.ParametricOracle — Type
ParametricOracleAbstract type for oracles whose constraint set $C(\theta)$ depends on parameters.
Concrete subtypes hold parameter functions ($\theta \to$ constraint data). Use materialize to instantiate a concrete oracle for a given $\theta$.
Marguerite.materialize — Function
materialize(plmo::ParametricOracle, θ) -> concrete_lmoEvaluate parameter functions at $\theta$ and return a concrete oracle.
ParametricBox
Marguerite.ParametricBox — Type
ParametricBox(lb_fn, ub_fn)Parametric box
\[C(\theta) = \{x : l(\theta) \le x \le u(\theta)\}\]
lb_fn(θ) -> Vector: lower bound functionub_fn(θ) -> Vector: upper bound function
ParametricSimplex
Marguerite.ParametricSimplex — Type
ParametricSimplex{R, Equality}(r_fn)Parametric simplex
\[C(\theta) = \{x \ge 0 : \sum x_i \le r(\theta)\}\]
(or $= r(\theta)$ when Equality=true).
r_fn(θ) -> scalar: budget function
Marguerite.ParametricProbSimplex — Function
ParametricProbSimplex(r_fn)Convenience constructor for ParametricSimplex{R, true} – the parameterized probability simplex
\[\{x \ge 0 : \sum x_i = r(\theta)\}\]
ParametricWeightedSimplex
Marguerite.ParametricWeightedSimplex — Type
ParametricWeightedSimplex(α_fn, β_fn, lb_fn)Parametric weighted simplex
\[C(\theta) = \{x \ge l(\theta) : \langle \alpha(\theta), x \rangle \le \beta(\theta)\}\]
α_fn(θ) -> Vector: cost coefficient functionβ_fn(θ) -> scalar: budget functionlb_fn(θ) -> Vector: lower bound function