Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Fixing Errors: Production Model

    Posted 12/11/11 02:11 PM

    Originally posted by: Marco_T_from_W


    Hello,

    i'am new in programming and OPL and i need to get a production model running.
    Unfortunately some errors occur even in the basic/simplified mode (see all the out comment lines).
    I hope someone here can help me with it!

    First the mod.file:
    using CPLEX;

    int ANZSTUF = ...;
    range STUF = 1..ANZSTUF;
    int ANZTAKT = ...;
    range TAKT = 1..ANZTAKT;
    //int TSTART = ...;
    //int BTOT = ...;
    int XSTUF = ...;
    int INITYSTUF = ...;
    int MAXANZWTAKT,STUF = ...;

    dvar int YSTUF,TAKT;
    //dvar int ANZWSTUF,TAKT;
    dvar int QSTUF,TAKT;
    //dvar int XSTUF;
    //dvar int INITYSTUF;
    dexpr float PR =
    sum (k in STUF: k == 5, t in TAKT) Qk,t/10;

    maximize PR;

    subject to {
    forall(k in STUF, t in TAKT: t == 1) <----ERROR: Unable to create constraint; internal error:: array
    Lagerbil_Start: INITY[k] + Qk,t - Yk,t == Qk + 1, t == 2; unsupported slot index bei ../../../src/loader.cpp:3611.
    forall(k in STUF, t in TAKT: t>= 2 && t<=9)
    Lagerbil_Mitte: Yk,t - 1 + Qk,t - Yk,t == Qk + 1,t + 1;
    forall(k in STUF, t in TAKT: t == 10)
    Lagerbil_Ende: Yk,t - 1 + Qk,t - Yk,t == 0;
    //forall(k in STUF, t in TAKT: t == 1)
    //Pufferkapa_1: INITYk,t <= X[k];
    //forall(k in STUF, t in TAKT: t>=2 && t<=10)
    //Pufferkapa_2: INITYk,t + 1 <= X[k];
    //forall(k in STUF, t in TAKT)
    //Pufferkapagesamt: sum (Y in k) X[Y] == BTOT t,k;
    forall(k in STUF, t in TAKT)
    Produktionskapa: Qk,t <= MAXANZWk,t;

    //forall(k in STUF, t in TAKT == 1)
    //Palettenanz_1: INITY[k] + Qk,1 == ANZW;
    //forall(k in STUF, t in TAKT + 1)
    //Palettenanz_2: Yk,t + Qk, t + 1 == ANZW;

    //forall(k in STUF, t in TAKT)
    //NichtNeg_1: ANZW >= 0;

    forall(k in STUF, t in TAKT)
    NichtNeg_2: Qk,t >= 0;

    forall(k in STUF, t in TAKT)
    NichtNeg_3: Yk,t >= 0;

    forall(k in STUF, t in TAKT)
    NichtNeg_4: PR >= 0;

    //forall(k in STUF, t in TAKT)
    //NichtNeg_5: INITYk,1 >= 0;
    }

    dat.file:

    ANZSTUF = 5;
    ANZTAKT = 10;
    X = 2, 2, 2, 2, 2;
    INITY = 1, 1, 1, 1, 1;
    MAXANZW = [ 1, 0, 0, 1, 1,
    1, 1, 2, 1, 1,
    1, 1, 1, 1, 0,
    0, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1] ;

    If i "out comment" the (necessary) first constraint (see Error description obove) even more errors occur:
    • CPLEX can not extract the model: IloAlgorithm cannot extract extractable.
    • CPLEX can not extract the expression: forall(k in 1..5, t in 1..10: 2 <= t && t <= 9) Lagerbil_Mitte: Y(k)(t+(-1))+Q(k)(t)+Y(k)(t)*(-1) == Q(k+1)(t+1).
    -CPLEX can not extract the expression: forall(k in 1..5, t in 1..10: 2 <= t && t <= 9) Lagerbil_Mitte: Y(k)(t+(-1))+Q(k)(t)+Y(k)(t)*(-1) == Q(k+1)(t+1).
    • CPLEX can not extract the expression: forall(k in 1..5, t in 1..10) Produktionskapa: Q(k)(t) <= MAXANZW(k)(t).
    • CPLEX can not extract the expression: forall(k in 1..5, t in 1..10) Produktionskapa: Q(k)(t) <= MAXANZW(k)(t).
    • Index for Array "MAXANZW(1)" is out of valid range: 6.
    • Index for Array "Q" is out of valid range: 6.
    • OPL can not extract the expression: forall(k in 1..5, t in 1..10: 2 <= t && t <= 9) Lagerbil_Mitte: Y(k)(t+(-1))+Q(k)(t)+Y(k)(t)*(-1) == Q(k+1)(t+1).
    • OPL can not extract the expression: forall(k in 1..5, t in 1..10) Produktionskapa: Q(k)(t) <= MAXANZW(k)(t).
    • OPL can not extract the expression: Lagerbil_Mitte: Y(k)(t+(-1))+Q(k)(t)+Y(k)(t)*(-1) == Q(k+1)(t+1).
    • OPL kcan not extract the expression: Produktionskapa: Q(k)(t) <= MAXANZW(k)(t).

    I hope someone can help me! I'am thankful for every single advice!
    Thanks!

    Marco
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Fixing Errors: Production Model

    Posted 12/11/11 04:28 PM

    Originally posted by: SystemAdmin


    There were some syntax related issues with your mod and dat file leading to the extraction errors. I have fixed them and attached them as a zip file with this post. The model in its current form, now runs without any errors to optimality. I have also put in some comments in the problematic lines to help you find out the issues.

    Hope this helps.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Fixing Errors: Production Model

    Posted 12/11/11 04:51 PM

    Originally posted by: Marco_T_from_W


    Thanks a lot for your quick response!

    Now I can try to implement some more aspects :)
    #DecisionOptimization
    #OPLusingCPLEXOptimizer