qics.Solver¶
- class qics.Solver(model, max_iter=100, max_time=3600, tol_gap=1e-08, tol_feas=1e-08, tol_infeas=1e-12, tol_ip=1e-13, tol_near=1000.0, verbose=2, ir=True, toa=True, init_pnt=None, use_invhess=None)[source]¶
A class representing an instance of a solver, and is parameterized by a conic program model and adjustable solver settings.
- Parameters:
- model
Model Representation of a given conic program.
- max_iter
int, optional Maximum number of solver iterations before terminating. The default is
100.- max_time
float, optional Maximum time elapsed, in seconds, before terminating. The default is
3600.- tol_gap
float, optional Stopping tolerance for (relative) optimality gap. The default is
1e-8.- tol_feas
float, optional Stopping tolerance for (relative) primal and dual feasibility. The default is
1e-8.- tol_infeas
float, optional Tolerance for detecting infeasible problem. The default is
1e-12.- tol_ip
float, optional Tolerance for detecting ill-posed problem. The default is
1e-13.- tol_near
float, optional Allowable margin for certifying near optimality when solver is stopped early. The default is
1e3.- verbose{
0,1,2,3}, optional Verbosity level of the solver, where
0: No output.1: Only print problem and solution summary.2: Also print summary of the solver at each iteration.3: Also print summary of the stepper at each iteration.
The default is
2.- ir
bool, optional Whether to use iterative refinement when solving the KKT system. The default is
True.- toa
bool, optional Whether to use third-order adjustments to improve the stepping directions. The default is
True.- init_pnt
Point, optional Where to initialize the interior-point algorithm from. Variables which contain
nanare flagged to be intialized using the default initialization method. The default isNone, which intializes all variables using the default method.- use_invhess
bool, optional Whether or not to avoid using inverse Hessian product oracles by solving a modified cone program with \(G^{-1}(\mathcal{K})=\{ x : Gx \in \mathcal{K} \}\). By default, this is
Falseif \(G\neq-\mathbb{I}\), \(G\) is full column rank, and \(\mathcal{K}\) mainly consists ofQuantRelEntr,OpPerspecEpi, andOpPerspecTrcones, and isTrueotherwise.
- model
- solve()[source]¶
Run the primal-dual interior point solver for a given problem model.
- Returns:
dictDictionary which summarizes the solution of a conic program. Contains the following keys.
x_opt (
ndarray) : Optimal primal variable \(x^*\).y_opt (
ndarray) : Optimal dual variable \(y^*\).z_opt (
VecProduct) : Optimal dual variable \(z^*\).s_opt (
VecProduct) : Optimal primal variable \(s^*=h-Gx^*\).sol_status (
string) : Solution status. Can either be:optimal: Primal-dual optimal solution reachedpinfeas: Detected primal infeasibilitydinfeas: Detected dual infeasibilitynear_optimal: Near primal-dual optimal solutionnear_pinfeas: Near primal infeasibilitynear_dinfeas: Near dual infeasibiltiyillposed: Problem is ill-posedunknown: Unknown solution status
exit_status (
string) : Solver exit status. Can either be:solved: Terminated at desired tolerancemax_iter: Exceeded maximum allowable iterationsmax_time: Exceeded maximum allowable timestep_failure: Unable to take another stepslow_progress: Residuals are decreasing too slowly
num_iter (
int) : Number of solver iterations.solve_time (
float) : Total time elapsed (in seconds).p_obj (
float) : Optimal primal objective \(c^\top x^*\).d_obj (
float) : Optimal dual objective \(-b^\top y^* - h^\top z^*\).opt_gap (
float) : Relative optimality gap.p_feas (
float) : Relative primal feasibility.d_feas (
float) : Relative dual feasibiltiy.