Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Writing model in OPL

    Posted 03/30/12 09:28 AM

    Originally posted by: bl4ckic3


    Hi all
    I would like to know how to use OPL to model such equation:

    http://bl4ckic3.persiangig.com/opl.png

    The problem I faced in the pdf manual for OPL is they never show you mathematical model so I don't know how they designed the code.
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Writing model in OPL

    Posted 03/30/12 09:58 AM

    Originally posted by: SystemAdmin


    Hello.

    It's very simple. Just use "forall", "sum" and "max". Lets take for example (1). Assuming that Q and Qmax are integer variables and OB is an integer constant, the problem can be modeled as follows:
    
    
    
    int d = 3; 
    
    int n = 3; dvar 
    
    int Qmax[1..d][1..d]; dvar 
    
    int Q[1..d][1..d][1..n]; 
    
    int OB = 10;   constraints 
    { forall(b in 1..d) OB == sum(f in 1..d, j in 1..n) (Qmax[b][f] - Q[b][f][j]); 
    }
    


    Best, Petr
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Writing model in OPL

    Posted 03/31/12 12:29 AM

    Originally posted by: bl4ckic3


    Dear Peter, thank you for your awesome response, I have better understanding now.
    I am completely beginner in this subject and I have very limited time
    I started to write constraint.
    the first one :

    forall(b in 1..d)
    Qmax[b][f]== max(Q[b][f][j]);
    write Qmax[b][f];

    I don't know its right to ask such stupid question here, but I wanted to know is it right way for defining first constraint?
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: Writing model in OPL

    Posted 04/02/12 04:19 AM

    Originally posted by: SystemAdmin


    Hello.

    This equation is not clear in your picture: it doesn't say on what index operator max iterates. Is it j? Assuming that it is j, the right syntax in OPL is:
    
    forall(b in 1..d) forall(f in 1..d) Qmax[b][f] == max(j in 1..m) Q[b][f][j];
    


    Petr
    #DecisionOptimization
    #OPLusingCPOptimizer