Originally posted by: SystemAdmin
> Do you know how we can generate all feasible sequences on every machine
> in a scheduling problem?
You could do so by setting a few CPLEX parameters and then calling the cplex.populate()
method instead of the cplex.solve() method. One such trivial model could look like the
following which prints out the objective value and variable values of each feasible
solution into a file called 'feasibleSolutions.txt':
range r = 1..5;
int y[i in r] = i; dvar int+ x[r]; minimize sum(i in r) x[i]; subject to
{ forall(i in r)
{ x[i] >= 2*y[i]; x[i] <= 3*y[i];
}
} main
{ thisOplModel.generate();
//set cplex parameters to enumerate all possible feasible solutions cplex.populatelim = 2100000000;
//increase the limit of solutions in the solution pool cplex.solnpoolintensity = 4;
//search for all possible solutions cplex.solnpoolagap=1e+75;
//allow any feasible solution to be part of the solution pool cplex.populate();
//call populate instead of solve var nSols = cplex.solnPoolNsolns; var xRange = thisOplModel.r; var fOut =
new IloOplOutputFile(
"feasibleSolutions.txt");
for(var solIndex=0;solIndex<nSols;solIndex++)
{ thisOplModel.setPoolSolution(solIndex); fOut.writeln(
"Solution#"+(solIndex+1)+
" : Objective="+cplex.getObjValue());
for(var xIndex in xRange )
{ fOut.writeln(
"x["+xIndex+
"]="+thisOplModel.x[xIndex]);
}
} fOut.close();
}
#DecisionOptimization#OPLusingCPLEXOptimizer