Hallo, my name is Monika I am a student and a beginner in GAMS modelling. I have a problem with formulation of one special task. I am solving clasical linear programing problem for maximization of function but in sensitivity analysis. I want to ask if it si posible to add formula into parameters and how to add it. Concretely I need to ad formula for calculation of profit “c(j) zisk”. I have there numbers defined, but I would like to replace it with formula calculated from a table “a(i,j)” particularly it should be rows : N1, N2, T1, which are costs for material, costs for labour and revenues. Therefore for calculation profit the formula can be: c(j)= a(‘T1’,j) - a(‘N1’,j) - a(‘N2’,j).I need it for a further calculation. Because I need to lower the revenues of “Dojnice” that is a(‘T1’, ‘6’), till the revenue will be 0. And it cannot happend without that profit formula. Can you help me with this problem please? I dont know what to do with it. My program is attached and also a table a(i,j). So is it posible to add formula to define a parameter c(j)? or how can this problem be solwed? Thank you.
Program:
program.docx (12.5 KB)
$Title Optimalna struktura vyroby podniku
Sets
i vsetky podmienky
/D1 Orná pôda [ha]
D2 Jadr.krmivo [t]
D3 Bil.teliat [ks]
D4 Bil. MHD [ks]
D5 Jal:býci [ks]
Z1 Ovos [ha]
Z2 Cukrová repa [ha]
Z3 VRK [ha]
Z4 Krm.zmesi [t]
Z5 Bil.zel.krmivo [t]
Z6 Dojnice [ks]
Z7 Reprod.dojn. [ks]
Z8 Nákup KZ [t]
N1 PN [tis. Eur]
N2 MN [tis. Eur]
P1 Kuk.na sil. [ha]
P2 SNL [t]
P3 ŠH [t]
T1 Tržby [tis. Eur]/
d(i) podmienky typu direktiva /D1D5/
z(i) podmienky typu zdroj /Z1Z8/
n(i) podmienky typu naklady /N1N2/
p(i) podmienky typu poziadavky /P1P3/
t(i) podmienky typu trzby /T1/
j premenne
/1 Pšenica [ha]
2 Ovos [ha]
3 Cukr. r. [ha]
4 Kuk.na sil. [ha]
5 Viacroč.krm.[ha]
6 Dojnice [ks]
7 Telce [ks]
8 Jalovice [ks]
9 Výkrm HD [ks]
10 Predaj obil [t]
11 Nákup KZ [t]/;
Parameters
b(i) prave strany
/D1 400.00
D2 50.00
D3 0.00
D4 0.00
D5 0.00
Z1 30.00
Z2 80.00
Z3 100.00
Z4 0.00
Z5 0.00
Z6 80.00
Z7 0.00
Z8 100.00
N1 700.00
N2 2000.00
P1 50.00
P2 20.00
P3 50.00
T1 4000.00/
c(j) zisk
/1 -3.42
2 -3.15
3 7.77
4 -4.50
5 -3.35
6 10.70
7 -1.10
8 2.70
9 9.77
10 2.30
11 -1.90/;
Table a(i,j) lp
$Call=xls2gms r=A1:L20 i=a.xls o=lpp.inc
$include lpp.inc
;
Variables
x(j) objem vyroby
f hodnota ucelovej funkcie - max zisk
m hodnota min zisku;
Positive variable x;
Equations
direktiva(d) direktivne podmienky a bilancie
zdroje(z) podmienky typu zdroj
naklady (n) podmienky typu naklady
poziadavky(p) podmienky typu poziadavky
trzby (t) podmienky typu trzby
zisk hodnota UF;
direktiva(d)… sum(j,a(d,j)*x(j)) =e= b(d);
zdroje(z)… sum(j,a(z,j)*x(j)) =l= b(z);
naklady (n)… sum(j,a(n,j)*x(j)) =l= b(n);
poziadavky(p)… sum(j,a(p,j)*x(j)) =g= b(p);
trzby (t)… sum(j,a(t,j)*x(j)) =g= b(t);
zisk… sum(j,c(j)*x(j)) =e= f;
Model struktura Optimalna struktura vyroby podniku /all/;
Solve struktura using LP maximizing f;