small code tips

1

Statistiques

504 visites, 1,239 vues

Outils

Partager

License

This tutorial is licensed under CC BY-NC 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Sets p 'products' / low, medium, high /

r 'raw materials' / scrap, new /

tt 'long horizon' / 1*4 /

t(tt) 'short horizon' / 1*3 /;

Table a(r,p) input 'coefficients'

low medium high

scrap 5 3 1

new 1 2 3;

Table c(p,t) 'expected profits'

1 2 3

low 25 20 10

medium 50 50 50

high 75 80 100;

Variables x(p,tt) 'production and sales'

s(r,tt) 'opening stocks'

profit;

Positive variables x, s;

Equations cc(t) 'capacity constraint'

sb(r,tt) 'stock balance'

pd 'profit definition' ;

cc(t).. sum(p, x(p,t)) =l= m;

sb(r,tt+1).. s(r,tt+1) =e= s(r,tt) - sum(p, a(r,p)*x(p,tt));

pd.. profit =e= sum(t, sum(p, c(p,t)*x(p,t))

- sum(r, misc("storage-c",r)*s(r,t)))

+ sum(r, misc("res-value",r)*s(r,"4"));

s.up(r,"1") = misc("max-stock",r);

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!