osqp#

swordfish.function.osqp()#

Solve the following optimization problem with a quadratic objective function and a set of linear constraints.

\[\begin{split}\begin{align*} \min_{x}\ &\frac{1}{2}x^T P x + q^T x\\ \text{subject to}\ &\; lb \le A x \le ub \end{align*}\end{split}\]
Parameters:
  • q (Constant) – A vector indicating the linear coefficient of the objective function.

  • P (Constant, optional) – A positive semi-definite matrix indicating the quadratic coefficients of the objective function.

  • A (Constant, optional) – The coefficient matrix of linear inequality constraints.

  • l (Constant, optional) – The left-hand-side vector of the linear inequality constraint.

  • u (Constant, optional) – The right-hand-side vector of the linear inequality constraint.

Returns:

A 2-element tuple:

  • The first element is a string indicating the state of the solution:

    • solved: solution found;

    • solved inaccurate: solution found but the result is inaccurate;

    • primal infeasible: no feasible solution to the primal;

    • dual infeasible: no feasible solution to the dual;

    • maximum iterations reached: reach the maximum number of iterations;

    • run time limit reached: execution timeout;

    • problem non convex: the problem is non-convex;

    • interrupted: solution interrupted;

    • unsolved: solution not found.

  • The second element is the value of x where the value of the objective function is minimized.

Return type:

Constant