1import scipy.sparse 
as sp
 
    6      minimize    ½〈x, Qx〉+〈q, x〉+ c 
    8      subject to  bmin ≤ Ax ≤ bmax 
   10data = qpalm.Data(3, 4) 
   12# Q is sparse and symmetric 
   15valuesQ = [1, -1, -1, 2, 1] 
   16data.Q = sp.csc_matrix((valuesQ, (row, col)), shape=(3, 3)) 
   18# q, bmin and bmax are dense vectors 
   20data.bmin = [0.5, -10, -10, -10] 
   21data.bmax = [0.5, 10, 10, 10] 
   23# A is sparse and rectangular 
   24row = [0, 1, 0, 2, 0, 3] 
   25col = [0, 0, 1, 1, 2, 2] 
   26valuesA = [1, 1, 1, 1, 1, 1] 
   27data.A = sp.csc_matrix((valuesA, (row, col)), shape=(4, 3)) 
   29# %% Configure the solver 
   31settings = qpalm.Settings() 
   32settings.eps_abs = 1e-8 
   36solver = qpalm.Solver(data, settings) 
   40print("Status:     ", solver.info.status) 
   41print("Solution:   ", solver.solution.x)
 
   42print(
"Multipliers:", solver.solution.y)
 
   45solver.warm_start(solver.solution.x, solver.solution.y)
 
   47print(solver.solution.x)
 
   54settings.eps_abs = 1e-10
 
   56solver.update_settings(settings)
 
   58print(solver.solution.x)
 
   60data.bmin = [0, 0, -15, 1]
 
   61solver.update_bounds(bmin=data.bmin)
 
   63print(solver.solution.x)
 
   66solver.update_q(data.q)
 
   68print(solver.solution.x)
 
   76solver.update_Q_A(Qup.data, valuesA)
 
   78print(solver.solution.x)