Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model exercise2b "Production Plan"; SetRandomSeed(10) "initialize random generator"; set p := [A B C D E F G] "products"; r := [1..20] "raw material used"; m := [M1 M2 M3 M4 M5] "machines used"; f := [F1 F2 F3 F4] "factories"; q{p,m} := if(Rnd(0,1)<=0.3,1,0) "p can be manufactured with m"; integer parameter Q{f,q}:= Trunc(Rnd(10,50)) "Units of p manufactured with m at f"; S{p} := Trunc(Rnd(120,500)) "Selling price of p"; R{r,p}:= if(Rnd(0,1)<=0.3,Trunc(Rnd(1,9))) "Units of r used for p"; H{q} := Trunc(Rnd(1,9)) "Hours used on m for p"; Rc{r} := Trunc(Rnd(2,9)) "Cost of a unit r"; Mc{m} := Trunc(Rnd(2,9)) "Cost of an machine per hour"; integer variable QQ{f,q} [0..1000];; optimize; parameter ---- calculated data TS := sum{f,q[p,m]} QQ[f,q]*S[p] "Total sell"; RC := sum{f,p,m,r} R*Rc * QQ "Total raw material cost"; MC := sum{f,p,m} H*Mc * QQ "Total machine costs"; TP := TS - RC - MC "Total profit"; Ti{f,m}:= sum{p} H*QQ "Production time per machine"; TI{f} := max{m} sum{p} H*QQ "Production time per f"; Lo{p} := sum{f,m} S*QQ - sum{f,m}(sum{r} R*Rc + H*Mc)* QQ; set LO{p} := sum{f,m} S*QQ - sum{f,m}(sum{r} R*Rc + H*Mc)* QQ < 0; MO{f,m} := sum{p} H*QQ > 500; MA{f,m} := f=argmax{f}(sum{p} H*QQ) and m=argmax{m}(sum{p} H*QQ); MI{f,m} := f=argmin{f}(sum{p} H*QQ) and m=argmin{m}(sum{p} H*QQ); parameter -- other tables Qfq{f,q[p,m]}: QQ*S; Cfq{f,q[p,m]}: (sum{r} R*Rc + H*Mc)*QQ; Rfq{f,q}: Qfq - Cfq; TpR{p} := sum{f,m} QQ[f,q]*S[p] "Total sell"; TpC{p} := sum{f,m} (sum{r} R[r,p]*Rc[r] + H[p,m]*Mc[m])* QQ; TpP{p} := TpR - TpC; Time{q,f}: H*QQ; Write('Total machine costs: %d\n', MC); Write{f}('Production times in factory %s: %4d\n', f,{m}Ti); model optimize "an optimal production plan"; constraint CA{p}: sum{f,m} QQ = sum{f,m} Q; CB{m,f}: sum{p} H*QQ <= 330; --minimize obj: max{m,f} (sum{p} H*QQ); minimize obj1: sum{f,p,m} (sum{r} R*Rc + H*Mc) * QQ; end end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: