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.ParametricOracleType
ParametricOracle

Abstract 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$.

source
Marguerite.materializeFunction
materialize(plmo::ParametricOracle, θ) -> concrete_lmo

Evaluate parameter functions at $\theta$ and return a concrete oracle.

source

ParametricBox

Marguerite.ParametricBoxType
ParametricBox(lb_fn, ub_fn)

Parametric box

\[C(\theta) = \{x : l(\theta) \le x \le u(\theta)\}\]

  • lb_fn(θ) -> Vector: lower bound function
  • ub_fn(θ) -> Vector: upper bound function
source

ParametricSimplex

Marguerite.ParametricSimplexType
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
source
Marguerite.ParametricProbSimplexFunction
ParametricProbSimplex(r_fn)

Convenience constructor for ParametricSimplex{R, true} – the parameterized probability simplex

\[\{x \ge 0 : \sum x_i = r(\theta)\}\]

source

ParametricWeightedSimplex

Marguerite.ParametricWeightedSimplexType
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 function
  • lb_fn(θ) -> Vector: lower bound function
source