Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

find conflict

  • 1.  find conflict

    Posted Tue October 07, 2014 03:56 PM

    Originally posted by: noneless


    Hi all

    How can I find conflicting constraint in CP using OPL? Is there anything like printConflict() that works in OPL?

    Best


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: find conflict

    Posted Wed October 08, 2014 07:25 AM

    Originally posted by: GGR


    Hi

     

    The conflict refiner is automatically launches by OPL studio. It analyses the named constraints conflicts. That is a conflict is built thanks to the named constraint.

     

    The parameters configuration panel allows you to configure the conflict refiner for the CPO or CPlex engines

     

    Hope that helps

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: find conflict

    Posted Wed October 08, 2014 10:33 AM

    Hi

    To complement what was written, let me share an example.

    This example wil show you that printConflict also works with CPO and that you can iterate on the conflicts.

    using CP;

    range r = 1..10;
    dvar int+ x[r] in 1..20;

    {string} ctInConflict={};



    // Preferences are stated as data of the opl model.
    // prefs[i] will be used to represent the preference of seeing cts[i] in the conflict.
    float prefs[i in r] = i;

    minimize sum(i in r) x[i];
    subject to {
       
       forall(i in r)
         cts:  i+5 - x[i] <=0;
         
         
       forall(i in r)
         cts2: x[i] - i-5+2 <=0;
    }





    main {
       thisOplModel.generate();
       var def = thisOplModel.modelDefinition;   
       // Default behavior
       writeln("Default Behavior");
       var opl1 = new IloOplModel(def, cp);
       opl1.generate();
       writeln(opl1.printConflict());
       
      // now iterating manually
     
     
     
     
       writeln("now iterating manually");
       writeln();
       var iter = opl1.conflictIterator;  
          
          for(var c in iter)
          {
           var ct=c.ct;
           writeln(ct.name, " with status ", c.status);
            opl1.ctInConflict.add(ct.name);
           firstOne=0;
           writeln(ct.name,";");
     
     
          }  
          
          writeln(opl1.ctInConflict);
         
          
          
          
    opl1.end();
    writeln();

    // Default behavior
       writeln("Default Behavior");
       var opl2 = new IloOplModel(def, cp);
       opl2.generate();
       writeln(opl2.printConflict());
       
       
       
       
       
           
       
       
    }

    regards

     

     


    #DecisionOptimization
    #OPLusingCPOptimizer