Originally posted by: albalkum
I've been trying to understand how search phases work in regards to a feasibility problem but I've hit a roadblock. For a small number of feasible solutions (out of the entire pool), I'd like to have a subset of my decision variables have a certain degree of diversity in their results. Here's an explanation of a simple scenario:
Here's my decision variables:
dvar int options[1..12] in 0..1;
Given my constraints, I call cp.next() to obtain 5 feasible solutions (out of 23 possible). It took me a while, but I learned to use cp.param.SearchType = "DepthFirst" and cp.param.Workers = 1 to make sure duplicate solutions were not given. Without search phases, the 5 solutions are:
[0 1 0 0 0 0 1 1 0 0 1 0]
[0 1 0 0 0 0 1 1 0 1 0 0]
[0 1 0 0 0 1 0 1 0 0 1 0]
[0 1 0 0 0 1 0 1 0 1 0 0]
[0 0 0 1 0 1 0 1 0 1 0 0]
options[9] and options[12] are 0 for all 5 solutions. I wish to have a more diverse set of solutions for those 2 variables, i.e. more 1s. How can I go about doing this? I'm able to use setSearchPhases() to make certain variables all 0s or all 1s for 5 solutions.
int optionEval[1..12] = [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1];
execute {
var f = cp.factory;
var eval = f.selectLargest(f.explicitVarEval(options, optionEval, 0));
var chooser = f.selectLargest(f.value());
var phase = f.searchPhase(options, eval, chooser);
cp.setSearchPhases(phase);
}
Is there a way to use search phases to make certain variables have more diversity in their solutions?
Thanks for the help!
#DecisionOptimization#OPLusingCPOptimizer