kkthn.projection
- class kkthn.projection.ProjectionSettings(fb_eps: 'float' = 1e-08, gn_max_iters: 'int' = 30, gn_tol: 'float' = 1e-06, gn_reg: 'float' = 0.001, newton_step_length: 'float' = 0.5, armijo_alpha: 'float' = 0.0001, armijo_beta: 'float' = 0.5, max_backtrack_iter: 'int' = 10, armijo_max_steps: 'int' = 10, backward_reg: 'float' = 1e-08)[source]
Bases:
object- fb_eps: float = 1e-08
- gn_max_iters: int = 30
- gn_tol: float = 1e-06
- gn_reg: float = 0.001
- newton_step_length: float = 0.5
- armijo_alpha: float = 0.0001
- armijo_beta: float = 0.5
- max_backtrack_iter: int = 10
- armijo_max_steps: int = 10
- backward_reg: float = 1e-08
- class kkthn.projection.ProjectionLayer(project: 'Callable', project_single: 'Callable', solve_single: 'Callable', eq_constraints: 'Callable', ineq_constraints: 'Callable', dims: 'dict[str, int]', settings: 'ProjectionSettings')[source]
Bases:
object- project: Callable
- project_single: Callable
- solve_single: Callable
- eq_constraints: Callable
- ineq_constraints: Callable
- dims: dict[str, int]
- settings: ProjectionSettings
- kkthn.projection.make_projection_layer(model, *, param_name: str = 'x', settings: ProjectionSettings | None = None) ProjectionLayer[source]
Create the KKT-HardNet projection layer from a JaxNLPModel.
The layer solves, per sample,
min_y 0.5 ||y - y_hat||^2 s.t. h(y, x) = 0, g(y, x) <= 0, lb(x) <= y <= ub(x)
Inequalities and bounds are folded into one slack/complementarity block.