Originally posted by: EPED_Nicholas_Drake
That is the same solution that I gather, sorry I should have been more specific when I explained the solution the O vector for this problem is called the Null solution, as in that is always a solution to the problem, I reworked the problem using another definition and retrieved an answer but it is also incorrect. Basically I believe that I am setting the problem up incorrect in converting from the LCP problem to the MIP. Once question that I do have is for ctype if x4 x5 can be either 0 or 1 should I set their ctype to B (binary). I think that I am missing how to set the problem up to as the MIP.
This is what I got when I re-worked the problem
max a
a, y, z
st
a<=(My)+aq<= z
0<=y<=1-z
0<=a
z = 0 or 1
e is the vector(array) of all ones.
I have wrote the code the way I thought for a test problem in which I already know the solution and I get the null vector as a return which is not correct.
for syntax the M = 1 -1; 0 -1 q = -2 4'
which if I did my math correctly should lead to the following set of inequalities
2x1-x2+x3 <=0
-4x1+x3<=0
-2x1+x2-x3+x4<=1
4x1-x3+x5<=1
-x2-x4<=0
-x3-x5<=0
x2+x4<=1
x3+x5<=1
with bounds
0<=x1<inf
0<=x2<inf
0<=x3<inf
0<=x4<1
0<=x5<1
here x4 and x5 are integers.
For consistency in notation
x1=a x2=y1 x3 =y2 x4 =z1 x5 =z2
%%%%%%%%%%%%%%%%%%%%%%%%%CODE%%%%%%%%%%%%%%%%%%%%%
function LCP_test2
try
f =
-1 -1 -1 -1 -1' ;
Aineq =
2 -1 1 1 0; -4 0 1 0 1;
bineq =
0; 0;
Aeq=[];
beq=[];
lb=
0;0;0;0;0;
ub =
1; 1; 1; 1; 1;
ctype= 'CCCBB';
options = cplexoptimset;
options.Diagnostics = 'on';
x, fval, exitflag, output = cplexmilp (f, Aineq, bineq, Aeq, beq,...
[ ], [ ],
], lb, ub, ctype, [, options);
fprintf ('\nSolution status = %s \n', output.cplexstatusstring);
fprintf ('Solution value = %f \n', fval);
disp ('Values =');
disp (x);
catch m
disp (m.message);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%OUTPUT%%%%%%%%%%%%%%%%%
Tried aggregator 2 times.
MIP Presolve eliminated 0 rows and 1 columns.
Aggregator did 1 substitutions.
Reduced MIP has 1 rows, 3 columns, and 3 nonzeros.
Reduced MIP has 2 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.02 sec.
Clique table members: 1.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 2 threads.
Root relaxation solution time = -0.00 sec.
Nodes Cuts/
Node Left Objective IInf Best Integer Best Node ItCnt Gap
0 0 -2.7500 1 -1.8333 -2.7500 0 50.00%
-
0+ 0 -2.6667 -2.7500 0 3.12%
0 0 cutoff -2.6667 0 0.00%
Root node processing (before b&c):
Real time = 0.01
Parallel b&c, 2 threads:
Real time = 0.00
Sync time (average) = 0.00
Wait time (average) = 0.00
Total (root+branch&cut) = 0.01 sec.
Solution status = integer optimal solution
Solution value = -2.666667
Values =
0.3333
1.0000
0.3333
0
1.0000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Where I think I have a problem is in the bounds or setup of the problem
I really dont need to maximize x4 or x5 and since there always 1 or 0 I should be able to set to binary. See the problem I have is finding someone who can verify the conversion from LCP to MIP is correct; for arguments sake I know that x1=.25 x2 =.5 and x3=0.
#CPLEXOptimizers#DecisionOptimization