-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the LightenQP.jl wiki!
Following closely the the implementation of the C/C++ solver OOQP, LightenQP.jl solves the following convex quadratic programming problems (Let us call it by OOQP
)
with positive semi-definite symmetric matrix
Given this solver, a general quadratic programming formulation (OOQP + d≤x≤u + h≤Cx
)
is solved by LightenQP
easily, by packaging d≤x≤u + h≤Cx
into Cx≤g
using mpcQP(V, q, A, b, C, g, d, u, h; settings)
.
using LightenQP
V = [1/100 1/80 1/100
1/80 1/16 1/40
1/100 1/40 1/25]
E = [109 / 100; 23 / 20; 119 / 100]
u = [0.7; +Inf; 0.7]
Q = OOQP(V, -E, u) #OOQP + bounds 0 <= x <= u
x, status = solveOOQP(Q) #solve by Algorithm MPC (Mehrotra Predictor-Corrector)
outputs
(LightenQP.Solution{Float64}([1.5778379780916563e-14, 0.2999999999999846, 0.6999999999999996], [-1.113750000000001], [0.03450000000000125, 2.288436564531734e-16, 1.1948863025210983e-15, 3.1756152439630536e-16, 0.040750000000000446], [1.5778381702536896e-14, 0.29999999999998467, 0.6999999999999994, 0.6999999999999842, 4.294136336840918e-16]), 15)
where
x::Solution : structure containing the primal solution 'x', dual variables 'y' and 'z' corresponding to the equality
and inequality multipliers respectively, and slack variables 's'
status::Int : > 0 if successful (=iter_count), 0 if infeasibility detected, < 0 if not converged (=-iter_count)
Hence, to retrieve the optimal solution
x.x
gives
3-element Vector{Float64}:
1.5778379780916563e-14
0.2999999999999846
0.6999999999999996
An real data on SP500