Topic
  • 4 replies
  • Latest Post - ‏2014-09-26T16:08:06Z by AlexFleischer
fbahr
fbahr
1 Post

Pinned topic Relaxing infeasible CP models

‏2014-03-20T18:08:41Z |

In v.12.5, an enhanced conflict refiner has been introduced which is able to report conflicts in CP models.

Concequently, the documentation has been updated -- e.g., the hint that the oplrun's -conflict flag only works with CPLEX models has been removed --, but so has the hint that -relax is only available for CPLEX models.

When I try to use the relaxation feature in Optimization Studio, I get an "EXCEPTION_ACCESS_VIOLATION" error (from the script that tries to access relaxationIterator from IloOplModel), and (from command line) oplrun only reports that CP solver wasn't able to find a feasible solution.

Long story short... no relaxation for CP models in v.12.6?

 

Edit: @AlexFleischer pointed out that

"...when you do oplrun -h you get

Usage:
oplrun [options] model-file [data-file ...]
oplrun [options] -p project-dir [run-configuration ...]
  options
    -h                  this help message
    -version            print version information
    -v                  verbose
    -w                  show warnings
    -relax              calculate relaxations needed to get
                        a feasible model, CPLEX only
    -conflict           calculate a conflict for
                        an infeasible model"

...which basically answers my question [although, IMHO, it wouldn't hurt to have this piece of information placed (a bit more visible) in the docs].

So, the follow-up question is: is there a recommended (systematic) way to simulate "relax" using the information the conflict refiner provides?

Updated on 2014-03-25T22:09:15Z at 2014-03-25T22:09:15Z by fbahr
  • AlexFleischer
    AlexFleischer
    104 Posts

    Re: Relaxing infeasible CP models

    ‏2014-03-20T20:42:20Z  

    Hi

    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());

     

     

     

     

     

     

     

     

    }

     

    gives

     

    Default Behavior

    cts[6] at 22:4-23:27 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

    cts2[6] at 26:4-27:29 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

     

    now iterating manually

     

    cts[6] with status ConflictMember

    cts[6];

    cts2[6] with status ConflictMember

    cts2[6];

    {"cts[6]" "cts2[6]"}

     

    Default Behavior

    cts[6] at 22:4-23:27 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

    cts2[6] at 26:4-27:29 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

     

    Out of the conflicts, you may in the flow control change some data to solve those conflicts

     

    regards

     

  • AlexFleischer
    AlexFleischer
    104 Posts

    Re: Relaxing infeasible CP models

    ‏2014-03-20T20:54:27Z  

    Hi

    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());

     

     

     

     

     

     

     

     

    }

     

    gives

     

    Default Behavior

    cts[6] at 22:4-23:27 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

    cts2[6] at 26:4-27:29 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

     

    now iterating manually

     

    cts[6] with status ConflictMember

    cts[6];

    cts2[6] with status ConflictMember

    cts2[6];

    {"cts[6]" "cts2[6]"}

     

    Default Behavior

    cts[6] at 22:4-23:27 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

    cts2[6] at 26:4-27:29 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

     

    Out of the conflicts, you may in the flow control change some data to solve those conflicts

     

    regards

     

  • noneless
    noneless
    20 Posts

    Re: Relaxing infeasible CP models

    ‏2014-09-26T14:35:07Z  

    Hi

    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());

     

     

     

     

     

     

     

     

    }

     

    gives

     

    Default Behavior

    cts[6] at 22:4-23:27 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

    cts2[6] at 26:4-27:29 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

     

    now iterating manually

     

    cts[6] with status ConflictMember

    cts[6];

    cts2[6] with status ConflictMember

    cts2[6];

    {"cts[6]" "cts2[6]"}

     

    Default Behavior

    cts[6] at 22:4-23:27 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

    cts2[6] at 26:4-27:29 C:\ILOG\CPLEX_Studio126\opl\examples\opl\conflictIterator\cp.mod

    est en conflit.

     

    Out of the conflicts, you may in the flow control change some data to solve those conflicts

     

    regards

     

    Is this works in ILOG ver 12.3?

  • AlexFleischer
    AlexFleischer
    104 Posts

    Re: Relaxing infeasible CP models

    ‏2014-09-26T16:08:06Z  
    • noneless
    • ‏2014-09-26T14:35:07Z

    Is this works in ILOG ver 12.3?

    Hi

    I do not think so. This started in 12.5.

    My advice is to move to the latest version : 12.6

    regards