Python

Import

The QOCO can be imported as follows

import qoco

Setup

QOCO is initialized by creating a QOCO object as follows

solver = qoco.QOCO()

The problem is specified in the setup phase by running

solver.setup(n, m, p, P, c, A, b, G, h, l, nsoc, q, **settings)

The arguments c, b and q are numpy arrays, and P, A, and G are scipy sparse matrices in CSC format. The matrix P can be either complete or just the upper triangular part, but QOCO will only use the upper triangular part.

If you do not have equality constraints, pass in None for A and b. Pass in None for G and h if you do not have inequality or second-order cone constraints, and pass in None for q and 0 for nsoc if you do not have second-order cone constraints.

The keyword arguments **settings specify the solver settings. The allowed parameters are defined in settings.

Solve

To solve the problem, run

results = solver.solve()

The results object contains the following

Member

Description

x

Primal solution

s

Slack variable for conic constraints

y

Dual solution for equality constraints

z

Dual solution for conic constraints

status

Solve status see exitflags

obj

Objective value

iters

Number of iterations

setup_time_sec

Setup time in seconds

solve_time_sec

Solve time in seconds

pres

Primal residual

dres

Dual residual

gap

Duality gap