Originally posted by: SystemAdmin
I have read some posts in the forum and change my code as follows, but the problem is still there.
The problem is like this
Minimize
0.0258 x1 x9 + 0.022 x2 x9 + 0.0458 x3 x9 + 0.0616 x4 x9 + 0.0552 x5 x9 + 0.1956 x6 x9
+ 0.3238 x7 x9 + 0.9362 x8 x9
Subject to
6 x1 + 7 x2 + 12 x3 + 15 x4 + 15 x5 + 30 x6 + 39 x7 + 107 x8 + 0 x9 <= 100
0.0478 x1 x9 + 0.0357 x2 x9 + 0.0587 x3 x9 + 0.0948 x4 x9 + 0.1166 x5 x9 +
0.4812 x6 x9 + 0.8421 x7 x9 + 1.8286 x8 x9 >= 100
Bounds
x1 >= 0
x2 >= 0
x3 >= 0
x4 >= 0
x5 >= 0
x6 >= 0
x7 >= 0
x8 >= 0
50 >= x9 >= 0
Generals
x1 x2 x3 x4 x5 x6 x7 x8
End
code f = 0 0 0 0 0 0 0 0 0;
H = [0 0 0 0 0 0 0 0 0.0129
0 0 0 0 0 0 0 0 0.011
0 0 0 0 0 0 0 0 0.0229
0 0 0 0 0 0 0 0 0.0308
0 0 0 0 0 0 0 0 0.0276
0 0 0 0 0 0 0 0 0.0978
0 0 0 0 0 0 0 0 0.1619
0 0 0 0 0 0 0 0 0.04681
0.0129 0.011 0.0229 0.0308 0.0276 0.0978 0.1619 0.4681 0];
Aineq = 6 7 12 15 15 30 39 107 0';
bineq = 100;
% both Q and r multiply (-1) to reverse >= as <=
l = 0 0 0 0 0 0 0 0 0';
Q = [0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
-0.0478 -0.0357 -0.0587 -0.0948 -0.1166 -0.4812 -0.8421 -1.8286 0];
r = -100;
lb = 0 0 0 0 0 0 0 0 0';
ub = inf inf inf inf inf inf inf inf 50';
ctype = 'IIIIIIIIC';
options = cplexoptimset;
x, fval, exitflag, output = cplexmiqcp (H, f, Aineq, bineq, [ ], [ ],...
l, Q, r, [ ], [ ], [ ], lb, ub, ctype, [ ], options);
[/code]
I am very new to CPLEX, so I have two questions.
(1) Is this kind of problem as mentioned above fit CPLEX?
(2) Why does the code give me the following error and how could I fix it?
??? Error using ==> cplexmiqcp at 782
CPLEX Error 5002: Q in %s is not positive semi-definite.
Thanks.
#CPLEXOptimizers#DecisionOptimization