Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Cannot extract expression, QP problem

    Posted 11/30/11 07:02 PM

    Originally posted by: llattila


    I'm trying to create a QP model but for some reason my code cannot extract the minimization function. Getting the following error code:

    CPLEX(default) cannot extract expression: minimize distance.

    Here I have listed the pieces of code, which have an impact on the distance expression.

    tuple target{
    int id;
    float x;
    int day;
    }

    {object} objects = ...;
    {target} targets = ...;

    dvar float locationXhttp://0..maxDaysobjects;
    dvar boolean objectAndTargetobjectstargets;

    dexpr float distance = sum (o in objects, t in targets) objectAndTarget[o][t] * locationXhttp://t.day[o]^2 + (other conditions come here)

    As soon as put the locationXhttp://t.day[o] to the second power, it gives the error message. Other parts of the distance functions seems to be working (such as (t.x)^2 ).

    Basically the targets have a day between 1 to maxDays and the locationX is a different value for different days for different objects. I have included day 0 for the location as well as that is the initial location of my objects. objectAndTarget is a boolean value, true if a specific object chooses a specific target.

    I'm using IBM ILOG CPLEX Optimization Studio 12.3 on Windows 7.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Cannot extract expression, QP problem

    Posted 11/30/11 07:07 PM

    Originally posted by: llattila


    And of course it didn't properly show the code. Let's try again :)

    tuple target{
    int id;
    float x;
    int day;
    }
     
    {object} objects = ...;
    {target} targets = ...;
     
    dvar float locationX[0..maxDays][objects];
    dvar boolean objectAndTarget[objects][targets];
     
    dexpr float distance = sum (o in objects, t in targets) objectAndTarget[o][t] * locationX[t.day][o]^2 + (other conditions come here)
    


    As soon as put the
    locationX[t.day][o]
    
    to the second power, it gives the error message. Other parts of the distance functions seems to be working (such as (t.x)^2 ).
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Cannot extract expression, QP problem

    Posted 11/30/11 07:07 PM

    Originally posted by: llattila


    And of course it didn't properly show the code. Let's try again :)

    tuple target{
    int id;
    float x;
    int day;
    }
     
    {object} objects = ...;
    {target} targets = ...;
     
    dvar float locationX[0..maxDays][objects];
    dvar boolean objectAndTarget[objects][targets];
     
    dexpr float distance = sum (o in objects, t in targets) objectAndTarget[o][t] * locationX[t.day][o]^2 + (other conditions come here)
    


    As soon as put the
    locationX[t.day][o]
    
    to the second power, it gives the error message. Other parts of the distance functions seems to be working (such as (t.x)^2 ).
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Cannot extract expression, QP problem

    Posted 11/30/11 07:46 PM

    Originally posted by: SystemAdmin


    The dexpr 'distance' as it currently stands is a cubic expression- since 'locationX' (a float dvar) is being squared and then being multiplied with 'objectAndTarget' (a boolean dvar). CPLEX only supports quadratic expressions; higher order non-linear algebraic forms are not currently supported and thus you get an 'extraction error'. You will need to reformulate the model to a quadratic form in order to solve it.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Cannot extract expression, QP problem

    Posted 12/13/11 10:25 AM

    Originally posted by: llattila


    Thanks for answering. Trying to reformulate the objective function and try again :)
    #DecisionOptimization
    #OPLusingCPLEXOptimizer