Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  An easy one

    Posted 01/16/09 02:43 PM

    Originally posted by: SystemAdmin


    [subsoho said:]

    Hi all

    Am very new to this environment and have an error in my code:

    [i]int NbHours = ...;
    range MaxHours = 1..NbHours;

    dvar float+ Planning[Asig][MaxHours][Space];

    minimize

    sum(a in Asig, t in 1.. MaxHours, s in Space)
    (Planning[a][t][s]);
    [/i]

    The error says :
    No range for types int range. FFC.mod


    Cant use a range to iterate across a multidimensional array ?



    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: An easy one

    Posted 01/16/09 03:26 PM

    Originally posted by: SystemAdmin


    [fwagner@Ilog.fr said:]

    The text processor messed up your code snippet, I guess you have
      sum(a in Asig, t in 1.. MaxHours, s in Space)
          Planning[a][t][b][ s ][/b];

    How ar [tt]Asig [/tt] and [tt]Space [/tt]defined?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: An easy one

    Posted 01/16/09 05:25 PM

    Originally posted by: SystemAdmin


    [jfk said:]

    the code you provided one can identify a couple of errors:
    1. your array has just 2 dimension in the goal meanwhile you defined it (and actually the iterator is set up int he sum) as 3d
    2. you didn't define range of Space and Asig
    3. you want to use a range (MaxHours) as an integer when you define your range


    int NbHours = 10;
    range MaxHours = 1..NbHours;
    range Asig = 4..6;//<------new line - pr.2<br />range Space = 11..12;//<------new line - pr.2<br />
    dvar float+ Planning[Asig][MaxHours][Space];

    minimize
      sum(a in Asig, t in MaxHours, s in Space) //<------corrected line - pr.3<br />      Planning[a][t][s];//<------corrected line - pr.1<br />

    I admit the error message is a bit ambiguous, but it is a generated message which sometimes makes it difficult to compose a really meaningful English sentence.
    I hope it helps
    cheers
    #DecisionOptimization
    #OPLusingCPLEXOptimizer