ILOG CPLEX 11.0 User's Manual > Infeasibility and Unboundedness > Diagnosing Infeasibility by Refining Conflicts > Using the Conflict Refiner in an Application

Here is an example using the conflict refiner in the C++ API of Concert Technology. You will modify one of the standard examples ilomipex2.cpp distributed with the product. Starting from that example, locate this statement in it:

cplex.solve();

Immediately after that statement, insert the following lines to prepare for and invoke the conflict refiner:

 if ( ( cplex.getStatus() == IloAlgorithm::Infeasible ) ||
           ( cplex.getStatus() == IloAlgorithm::InfeasibleOrUnbounded  ) ) {
         cout << endl << "No solution - starting Conflict refinement" << endl;

         IloConstraintArray infeas(env);
         IloNumArray preferences(env);

         infeas.add(rng); 
         infeas.add(sos1); infeas.add(sos2);
         if ( lazy.getSize() || cuts.getSize() ) {
           cout << "Lazy Constraints and User Cuts ignored" << endl;
         }
         for (IloInt i = 0; i<var.getSize(); i++) {
            if ( var[i].getType() != IloNumVar::Bool ) {
              infeas.add(IloBound(var[i], IloBound::Lower));
              infeas.add(IloBound(var[i], IloBound::Upper));
            }
         }

         for (IloInt i = 0; i<infeas.getSize(); i++) {
           preferences.add(1.0);  // user may wish to assign unique preferences
         }

         if ( cplex.refineConflict(infeas, preferences) ) {
            IloCplex::ConflictStatusArray conflict = cplex.getConflict(infeas);
            env.getImpl()->useDetailedDisplay(IloTrue);
            cout << "Conflict :" << endl;
            for (IloInt i = 0; i<infeas.getSize(); i++) {
              if ( conflict[i] == IloCplex::ConflictMember)
                   cout << "Proved  : " << infeas[i] << endl;
              if ( conflict[i] == IloCplex::ConflictPossibleMember)
                   cout << "Possible: " << infeas[i] << endl;
            }
         }
         else
            cout << "Conflict could not be refined" << endl;
         cout << endl;
      }
Now run this modified version with the model you have seen in
A Model for the Conflict Refiner. You will see results like these:
No solution - starting Conflict refinement

Refine conflict on 14 members...

 Iteration  Max Members  Min Members
         1           11            0
         2            9            0
         3            5            0
         4            3            0
         5            2            0
         6            2            1
         7            2            2
Conflict :
Proved  : c2( 2.1 <= ( x1 + x2 + 0.8 * x3 + 0.6 * x4 + 0.4 * x5 ) )
Proved  : c8( ( x2 + x3 + x4 + x5 )  <= 0)