Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  cplex 126 strange error.

    Posted 03/05/15 07:12 AM

    Originally posted by: Namal


    Hello, I am using cplex for solving randomly generated SAT problems. Now I have encountered a strange error and I don't know exactly what the problem is. I am using ilolplex1.cpp as the template and populatebynonzeros because my clauses are stored in vectors where the last element is the compared to value.

    Now, why does this problem (4 variables, 2 literals, 5 clauses) leads to the error:  Failed to optimize LP
    Concert exception caught: IloExtractable 3 IloNumVarI has not been extracted by IloAlgorithm 0x205bda0

      0 -1  1  0  0
      0  0 -1  1  0
      0 -1  0  1  0
     -1 -1  0  0 -1
     -1  1  0  0  0

    while this one does not?

      1 -1  0  0  0
      1  0  0 -1  0
     -1  0  1  0  0
      0  0  0 -1  0
      1  1  0  0  1
    Solution status = Infeasible

    I assume that I ask cplex to extract some variables that are not there but I don't see which those are.

    Thank you for your answers!


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: cplex 126 strange error.

    Posted 03/06/15 01:25 AM

    This error usually occurs if you attempt to query the value for a variable that does not appear in any constraint or objective function. I suggest you double check the code that creates the model. Maybe also use IloCplex::exportModel() to export the model to an LP file and double-check that it looks as expected.

    In order to avoid this problem, you can use IloModel::add() to explicitly add each variable you create. This way you can query the variable's value even if it does not occur in any constraint/objective.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: cplex 126 strange error.

    Posted 03/06/15 04:53 AM

    Originally posted by: Namal


    Thank you very much, Daniel.  The error was indeed when I used IloModel::add(). I added variables respectively to literals and not the variables. I have another question about the objective function though. I understand that when I am looking for any solution I don't include the objective function at all.  Still I get the solution status as optimal. Is this just the default status and there are better solutions or is this really an optimal solution.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: cplex 126 strange error.

    Posted 03/06/15 06:13 AM

    If you don't add an objective function then the objective is always 0 for any feasible solution. That means that any feasible solution is optimal. That is why you get the "optimal" status.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: cplex 126 strange error.

    Posted 03/06/15 06:41 AM

    Originally posted by: Namal


    Alright, I have another question though. Sometimes I generate problems in which all elements in one column remain zero and for some of those problems I get an error

    Concert exception caught: IloExtractable 4 IloNumVarI has not been extracted by IloAlgorithm 0x273dda0
     

    sometimes I don't. For instance this problem in which there are no entries for x4 leads to the error:

    \ENCODING=ISO-8859-1
    \Problem name: IloCplex

    Minimize
     obj:
    Subject To
     c1: - x1 - x3 >= -1
     c2: - x3 + x2 >= 0
     c3: - x3 - x2 >= -1
     c4: x1 - x2 >= 0
     c5: - x1 + x2 >= 0
    Bounds
     0 <= x1 <= 1
     0 <= x3 <= 1
     0 <= x2 <= 1
    Binaries
     x1  x3  x2
    End

     

    and this one doesn't:

     

    \ENCODING=ISO-8859-1
    \Problem name: IloCplex

    Minimize
     obj:
    Subject To
     c1: - x1 + x2 >= 0
     c2: - x1 - x2 >= -1
     c3: x1 - x2 >= 0
     c4: x1 + x2 >= 1
     c5: - x2 - x3 >= -1
    Bounds
     0 <= x1 <= 1
     0 <= x2 <= 1
     0 <= x3 <= 1
    Binaries
     x1  x2  x3
    End

    Is there still something wrong with my IloModel::add() ?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: cplex 126 strange error.

    Posted 03/12/15 02:43 AM

    This is indeed quite odd. Are you sure that you are looking at the correct LP files here? I would expect the second file to throw the same exception. What if you export the respective IloModel instance to XML, like so

    #include <ilconcert/iloxmlcontext.h>
    
    IloXmlContext ctx(env);
    ctx.writeModel(model, "model.xml");
    ctx.end();
    

    Can you spot any interesting difference between the two models concerning variable x4? Maybe you can attach the two XML files here as well?


    #CPLEXOptimizers
    #DecisionOptimization