Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

What does Ilo Error: IloAlgorithm cannot extract extractables mean

  • 1.  What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/25/12 04:03 AM

    Originally posted by: jefflee2011


    When I try to add some constraints in the model, the error occurs.
    Ilo Error: IloAlgorithm cannot extract extractables
    What does it mean?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/25/12 04:59 AM

    Originally posted by: jefflee2011


    Update:

    I add the constraint like this
    mod.add(IloRange(env, 0.0, exprCons, 0.0, nameCons);
    

    And the error occurs when the code as follows is executed
    IloCplex cplex(model)
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/25/12 08:31 AM

    Originally posted by: SystemAdmin


    This exception may occur if you try to use constraints that are not supported. Usually you would wrap your code into try-catch like this:
    
    
    
    try 
    { 
    // Your code here ... 
    } 
    
    catch (IloException& e) 
    { 
    // Handle exception ... 
    }
    

    To learn more about the "cannot extract" exception change this to something like the following:
    
    
    
    try 
    { 
    // Your code here ... 
    } 
    
    catch (IloAlgorithm::CannotExtractException& e) 
    { std::cerr << 
    "CannoExtractException: " << e << std::endl; IloExtractableArray failed = e.getExtractables(); 
    
    for (IloInt i = 0; i < failed.getSize(); ++i) std::cerr << 
    "\t" << failed[i] << std::endl; 
    // Handle exception ... 
    } 
    
    catch (IloException& e) 
    { 
    // Handle exception ... 
    }
    

    This will print out the constraints that could not be extracted.
    What do the offending constraints look like?
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/26/12 07:21 AM

    Originally posted by: jefflee2011


    I wrap all the code about the model in "try", the output is as follows.
    What is wrong about the constraints?
    
    CannoExtractException: IloAlgorithm cannot extract extractables 16, 16, 22, 22, 28, 28, 34, 34, 46, 46, 52, 52, 58, 58, 64, 64, 115, 115, 121, 121, 127, 127, 13 3, 133, 145, 145, 151, 151, 157, 157, 163 and 163 G1_p(0,0)s1: G1_u(0)s1  + -1  * G1_p(0,0)s1[0..10]  == 0 G1_p(0,0)s1: G1_u(0)s1  + -1  * G1_p(0,0)s1[0..10]  == 0 G1_p(0,1)s1: G1_p(0,0)s1  + -10  * G1_p(0,1)s1[0..40]  == 0 G1_p(0,1)s1: G1_p(0,0)s1  + -10  * G1_p(0,1)s1[0..40]  == 0 G1_p(0,2)s1: G1_p(0,1)s1  + -40  * G1_p(0,2)s1[0..40]  == 0 G1_p(0,2)s1: G1_p(0,1)s1  + -40  * G1_p(0,2)s1[0..40]  == 0 G1_p(0,3)s1: G1_p(0,2)s1  + -40  * G1_p(0,3)s1[0..40]  == 0 G1_p(0,3)s1: G1_p(0,2)s1  + -40  * G1_p(0,3)s1[0..40]  == 0 G1_p(1,0)s1: G1_u(1)s1  + -1  * G1_p(1,0)s1[0..10]  == 0 G1_p(1,0)s1: G1_u(1)s1  + -1  * G1_p(1,0)s1[0..10]  == 0 G1_p(1,1)s1: G1_p(0,0)s1  + -10  * G1_p(1,1)s1[0..40]  == 0 G1_p(1,1)s1: G1_p(0,0)s1  + -10  * G1_p(1,1)s1[0..40]  == 0 G1_p(1,2)s1: G1_p(0,1)s1  + -40  * G1_p(1,2)s1[0..40]  == 0 G1_p(1,2)s1: G1_p(0,1)s1  + -40  * G1_p(1,2)s1[0..40]  == 0 G1_p(1,3)s1: G1_p(0,2)s1  + -40  * G1_p(1,3)s1[0..40]  == 0 G1_p(1,3)s1: G1_p(0,2)s1  + -40  * G1_p(1,3)s1[0..40]  == 0 G1_p(0,0)s2: G1_u(0)s2  + -1  * G1_p(0,0)s2[0..10]  == 0 G1_p(0,0)s2: G1_u(0)s2  + -1  * G1_p(0,0)s2[0..10]  == 0 G1_p(0,1)s2: G1_p(0,0)s1  + -10  * G1_p(0,1)s2[0..40]  == 0 G1_p(0,1)s2: G1_p(0,0)s1  + -10  * G1_p(0,1)s2[0..40]  == 0 G1_p(0,2)s2: G1_p(0,1)s1  + -40  * G1_p(0,2)s2[0..40]  == 0 G1_p(0,2)s2: G1_p(0,1)s1  + -40  * G1_p(0,2)s2[0..40]  == 0 G1_p(0,3)s2: G1_p(0,2)s1  + -40  * G1_p(0,3)s2[0..40]  == 0 G1_p(0,3)s2: G1_p(0,2)s1  + -40  * G1_p(0,3)s2[0..40]  == 0 G1_p(1,0)s2: G1_u(1)s2  + -1  * G1_p(1,0)s2[0..10]  == 0 G1_p(1,0)s2: G1_u(1)s2  + -1  * G1_p(1,0)s2[0..10]  == 0 G1_p(1,1)s2: G1_p(0,0)s1  + -10  * G1_p(1,1)s2[0..40]  == 0 G1_p(1,1)s2: G1_p(0,0)s1  + -10  * G1_p(1,1)s2[0..40]  == 0 G1_p(1,2)s2: G1_p(0,1)s1  + -40  * G1_p(1,2)s2[0..40]  == 0 G1_p(1,2)s2: G1_p(0,1)s1  + -40  * G1_p(1,2)s2[0..40]  == 0 G1_p(1,3)s2: G1_p(0,2)s1  + -40  * G1_p(1,3)s2[0..40]  == 0 G1_p(1,3)s2: G1_p(0,2)s1  + -40  * G1_p(1,3)s2[0..40]  == 0   ****** Optimization takes 4.664 seconds.
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/27/12 04:45 PM

    Originally posted by: SystemAdmin


    It might help to see snippets of the code showing how the variables are declared and how the constraint expressions are formed.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/28/12 05:23 AM

    Originally posted by: jefflee2011


    Thank you very much. Here are some of my codes.
    void UnitUC::initialPowerAndStatus(IloModel &mod, IloObjective &objective)
    {
            IloEnv env = mod.getEnv();
     
            IloExpr expr(env);
     
            std::map<int, PieceWiseCurve * >::iterator pos;
            for (pos = timeIdxEnergyBidCurveMap.begin(); pos != timeIdxEnergyBidCurveMap.end(); ++pos) {
                    ...
                    IloNumColumn pCol;
     
                    for(int i=0;i<segNum;i++)
                    {
                            IloExpr exprPsegCons(env);
                            pCol = outputlevel_range(-1.0);
     
     
                            IloNumVar pVarSeg(pCol, 0., curve->incrementalQuantity[i], ILOFLOAT, name);
                            mod.add(pVarSeg);
                            pSeg.add(pVarSeg);
     
                            pCol.end();
                            if (i==0)
                            {
                                    exprPsegCons = (uVar - 1) * pVarSeg;
                            }
                            else
                            {
                                    exprPsegCons = (pSeg[i-1] - curve->incrementalQuantity[i-1]) * pVarSeg;
                            }
                            mod.add(IloRange(env, 0.0, exprPsegCons, 0.0, name));
                            exprPsegCons.end();
                            expr += curve->incrementalPrice[i] * pVarSeg;
                    }
                    time_idx++;
            }
            exprProduct.add(expr);
    }
    

    IloNumVarArray pSeg is a member of class UnitUC and is initialized in another function.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/28/12 04:31 PM

    Originally posted by: SystemAdmin


    Is, for instance, "G1_p(0,1)s1http://0..40" a name you assign to a variable? (The "http://0..40" catches my eye.)

    Is uVar an IloNumVar?

    If I'm reading your code correctly, the constraint expressions should be quadratic; but unless CPLEX is omitting an asterisk between variables, I'm not seeing products in the error output. Are 's1' and 's2' variable names?

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/29/12 04:02 AM

    Originally posted by: jefflee2011


    "G1_p(0,1)" is a name of an element in IloNumVarArray pSeg, while 0 to 40 is the range of the element.
    s1 is an index indicating scenario number.

    uVar is a IloBoolVar indicating the status of the unit. 0 indicates off and 1 indicates on.

    The model was a MIP problem before modified, maybe the quadratic constraints I added cause the error?

    if (i==0)
    {
       exprPsegCons = (uVar - 1) * pVarSeg;
    }
    else
    {
       exprPsegCons = (pSeg[i-1] - curve->incrementalQuantity[i-1]) * pVarSeg;
    }
    

    G1_u(0)s1 is the name of uVar, and 0 is the time index.
    G1_p(0,1)s1 is the name of pVarSeg and pSeg, since I store pVarSeg in pSeg. 0 is the time index and 1 is the index of segments.

    So the code above should generates expressions like this
    G1_p(0,0)s1: (G1_u(0)s1  + -1)  * G1_p(0,0)s1  == 0
    G1_p(0,1)s1: (G1_p(0,0)s1  + -10)  * G1_p(0,1)s1  == 0
    

    10 is "curve->incrementalQuantity i-1".

    I don't know why there is no parenthesis in the error output.
    I am not sure if I explained the code clearly.
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/30/12 06:46 PM

    Originally posted by: SystemAdmin


    What happens if you comment out the
    pCol.end();
    
    statement? I'm not sure at what point it is safe to purge an IloNumColumn when building a model columnwise. If you do it too soon, I suspect you get null pointers somewhere in the model, but (as always) I could be wrong. Especially where <shudder>C++</shudder> is involved.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/30/12 09:21 PM

    Originally posted by: jefflee2011


    Thank you for your attention to this matter and your assistance.
    I comment out the statement, unfortunately it doesn't work.

    If I modify the constraint like this and do not use "try" "catch"
    mod.add(IloRange(env, 0.0, exprPsegCons, IloInfinity, name));
    

    Another error occurs
    Presolve time =    0.00 sec.
    Ilo Error: CPLEX Error  5002: Q in 'G1_p(0,1)s1' is not positive semi-definite.
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 05/31/12 10:16 PM

    Originally posted by: jefflee2011


    The constraint I added can be formulated as follows
    0 <= p0 <= p0_max
    0 <= p1 <= p1_max
    (p0 - p0_max) * p1 = 0
    

    where p0 and p1 are IloNumVar, while p0_max and p1_max are constant.

    Do you have any idea how to convert the quadratic constraint to linear?
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 06/01/12 02:50 AM

    Originally posted by: SystemAdmin


    This is an equality constraint that involves the products of variables. Such constraints are not supported (I think I already stated that in another thread created by you). Quadratic constraints (constraints that involve products of variables) must be either "less than or equal" or "greater than or equal", see the for more details about what constraints CPLEX can handle.
    If I understand your constraint correctly then you want to state "either p1=0 or p0=p0max)? Maybe this can be formulated using IloCplex::ifThen()?
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 06/01/12 07:54 AM

    Originally posted by: jefflee2011


    I think I did not post a thread about quadratic constraints, but I am sorry I didn't read the instructions about the quardric constraint in the manual carefully before.
    I formulate the constraint like this
    0 <= p0 <= p0max
    0 <= p1 <= p1max
    model.add(p0 == p0max || p1 == 0);
    

    and it works.

    But if I use IloIfThen like this
    model.add(IloIfThen(env, p0<=p0max, p1==0));
    

    and it doesn't work. Presolve time = 0.00sec. I am not sure if the way I use IfThen is correct.

    By the way, can -IloBoolVar- be inclueded in the logic constraint?
    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 06/04/12 09:14 AM

    Originally posted by: jefflee2011


    I would like to formulate constraints about a piecewise function like this
    p=p0+p1+p2
     
    0<=p0<=p0max
    0<=p1<=p1max
    0<=p2<=p2max
     
    if (p0<=p0max) p1=0
    if (p1<=p1max) p2=0
    

    I write the code like this
    model.add(p0==p0max || p1==0)
    model.add(p1==p1max || p2==0)
    

    but the result is p0=0, 0<p1<p1max, p2=p2max.
    I am not sure if I use the logic constraints correctly.
    #CPLEXOptimizers
    #DecisionOptimization


  • 15.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 06/04/12 07:11 PM

    Originally posted by: SystemAdmin


    It looks correct to me, although I no longer use C++ so I might be missing something subtle. The equivalent approach in Java (using IloCplex.or() and IloOr.add()) works, so if there is a syntax problem, it may have to do with the operator overloading. You could try using the IloOr() constructor and IloOr::add() explicitly, and see if that works.

    My guess is that you could also use an instance of IloSOS2 for what you want to accomplish. This looks like a classic diseconomy of scale setup. If the "cost" of p is a piecewise linear function, that fits with what SOS2 constraints were designed for.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 16.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 06/05/12 09:36 PM

    Originally posted by: jefflee2011


    Thank you very much. The constraints are correct. I find the error in the loop when adding constraints.
    #CPLEXOptimizers
    #DecisionOptimization


  • 17.  Re: What does Ilo Error: IloAlgorithm cannot extract extractables mean

    Posted 06/05/12 09:38 PM

    Originally posted by: jefflee2011


    I really appreciate your help. The logic constraints are correct. I find the error in the loop when adding constraints.
    #CPLEXOptimizers
    #DecisionOptimization