Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  how does it work: getIIS(); and getConflict();?

    Posted 04/24/13 10:39 AM

    Originally posted by: 3HDM_Dorota_Mankowska


    Dear all,

    I work on an exact solution method for my optimization problem, where I decompose the model to master and slave. The slave model is often infeasible and I need the information about the constraints/variables causing the infeasibility to add proper cutting plane to the master. In other words, I need the minimal or irreducible infeasible subsystem (MIS, or IIS, for short). There is a function in concert technology cplex.getIIS(); but I havent found any method to look into the function so far. I have tried to print out the IIS using both, conflict refiner and getIIS(), but I failed. Here is my code (using cplex 12.5 and JDK 7):

     

    IloCplex cplex = new IloCplex();
    cplex.importModel("model.lp");  
    IloLPMatrix lp = (IloLPMatrix)matrixEnum.next();
    IloRange[] rng = lp.getRanges();
    cplex.solve();
     
    IloConstraint[] constraints = new IloConstraint[rng.length];
                 
    for (int c1 = 0; c1 < rng.length; c1++)
    constraints[c1] = rng[c1];
    ConflictStatus[] conflicts=cplex.getConflict(constraints);               
    for(int i=0; i<conflicts.length; i++)
    System.out.println("conf "+i+" "+conflicts[i].toString());     ---> this here doesnt work at all with a bug: CPLEX Error  1719: Conflict is not available.
                   
    System.out.println("1 "+cplex.getIIS().getConstraint().toString());
    System.out.println("2 "+cplex.getIIS().toString());
     

    From the last two lines I get


    Starting infeasibility finder algorithm...


    Performing row sensitivity filter
    Performing column sensitivity filter

    1 [Lilog.cplex.IloCplex$IIS$Status;@2019a9d1
    2 ilog.cplex.IloCplex$IIS@74dbe8cd

    Can you please help me to find out, what an IIS in my infeasible model is and how can I get it? It would be very great, if I could at least find out, which constraints causes the infeasibility.
    Thank you in advance for your help.

    Best wishes,
    Dorota Mankowska


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: how does it work: getIIS(); and getConflict();?

    Posted 04/24/13 10:54 AM

    Method getIIS() has been deprecated, so don't use it.

    Instead use refineConflict() and getConflict().

    Can you please check if this chapter in the user manual has enough information to fix your problems?

    Basically, what you need to do is something like this (untested)


    IloLPMatrix lp = (IloLPMatrix)matrixEnum.next();
    IloRange[]
    ranges = lp.getRanges();
    IloNumVar[] vars = lp.getNumVars();
    IloConstraint[] cons = new IloConstraint[ranges.length + 2 * vars.length];
    double[] prefs = new double[cons.length];

    int next = 0;
    for (IloRange r : ranges) {
       cons[next] = r;
       prefs[next] = 1.0;
       ++next;
    }

    // Also add the bounds of the variables to the list of
    // constraints that can be part of the conflict.
    for (IloNumVar v : vars) {
       cons[next] = cplex.bound(bound(v, IloNumVarBoundType.Lower);
       prefs[next] = 1.0;
       ++next;

       cons[next] = cplex.bound(bound(v, IloNumVarBoundType.Upper);
       prefs[next] = 1.0;
       ++next;

    }
    if (cplex.refineConflict(cons, prefs)) {
       System.out.println("Conflict found");
       ConflictStatus[] status = cplex.getConflict(cons);
       for (int i = 0; i < cons.length; ++i)

          System.out.println(cons[i] + ": " + status[i]);
    }
    else {
       System.err.println("No conflict found");
    }

     

    As you can see, you explicitly need to invoke the conflict refiner before you can call getConflict(). The arguments to the conflict refiner are the constraints that may participate in the conflict. See also the reference documentation for that function.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: how does it work: getIIS(); and getConflict();?

    Posted 04/25/13 04:07 AM

    Originally posted by: 3HDM_Dorota_Mankowska


    Dear Daniel Junglas,

    thank you very much for your prompt reply.

    I have checked your code and it works. Only instead of cplex.bound(bound(v,IloNumVarBoundType.Lower)one should use  cplex.lowerBound(v).

    Nevertheless, I am not sure, whether or not the conflict refiner do the same as the deprecated getIIS() function. Basically, I dont want Cplex to refine my conflict. I need this information about the IIS not to find a conflict in my "incorrectly-constructed" model but as a feedback for another model by formulating a special cutting plane. If the information is wrong or biased, I may get into troubles. The User's Manual says only that the conflict refiner usually will deliver a smaller set of constraints to consider than the IIS finder will.

    Do you know, if this may cause problems in my case?


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: how does it work: getIIS(); and getConflict();?

    Posted 04/26/13 01:14 AM

    I'm afraid I don't understand. You cannot do with just any set of inconsistent constraints but you need a particular one?

    I also don't understand what you mean by "wrong or biased". The conflicts found by the conflict refiner are minimal in the sense that removing one constraint resolves the conflicts. The same is true for IIS. There may be multiple conflicts, so the preference values allow you to guide the conflict refiner towards "interesting" conflicts. There may also be multiple IISs for a model. The deprecated IIS finder algorithm did support several parameters that provided a tradeoff between IIS size and algorithm speed.

    In case you absolutely need to use the deprecated IIS algorithm:

    1. Run solve().
    2. If that returns false invoke getIIS(). This returns an instance of class IloCplex.IIS.
    3. Invoke
         IloConstraint[] IloCplex.IIS.getConstraints()
         IloCplex.IIS.Status[] IloCplex.IIS.getConstraintStatuses()
         IloNumVar[] IloCplex.IIS.getNumVars()
         IloCplex.IIS.Status[] IloCplex.IIS.getNumVarStatuses()
    4. A IloCplex.IIS.Status can be one of the following:
        IloCplex.IIS.Status.AtLower: lower bound of constraint or variable is in IIS
        IloCplex.IIS.Status.AtUpper: upper bound of constraint or variable is in IIS
        IloCplex.IIS.Status.Fixed: both bounds of constraint or variable are in IIS

    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: how does it work: getIIS(); and getConflict();?

    Posted 04/26/13 05:02 AM

    Originally posted by: 3HDM_Dorota_Mankowska


    By "wrong or biased" I meant that the information from the conflict refiner can deliver a smaller set of constraints than the getIIS function will. This could probably cause problems within my algorithm. I will just run both and compare the outputs and then make the decision, which one I will chose for the algorithm.

    Thank you very much.


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: how does it work: getIIS(); and getConflict();?

    Posted 03/27/18 05:33 AM

    Originally posted by: ShaCplex


    Dear daniel sir,

    why are we using  2 * vars.length in the below expression?

     

    IloConstraint[] cons = new IloConstraint[ranges.length + 2 * vars.length];

     

     

    regards,

    shahul


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: how does it work: getIIS(); and getConflict();?

    Posted 03/27/18 05:58 AM

    Because of this loop

    for (IloNumVar v : vars) {
       cons[next] = cplex.bound(bound(v, IloNumVarBoundType.Lower);
       prefs[next] = 1.0;
       ++next;

       cons[next] = cplex.bound(bound(v, IloNumVarBoundType.Upper);
       prefs[next] = 1.0;
       ++next;

    }

    which adds two elements per variable to the 'cons' array.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: how does it work: getIIS(); and getConflict();?

    Posted 03/27/18 06:01 AM

    Originally posted by: ShaCplex


    Thank you sir..


    #CPLEXOptimizers
    #DecisionOptimization