Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  problem-formulation for master-thesis: "OPL Operator not available for ...

    Posted 06/16/12 03:17 PM

    Originally posted by: CDN3_Daniel_Cramer


    Dear Community,

    I am working on my Master-Thesis and I got a problem to implement a model of the capacitated lot sizing problem. The backgroung: I try to optimize the purchasing behaviour of a company.

    My problem is that I got the following message: "Operator not available for int => int"
    The problemmarker says, it has something to do with the expression in the first constraint after the double dots ("b => 1")

    The identifiers are all in German - sorry for that...

    Code of the .mod:
    
    
    
    float h = ...; 
    
    int p = ...; 
    
    int s = ...; 
    
    int n = ...; 
    
    int M = ...;   tuple Material 
    {  string Nummer; 
    
    int          Anforderungsmenge;
    };   
    {Material
    }    Bedarf = ...;   
    {string
    } Nummer            = 
    {a | <a,b> in Bedarf
    }; 
    {
    
    int
    }    Anforderungsmenge = 
    {b | <a,b> in Bedarf
    };   
    
    int Bedarfgesamt[Nummer][Anforderungsmenge];   dvar int+     Bestand[Nummer][Anforderungsmenge]; dvar int+     Bestellmenge[Nummer][Anforderungsmenge]; dvar 
    
    boolean  Bestellung[Nummer][Anforderungsmenge];   minimize sum(a in Nummer, b in Anforderungsmenge) (s * Bestellung[a][b] + h * Bestand[a][b] + p * Bestellmenge[a][b]);   subject to
    { forall(a in Nummer, b in Anforderungsmenge : b => 1) Bestellmenge[a][b] == Bedarfgesamt[a][b] - Bestand[a][b-1] + Bestand[a][b];   forall(a in Nummer, b in Anforderungsmenge) Bestellmenge[a][b] - M*Bestellung[a][b] <= 0;   forall (a in Nummer) Bestand[a][0] == Bedarfgesamt[a][0]; 
    };
    


    Code of the .dat:
    
    n = 23; M = 6000; s = 100; h = 0.2; p = 10; Bedarf = 
    { <
    "123",0>, <
    ",20>, <",40>, <
    ",0>, <",20>, <
    ",0>, <",20>, <
    ",20>, <",120>, <
    ",0>, <",20>, <
    ",20>,<",1120>, <
    ",2>, <",20>, <
    ",230>, <",20>, <
    ",20>, <",20>, <
    ",20>, <",20>, <
    ",20>,<",0>, <
    ",20>, <",40>, <
    ",0>, <",20>, <
    ",0>, <",20>, <
    ",20>, <",120>, <
    ",0>, <",2320>,<
    ",20>, <",1120>, <
    ",2>, <",20>, <
    ",230>, <",20>, <
    ",320>, <",520>, <
    ",420>, <",20>, <
    ",120>}; 
    };
    


    The model express for the company, in which period an order should be done and also the demand of the product (there are 2 products (123 and 456)).
    I also attached the mathematical model (the variables in the model do not match with those in the OPL-model, but the structure of the variables are nearly the same).

    Maybe someone has a tip for me? Or should I explaine more? (Sry for my bad English)

    Thanks for your help!

    Greetings from Germany
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: problem-formulation for master-thesis: "OPL Operator not available for ...

    Posted 06/16/12 04:18 PM

    Originally posted by: CDN3_Daniel_Cramer


    I made a problem when I copied the .dat-Data:

    The post is not correct, when I posted it.

    For information look in the attached file.

    That should be correct now...
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: problem-formulation for master-thesis: "OPL Operator not available for ...

    Posted 06/18/12 04:40 AM
    Hi,

    can you try to replace

    b => 1
    


    by

    b >= 1
    


    ?

    regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: problem-formulation for master-thesis: "OPL Operator not available for ...

    Posted 06/18/12 05:38 AM

    Originally posted by: CDN3_Daniel_Cramer


    Life could be so easy...
    That works - perferct - but I got another problem:
    In the same constraint, the problemmarker says, that CPLEX is unable to extract this expression.

    Last but not least - I am not sure, whether my variable-declaration (and the tuple) are correct.

    If I made -- instead of your tip -- the following:
    forall(a in Nummer, b in Anforderungsmenge : b == 1) 
            Bestellmenge[a][b] == Bedarfgesamt[a][b] - Bestand[a][b-1] + Bestand[a][b];
    


    then there is no problem, but CPLEX didn't want to solve it (my decision variables are all zero)

    Greetings
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: problem-formulation for master-thesis: "OPL Operator not available for ...

    Posted 06/18/12 08:45 AM
    Hi

    forall(a in Nummer, b in Anforderungsmenge : b >= 1) 
            Bestellmenge[a][b] == Bedarfgesamt[a][b] 
            //- Bestand[a][b-1]
             + Bestand[a][b];
    


    works fine too.
    The problem in your code is that Bestand[a] b-1 does not exist sometimes.

    Maybe what you need is

    forall(a in Nummer, b in Anforderungsmenge : b >= 1) 
            Bestellmenge[a][b] == Bedarfgesamt[a][b] 
            - Bestand[a][prev(Anforderungsmenge,b)]
             + Bestand[a][b];
    


    Regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: problem-formulation for master-thesis: "OPL Operator not available for ...

    Posted 06/18/12 05:54 PM

    Originally posted by: CDN3_Daniel_Cramer


    Thanks again for your comment - I tried your code, but I am not able to define the prev-command like in the OPL-documentary...
    This will be the last time that I am asking you ;)

    Thanks again, Mr Fleischer
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: problem-formulation for master-thesis: "OPL Operator not available for ...

    Posted 06/19/12 12:28 PM

    Originally posted by: CDN3_Daniel_Cramer


    I used an OPL-example to learn, how to solve my problem!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer