0

I am new to CVXOPT. I have tried out the example quadratic program (with 2 variables) in CVXOPT documentation, and I am able to understand it. Now I need to solve a quadratic programming problem with a large number of variables (eg: 100 variables). How can I do this using CVXOPT?

The problem that I want to solve is shown below.

Minimize

Σ [ d(t) + x(t) ]²        ; t=1, ....., 100

such that,

0 <= x(t) <= 10

Σ x(t) = 600

Here, d(t) is known for t=(1, ...,100).

x(t) for t=(1, ...,100) are the decision variables.  

Cheers !!! 

NandyGirl
  • 33
  • 4

2 Answers2

0

I don't need a solver for that:

0 <= x(t) <= 10
sum(x(t)) = 2000

with T=100 will be infeasible. With these bounds the sum will be between 0 and 1000.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
0

cvxpy may be a bit easier:

import numpy as np
import cvxpy as cvx

N = 100
d = np.random.uniform(-500,500,N)

x = cvx.Variable(N)
prob = cvx.Problem(cvx.Minimize(cvx.norm(x+d)), [x >= 0, x <= 10, sum(x) == 600])
prob.solve()
print(prob.status)
v = x.value
print(v)

This gives

optimal
[[  3.65513295e-09]
 [  4.89791266e-09]
 [  3.05045765e-09]
 [  9.99999999e+00]
 . . .
 [  1.00000000e+01]
 [  2.85640643e-09]
 [  5.42473434e-09]]
Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39