pympcc.ParametricMPCC

class pympcc.ParametricMPCC(n, n_comp, objective, comp_G, comp_H, eq_constraints=None, ineq_constraints=None, n_eq=0, n_ineq=0, xl=None, xu=None)[source]

Bases: object

JAX-traceable MPCC parameterised by an external vector θ.

Mirrors pympcc.MPCCProblem but every callable takes (x, θ) instead of just x. All callables must be JAX-differentiable (use jax.numpy operations exclusively).

Parameters:
n

Number of decision variables.

Type:

int

n_comp

Number of complementarity pairs.

Type:

int

objective

f(x, θ) -> scalar.

Type:

callable

comp_G, comp_H

G(x, θ) -> (n_comp,) / H(x, θ) -> (n_comp,).

Type:

callable

eq_constraints, ineq_constraints

h(x, θ) -> (n_eq,) / g(x, θ) -> (n_ineq,).

Type:

callable, optional

n_eq, n_ineq

Constraint counts (default 0).

Type:

int

xl, xu

Variable bounds; treated as constants by the autodiff pass.

Type:

array-like, optional

__init__(n, n_comp, objective, comp_G, comp_H, eq_constraints=None, ineq_constraints=None, n_eq=0, n_ineq=0, xl=None, xu=None)
Parameters:
Return type:

None

Methods

__init__(n, n_comp, objective, comp_G, comp_H)

materialise(theta_np, x0)

Build a numeric MPCCProblem with θ baked into closures.

Attributes

n: int
n_comp: int
objective: Callable
comp_G: Callable
comp_H: Callable
eq_constraints: Callable | None = None
ineq_constraints: Callable | None = None
n_eq: int = 0
n_ineq: int = 0
xl: ndarray | None = None
xu: ndarray | None = None
materialise(theta_np, x0)[source]

Build a numeric MPCCProblem with θ baked into closures.

Sets derivatives="jax" so all gradients/Jacobians are produced by jax; the closure over theta_np stays JAX-traceable in the x argument because theta_np is a constant.

Return type:

MPCCProblem

Parameters: