bnelearn.util.mpc module¶
This module contains the implementation of our custom GPU-enabled solver for batched constrained quadratic programs, based on Mehrotra’s Predictor-Corrector-Method (MPC).
authors:
Anne Christopher Stefan Heidekrüger (@heidekrueger) Paul Sutterer
- class bnelearn.util.mpc.MpcSolver(max_iter=20)[source]¶
Bases:
object
A batched qp-solver that solves batches of QPs of the form
min 0.5 x.T Q x + q.T x s.t. Gx <= h
Ax = b
with problem sice n (i.e. \(x\in\mathbb{R}^n}\)) , n_ineq many inequality constraints and n_eq equality constraints.
The device and dtype used by the solver will be inferred from Q.
- Args:
Q (torch.Tensor of dimension (n_batches, n, n)): A batch of positive definite n-by-n matrices. q (Tensor of dimension (n_batches, n)) G (Tensor of dimension (n_batches, n_ineq, n)) h (Tensor of dimension (n_batches, n_ineq)) A (Tensor of dimension (n_batches, n_eq, n)) b (Tensor of dimension (n_batches, n_eq)) refine: bool. When set to True, if after max_iter iterations there are
still batches with residuals over 1e-6, the algorithm will run for another max_iter iterations, up to two additional times.
- print_warning (bool): if True, will print warnings if after three runs of max_iter iterations,
the algorithm still hasn’t converged sufficiently.