Display conflict and relaxation information for infeasible models using OPL script

Technote (FAQ)


How do I print (and iterate over) the conflicts in and relaxations for my infeasible model using OPL script.


The following sample shows one such approach for a simple model:

dvar int x1 in 0..40;
dvar int+ x2;
dvar int+ x3;
maximize x1 + 2*x2 - 3*x3;
subject to{
  c1:  x2 + x3 <= 20;
  c2: x1 - 3*x2 + x3 <= 30;
  c3: x1 <= 20;
  c4: x1 >= 40;
  writeln("Solve successful; solve status="+cplex.getCplexStatus());
  writeln("Objective value="+cplex.getObjValue());
  writeln("Solve failed; CPLEX status="+cplex.getCplexStatus());
  writeln("Calling printConflict (CONFLICT REFINER)");
  writeln("Printing conflicts using conflictIterator");
  var confIter = thisOplModel.conflictIterator;
  for(var x in confIter){
   writeln("Member name:"+x.ct.name);
   writeln("Conflict type:"+x.info);
  writeln("Calling printRelaxation (FEASOPT)");
  writeln("Printing relaxations using relaxationIterator");
  var relaxIter = thisOplModel.relaxationIterator;
  for(x in relaxIter){
   writeln("Member name:"+x.ct.name);
   writeln("Old bound:"+x.info);
   writeln("New bound:"+x.info2);
   writeln("Bound changed to:"+x.info3);

Cross reference information
Segment Product Component Platform Version Edition
Commerce IBM ILOG CPLEX Optimization Studio Area:ILOG Script for OPL/OPL Script AIX, HP-UX, Linux, Mac OS, Solaris, Windows 12.4, 12.3,, 12.2 All Editions

Document information

More support for:

IBM ILOG CPLEX Optimization Studio
Area:ILOG Script for OPL/OPL Script

Software version:

12.2, 12.3, 12.4

Operating system(s):

Platform Independent

Software edition:

All Editions

Reference #:


Modified date:


Translate my page

Content navigation