Originally posted by: EPED_Nicholas_Drake
I am having trouble creating solution pools with the MATlab interface for cplex. I am having trouble understanding what parameters I need to set to catch all possible solutions.
My matlab file looks as follows
%%%%%%%%%%%%%%%%
function LCP_final
try
clc
m=
1 -1; 0 -1;
q =
-2, 4';
xv = sym('x1');
lm = length(m);
yv = sym(zeros(1, lm))';
zv = sym(zeros(1, lm))';
for k=1:lm
yv(k) = sym(sprintf('x%d', k+1));
zv(k) = sym(sprintf('x%d', k+lm+1));
end
A =
m*yv+xv*q+zv;-(m*yv+xv*q); yv-zv;
for i=1:length(A)
A(i,:)=sort(A(i,:));
end
xx = cat(1,xv ,yv,zv);
Aineq = zeros(numel(A),numel(xx));
for j=1:length(A)
for i=1:length(xx)
y=xx(i);
c,t=coeffs(A(j),y);
if (length(t)<2)
else
insert=c(2);
Aineq(j,i)=insert;
end
end
end
bineq=zeros(length(Aineq),1);
for temp=1:(length(zv))
bineq(temp,1)=1;
end
f =
-1 -1 -1 0 0';
Aeq=[];
beq=[];
ub=
inf; 1; 1; 1; 1;
lb=
0; 0;0;0;0;
ctype= 'CCCBB';
options = cplexoptimset, populate;
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%
#CPLEXOptimizers#DecisionOptimization