Originally posted by: SystemAdmin
It is still not clear to me how do you want to use the search phase. Let me return back to the example you used at the beginning:
// overlappingSets[1]=1,2,3,4 --->This means jobs 1,2,3,4 are overlapping
// overlappingSets[2]=3,4,5,6,7 ----> Same logic here...note 3,4,they are important jobs for set 1 and 2
// overlappingSets[3]=7,8--->job 7 is important here for set 2 and 3
// overlappingSets[4]=9,10
Jobs 3 and 4 are important for sets 1 and 2, job 7 is important for sets 2 and 3. What variable do you want CP Optimizer to fix first? X3, X4 or X7?
It seems to me that X3, X4 and X7 are equally important because each is used in exactly two sets. In this case maybe what you need is something like this:
execute
{ var f = cp.factory; var phase = f.searchPhase(XVariables, f.selectLargest(f.explicitVarEval(XVariables, InSetCounter, 0))); cp.setSearchPhases(phase);
}
Where InSetCounter is an array of integers indexed the same way as XVariables, and InSetCounter[i] is the number of times XVariables[i] appear in some overlapping set. This way, CP Optimizer will start to fix first variables appearing in the biggest number of overlapping sets. In case of a tie it will choose according to its own criteria.
For explanation of explicitVarEval, I recommend to have a look into C++ documentation, it explains it better than OPL documentation. You can find it in doc/html/en-US/refcppcpoptimizer/html/functions/IloExplicitVarEval.html.
Best, Petr
#DecisionOptimization#OPLusingCPOptimizer