Originally posted by: aktm
>> What version of CPLEX are you using? The more recent versions no longer have any PDF documentation. Instead you can >> find the documentation online for CPLEX 12.2 and CPLEX 12.3.
Thank you very much. I believe i am using 12.2. Thanks for the links to the documentation.
>> It is not exactly clear to me what you mean by "generating multiple solutions". The solution pool usually collects all feasible solutions CPLEX finds during the search. If you want to explicitly find more than the optimal solution then you should use the "populate" feature.
I have tried to use the populate feature but I am not quite sure why there is only one solution when I do it.
I have done this in excel solver and managed to get a whole bunch of solutions for this problem.
In the first place, am I doing it correctly?
Is there something I need to change?
Any advice greatly appreciated.
% Initialize the CPLEX object
cplex = Cplex('model 2');
cplex.Model.sense = 'minimize';
M = 100000;
tt2 = 10;
tt1 = 15;
deltaA = 10;
deltaB = 10;
om1 = tt2+deltaB;
om2 = tt2;
om3 = tt1+deltaA;
om4 = om3;
%constraint1
A1 =
1 -1 zeros(1,6);0,0,1 -1 zeros(1,4);
b1 =
-deltaA;-deltaB;
%constraint2
A2a =
-1 0 1 0;0 -1 1 0;-1 0 0 1;0 -1 0 1;
A2b =
M 0 0 0;0 0 M 0; 0 M 0 0; 0 0 0 M;
A2 =
A2a A2b;
b2 =
M-om1;M - om1;M-om2;M-om2;
%constraint3
A3a =
1 0 -1 0;1 0 0 -1;0 1 -1 0;0 1 0 -1;
A3b =
-M 0 0 0;0 -M 0 0;0 0 -M 0;0 0 0 -M;
A3 =
A3a A3b;
b3 =
-om3;-om3;-om4;-om4;
%set of dummy variable constraints
A4a = zeros(4,4);
A4b =
1 0 1 0;0 1 0 1;1 1 0 0;0 0 1 1;
A4 =
A4a A4b;
b4 = ones(4,1);
A=sparse(
A1;A2;A3;A4);
b=sparse(
b1;b2;b3;b4);
numdum = 4; %number of dummies
numcon = 4; %number of continuous variables
numvar = numcon+numdum; %total number of variables
f=
ones(numcon,1);ones(numdum,1);
for i = 1:numcon
vartype(i)='C';
end
for i = numcon+1:numvar
vartype(i)='B';
end
lb=zeros(1,numvar);
ub=
http://ones(1,numcon).*inf,ones(1,numdum);
% Use arrays to populate the model
cplex.Model.obj = f;
cplex.Model.lb = lb;
cplex.Model.ub = ub;
cplex.Model.ctype = vartype;
cplex.Model.A = A;
cplex.Model.lhs = -inf*ones(size(A,1),1);
cplex.Model.rhs = [b];
% Optimize the problem
temp = cplex.solve();
% Write the solution
fprintf ('\nSolution status = %s \n', cplex.Solution.statusstring);
fprintf ('Solution value = %f \n', cplex.Solution.objval);
disp (cplex.Solution.x);
cplex.Param.mip.pool.relgap.Cur = 10;
% Optimize the problem and obtain multiple solutions
temp= cplex.populate();
#CPLEXOptimizers#DecisionOptimization