Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  getRangeSA

    Posted 08/02/13 06:58 PM

    Originally posted by: J.Haas


    Dear Forum,

    I am trying to do a sensitivity analysis on the bonds of my ranged constraints with:

    
    getRangeSA(double[] lblower, double[] lbupper, double[] ublower,double[] ubupper, 
    IloRange[] rng)
    

    However I get the  "CPLEX Error  1258: No LU factorization exists."  This is for a LP problem, from Java, under cplex 12.5.

    I understand all the inputs for getRangeSA are only to be initialized, except from the IloRange constraints which have been added to the model prior to solving. Did I get that right?

    If I try:

    getRangeSA(null, null, double[] ublower,double[] ubupper, IloRange[] rng)

    I get the error1893: no suitable method can be found

    Thanks for your help!

     

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: getRangeSA

    Posted 08/03/13 04:28 PM
    1. Did you solve the problem before calling getRangeSA? (I'm guessing the answer is yes, but safest to check.)
    2. What status did CPLEX return? (Did it find an optimal solution?)
    3. Did CPLEX do any pivots? (If the presolver finds a provably optimal solution, I'm not sure whether you can get sensitivity information.)

    Paul


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: getRangeSA

    Posted 08/03/13 05:03 PM

    Originally posted by: J.Haas


    Hi Paul,

    txs for the answer.

    Well:

    1) Yes, I did. I found an optimal solution for an MIP problem and than solved it again using solveFixed to get the duals.

    2) THe solution was optimal

    3) How can I check if cplex did pivots?

    Cheers!


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: getRangeSA

    Posted 08/03/13 06:28 PM

    I think the log should show something like "Using devex" or "Using steepest edge" at the point that solveFixed is called.

    It seems that what you are doing should work (although, on a small test problem, I got a different error when I passed in nulls for the first two arrays). One thing you might try is to retrieve the values of the integer variables (getValues), fix the integer variables by setting their bounds to both match those values (setLB, setUB), export the model as an LP file, read it into the interactive optimizer, change the type to fixed_milp, optimize the problem and ask for sensitivity analysis on the right-hand sides. If there's some hard to see error (a singular basis?), that should help find it.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: getRangeSA

    Posted 08/12/13 03:33 AM

    I cannot reproduce the problem here. The following program works without problem for me:

    import ilog.cplex.*;
    import ilog.concert.*;

    public final class RangeSA {
       public static void main(String[] args) {
          // Try each problem file passed on the command line.
          for (String file : args) {
             try {
                // Create a model from the model file passed on the command line.
                IloCplex cplex = new IloCplex();
                cplex.importModel(file);

                // Get all the constraints from the model.
                IloRange[] ranges = ((IloLPMatrix)cplex.LPMatrixIterator().next()).getRanges();

                // Find integer optimal solution and then do solveFixed() to
                // get an LP solution.
                if ( cplex.solve() ) {
                   if ( cplex.solveFixed() ) {
                      // Do sensitivity analysis and print results.
                      double[] lblower = new double[ranges.length];
                      double[] lbupper = new double[ranges.length];
                      double[] ublower = new double[ranges.length];
                      double[] ubupper = new double[ranges.length];
                      cplex.getRangeSA(lblower, lbupper, ublower, ubupper, ranges);
                      System.out.println("lblower = " + java.util.Arrays.toString(lblower));
                      System.out.println("lbupper = " + java.util.Arrays.toString(lbupper));
                      System.out.println("ublower = " + java.util.Arrays.toString(ublower));
                      System.out.println("ubupper = " + java.util.Arrays.toString(ubupper));
                   }
                   else
                      throw new RuntimeException("solveFixed() failed");
                }
                else
                   throw new RuntimeException("Not integer feasible");
                cplex.end();
             } catch (IloException e) {
                System.err.println(e.getMessage());
                e.printStackTrace();
                System.exit(-1);
             }
          }
       }
    }

    I have tried several MIPs and none showed any trouble. Can you please export your problem to a SAV file and check if things work as expected when you feed this SAV file to this program?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: getRangeSA

    Posted 08/12/13 03:48 PM

    FYI, there is what appears to be a bug in CPLEX 12.5.1 (and maybe 12.5.0), in which the Java version of getRangeSA does not accept null arguments. When I try

    getRangeSA(null, null, double[] ublower,double[] ubupper, IloRange[] rng)

    I get CPLEX error 1004 (Null pointer for required data). Ed Klotz at IBM has confirmed this behavior; so I'm not sure how you got error 1893, unless something went wrong for you before it got to the point of parsing the arguments. In any event, I suggest avoiding nulls for the bound arrays until this gets sorted out. (The docs say that nulls are valid, and apparently they work in the C++ interface, so Ed thinks this may be an issue with just the Java wrapper to something or other.)

    Paul


    #CPLEXOptimizers
    #DecisionOptimization