Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Sum

    Posted Thu September 03, 2009 11:39 PM

    Originally posted by: SystemAdmin


    [ivanmo said:]

    Hello everybody,

    I'm trying to model this constraint. This is what I did, but didn't work, it shows me this message "Operator not available for range -int" .  I appreciate any help.
    I attach the file .doc to be more clearer

    summation from t-1 to t+1 of x(j)(t).

    forall(j in J, f in F,t in T)
    ct2:
    //d[f][t]==sum(t+1 in T, t-1 in T)x[j][t];
    d[f][t]==sum(t in T-1..T+1)x[j][t];

    Thanks

    Ivan
    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: Sum

    Posted Thu September 03, 2009 11:39 PM

    Originally posted by: SystemAdmin


    [jfk said:]

    hello,
    I assume you are talking about OPL...
    the following code works though I have no idea what are the indexes of the array x:

    int F = 4;
    int J = 4;
    int T = 4;

    dvar int d[f in 1..F, t in 1..T];
    dvar int x[j in 1..J, t in 1..T]; //you write in the doc: "t for all f f is element in F" what is that??

    subject to {
      forall(f in 1..F, t in 2..T-1)
          d[f,t] == sum(j in 1..J, k in t-1..t+1) x[j,k];
    /*     
      forall(f in 1..F) {
          d[f,T] == ??;
          d[f,1] ==??;
      }
    */ //you have to take care of these elements separately     
    }

    in your shoes I would take an example and start from there...

    I hope it helps

    cheers
    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: Sum

    Posted Fri September 04, 2009 10:31 PM

    Originally posted by: SystemAdmin


    [ivanmo said:]

    Hello

    thanks for the help...
    Yes I'm talking about OPL.
    In the doc there's a mistake .

    To be more clearer I sent the hole code, anyways I'm gonna try with the info you gave me and again THANKS A LOT

    int PlanHor=...;
    range T=1..PlanHor;

    {string} J=...; 
    {string} R=...;
    {string} F=...; 
    {string} JP=...;
    {string} JS=...;

    float p[J]=...;
    float cv[J]=...;
    float ch[J]=...;
    float cf[J]=...;
    float co[R]=...;
    float D[J][T]=...;
    float C[R][T]=...;
    float c[R][J]=...;
    float B=...;
    float M=...;
    float O[R][T]=...;
    float u[J][JS]=...;
    float Pc[J]=...;
    float Rb[J][T]=...;
    float penalup[J][T]=...;
    float penaldwn[J][T]=...;

    float Inv[J]=...;

    dvar int+ d[J][T];
    dvar int+ x[J][T];
    dvar int+ xs[JS][T];
    dvar int+ i[J][0..PlanHor];
    dvar int+ o[R][T];

    dvar boolean y[J][T];
    dvar boolean Zup[J][T];
    dvar boolean Zdwn[J][T];

    maximize
    sum(j in J, t in T) p[j] * d[j][t]-
    sum(j in J, t in T) ch[j] * i[j][t]-
    sum(j in J, t in T) cv[j] * x[j][t]-
    sum(j in J, t in T) cf[j] * y[j][t]-
    sum(j in J, t in T) Rb[j][t] * x[j][t]-
    sum(j in J, t in T) Pc[j] * x[j][t]-
    sum(r in R, t in T) co[r] * o[r][t]-
    sum(j in J, t in T) penalup[j][t]*Zup[j][t]-sum(j in J, t in T)penaldwn[j][t]*Zdwn[j][t];

    subject to {

    forall(j in J, t in T)
    ct1:
    i[j][t-1]+x[j][t]==d[j][t]+sum(js in JS)u[j][js]*xs[js][t] + i[j][t];

    forall(j in J, f in F,t in T)
    ct2:
    //d[f][t]==sum(t+1 in T, t-1 in T)x[j][t];
    d[f][t]==sum(t in T-1..T+1)x[j][t];

    forall(j in J, t in T)
    ct3:
    d[j][t]-D[j][t]<= Zup[j][t]*M;<br />
    forall(j in J, t in T)
    ct4:
    D[j][t]-d[j][t]<= Zdwn[j][t]*M;<br />
    forall(j in J, t in T, r in R)
    ct5: sum(j in J)c[r][j]*x[j][t]<=C[r][t]+o[r][t];<br />
    forall(r in R, t in T)
    o[r][t]<=O[r][t];<br />
    forall(j in J, t in T)
    ct6: x[j][t]<=B*y[j][t];<br />
    forall(j in J, t in T)
    i[j][1]==Inv[j];

    forall(j in J, t in T)
    i[j][0]==Inv[j];
    }
    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: Sum

    Posted Fri September 11, 2009 08:57 AM

    Originally posted by: SystemAdmin


    [ivanmo said:]

    Hello, can any one tell me where can I find examples, close to this problem, I've tried to find something similar and I haven't found nothing like this.

    Thanks
    #DecisionOptimization
    #MathematicalProgramming-General