Originally posted by: SystemAdmin
[jfk said:]
hello there,
it's a pity that you are not using OPL... In OPL you have access to CPO by which you could get the perfect solution for your problem without much work
1. since your problem is a pure integer one you can switch to CPO (at the beginning of your OPL code you have to put "using CP") - CPO stands for Constraint Programing Optimizer
you can write script code like
main {
var model = new IloOplRunConfiguration("mySRQ-prb1.mod");
model.oplModel.generate();
model.cp.startNewSearch();
var k=1;
while (model.cp.next()) { //this will return false when there is no more solution
writeln(k,"th solution", ...); //you may want to print an individual solution
k++;
};
model.cp.endSearch();
model.end();
}
which actually print all the solution. You could have a first run in OPL to optimize with a given goal function, then take that value, fix it, and then count down all the possible solutions.
2. OK, then let's see the CPLEX solution but still with OPL: the solution pool feature
create a .ops (setting) file
attach it to your run-config
open the .ops and find the solution pool tab Mathematical Programming>Mixed Integer Programming>Solution Pool and check the "populate solution pool" box, and run...
3. without OPL, you have to code by yourself, but still the CPLEX solution pool feature is available. Take a look at
User's Manual > ILOG CPLEX User's Manual > Discrete optimization > Solution pool: generating and keeping multiple solutions > Enumerating all solutions > How to enumerate all solutions
it takes you fairly straightforwardly through how to enumerate all the solutions
Sorry, no.1-2 probably sounded like I teased you, but since you posted your question at ILOG OPL(CPLEX) you have to endure stuff about OPL... :-)
well, good luck with no.3!
cheers
#DecisionOptimization#OPLusingCPLEXOptimizer