Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  unexpected sum

    Posted 10/12/15 06:15 AM

    Originally posted by: end495


    Hi,

    When i tried to write the code below, i took following error. Can you help me to solve it? Thank you.

    //Entity set:
    int NbRawGasoline=4;
    range Raw=1..NbRawGasoline;

    int NbFuelType=3;
    range Fuel=1..NbFuelType;

    //Parameters:
    int o[Raw]=[68,86,91,99];
    int a[Raw]=[4000,5050,7100,4300];
    float p[Raw]=[31.02,33.15,36.35,38.75];
    int m[Fuel]=[95,90,85];
    float s[Fuel]=[42.15,42.95,40.99];

    //Decision Variables:
    dvar float t[Raw];
    dvar float x[Raw][Fuel];
    dvar float y[Fuel];
    dvar float z[Raw];

    //Objective Function:
    Maximize sum(j in Fuel)s[j]*y[j]-sum(i in Raw)p[i]*t[i]+(36.85-p[1])*z[1]+(36.85-p[2]*z[2]+(38.95-p[3])*z[3]+(38.95-p[4])*z[4];

     

    syntax error, unexpected sum, expecting (identifier) or '['

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: unexpected sum

    Posted 10/12/15 06:26 AM

    Originally posted by: end495


    When i write Maximize's M in lower case it's fixed. But when i write this:

     

    maximize sum(j in Fuel)s[j]*y[j]-sum(i in Raw)p[i]*t[i]+(36.85-p[1])*z[1]+(36.85-p[2]*z[2]+(38.95-p[3])*z[3]+(38.95-p[4])*z[4];

     

    Following error occurs:


    syntax error, unexpected ';' 


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: unexpected sum

    Posted 10/12/15 03:45 PM

    That means the interpreter saw the semicolon before the statement was complete. Check your closing parentheses.


    #CPLEXOptimizers
    #DecisionOptimization