Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

customised variable and value selection in OPL

  • 1.  customised variable and value selection in OPL

    Posted 12/01/10 01:11 AM

    Originally posted by: AshishS


    Hi,

    I am working with an OPL model in CPLEX Optimization Studio 12.2, being solved with the CP Optimizer. I would like to customize search using the search phase functionality provided in OPL, to something like the following:

    variables: x[1] through x[10], each with domain {0..5}.

    variable selection: smallest to largest

    value selection: select 0 if it is in the domain; select a random value otherwise

    Looks like f.selectLargest(f.varIndex(x)), where f is cp.factory, will achieve the desired variable selection if I add it to an execute block before the model constraints. However, I don't see how to define a simple value selection heuristic such as the above. f.explicitValueEval(...) appears to be useful, but the documentation doesn't quite explain it.

    Any help would be greatly appreciated!

    Ashish
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: customised variable and value selection in OPL

    Posted 12/01/10 10:40 AM
    Hello,

    could the following help you?

    
    
    
    int values[i in 0..5]=i; 
    
    int valueEval[i in 0..5]=(i==0)?1000:0;     dvar 
    
    int x[1..10] in 0..5;   execute 
    { var f = cp.factory;   var phase1 = f.searchPhase(x, f.selectSmallest(f.varIndex(x)), f.selectLargest(f.explicitValueEval(values, valueEval, 0))); cp.setSearchPhases(phase1); 
    }
    


    Alex
    #CPOptimizer
    #DecisionOptimization