One of Objective Parameters is Fuzzy Linear Programming

Problems with modeling
Post Reply
Merve Kılınç Yılmaz
User
User
Posts: 3
Joined: 3 months ago

One of Objective Parameters is Fuzzy Linear Programming

Post by Merve Kılınç Yılmaz »

Hello,
I created a ration preparation model for dairy cattle. In the model I share below, the c coefficients are fuzzy because they are future price predictions and predictions of feed.
The e you see in the bulanik 2 is the amount to be used from the feed in the stock, and s is the precisely known cost of the feed in the stock.

The d you see in kisit12 is the amount of feed in stock. Here I am trying to tell the model that the amount I will use from the stock cannot be more than the amount of feed in the stock.
kisit 34 and 35 mean buy new feed if the amount of feed in stock has been reset.

My problem here is: "h equations and fuzzy equations" are the equations I created to solve the fuzzy model. ac, c, uc are the triangular fuzzy number points of my feed prices. "nis" and "pis" are the best and worst solution values ​​of the piecewise objective functions. No matter what I do, I can't get a reasonable feed reduction from the stock. Even though the stock prices are much cheaper than the estimated prices, the model says to buy feed. When the prices of stock feeds are too expensive, this time it uses stock feeds. It makes every mistake I don't want.
I wonder where I am coding wrong or missing? Can you help me?

Code: Select all



Sets
    i /i1*i43/
; 

parameters
    c(i)
    ac(i)
    uc(i)
    k(i)
    s(i)
    d(i)
    rdp(i)
    rup(i)
    ndf(i)
    adf(i)
    ca(i)
    m(i)
    de(i)
    cp(i)
    f(i);

$call gdxxrw tez.xlsx par=c rng=c!a1:b43 rdim=1 cdim=0
$gdxin tez.gdx
$load c
$gdxIn

$call gdxxrw tez.xlsx par=ac rng=ac! rdim=1 cdim=0
$gdxin tez.gdx
$load ac
$gdxIn

$call gdxxrw tez.xlsx par=uc rng=uc! rdim=1 cdim=0
$gdxin tez.gdx
$load uc
$gdxIn

$call gdxxrw tez.xlsx par=k rng=k! rdim=1 cdim=0
$gdxin tez.gdx
$load k
$gdxIn

$call gdxxrw tez.xlsx par=s rng=s! rdim=1 cdim=0
$gdxin tez.gdx
$load s
$gdxIn

$call gdxxrw tez.xlsx par=d rng=d! rdim=1 cdim=0
$gdxin tez.gdx
$load d
$gdxIn

$call gdxxrw tez.xlsx par=rdp rng=rdp! rdim=1 cdim=0
$gdxin tez.gdx
$load rdp
$gdxIn

$call gdxxrw tez.xlsx par=rup rng=rup! rdim=1 cdim=0
$gdxin tez.gdx
$load rup
$gdxIn

$call gdxxrw tez.xlsx par=ndf rng=ndf! rdim=1 cdim=0
$gdxin tez.gdx
$load ndf
$gdxIn

$call gdxxrw tez.xlsx par=adf rng=adf! rdim=1 cdim=0
$gdxin tez.gdx
$load adf
$gdxIn

$call gdxxrw tez.xlsx par=ca rng=ca! rdim=1 cdim=0
$gdxin tez.gdx
$load ca
$gdxIn

$call gdxxrw tez.xlsx par=m rng=m! rdim=1 cdim=0
$gdxin tez.gdx
$load m
$gdxIn

$call gdxxrw tez.xlsx par=de rng=de! rdim=1 cdim=0
$gdxin tez.gdx
$load de
$gdxIn

$call gdxxrw tez.xlsx par=cp rng=cp! rdim=1 cdim=0
$gdxin tez.gdx
$load cp
$gdxIn

$call gdxxrw tez.xlsx par=f rng=f! rdim=1 cdim=0
$gdxin tez.gdx
$load f
$gdxIn

display
    c
    ac
    uc
    k
    s
    d
    rdp
    rup
    ndf
    adf
    ca
    m
    de
    f
    cp
;
Parameters
km /10600/
me /14.8/
hamprotein /888/
rd /1052/
ru /336/
ndff /3074/
adff /2014/
kalsiyum /22.4/
fosfor /16.6/
;



Scalar
    BM/1000000000/
    z1pis /8.316/
    z1nis /6.585/
    z2pis /131.704/
    z2nis /166.325/
    z3pis /6.585/
    z3nis   /8.316/
    
;

Variables
    z,amac1, amac2, amac3;

Positive variable
z1,z2,z3,lamda;


Integer Variable
    x(i) 'satın alımı yapılacak i. yem miktarı'
    e(i) 'stoktan kullanılacak i. yem miktarı'
;

Binary Variable
xc(i)
;

Equations
    amac
    h11
    h21
    h31
    h1
    h2
    h3
    bulanik1
    bulanik2
    bulanik3
    kisit1
    kisit2
    kisit3
    kisit4
    kisit5
    kisit6
    kisit7
    kisit8
    kisit9
    kisit10
    kisit11
    kisit12(i)
    kisit13
    kisit14
    kisit15
    kisit16
    kisit17
    kisit18
    kisit19
    kisit20
    kisit21
    kisit22
    kisit23
    kisit24
    kisit25
    kisit26
    kisit27
    kisit28
    kisit29
    kisit30
    kisit31
    kisit32
    kisit33
    kisit34(i)
    kisit35(i)
    kisit36
    kisit37
    kisit38
;

amac.. z =e= lamda;
h11.. lamda =l= amac1;
h21.. lamda =l= amac2;
h31.. lamda =l= amac3;
h1.. amac1 =e= (z1-z1nis)/(z1pis-z1nis);
h2.. amac2 =e= (z2nis-z2)/(z2nis-z2pis);
h3.. amac3 =e= ((z3nis-z3) / (z3nis-z3pis));
bulanik1.. z1 =e= sum(i,(c(i)-ac(i))*x(i));
bulanik2.. z2 =e= sum(i, c(i)*x(i)) + sum(i, e(i)*s(i));
bulanik3.. z3 =e= sum(i, (uc(i)-c(i))*x(i));
kisit1.. sum(i, e(i)*k(i)) + sum(i, x(i)*k(i)) =e= km;
kisit2.. sum(i, e(i)*m(i)) + sum(i, x(i)*m(i)) =g= me;
kisit3.. sum(i, e(i)*cp(i)) + sum(i, x(i)*cp(i)) =g= hamprotein;
kisit4.. sum(i, e(i)*rdp(i)) + sum(i, x(i)*rdp(i)) =g= rd;
kisit5.. sum(i, e(i)*rup(i)) + sum(i, x(i)*rup(i)) =g= ru;
kisit6.. sum(i, e(i)*ca(i)) + sum(i, x(i)*ca(i)) =g= kalsiyum;
kisit7.. sum(i, e(i)*f(i)) + sum(i, x(i)*f(i)) =g= fosfor;
kisit8.. sum(i, e(i)*ndf(i)) + sum(i, x(i)*ndf(i)) =g= ndff;
kisit9.. sum(i, e(i)*adf(i)) + sum(i, x(i)*adf(i)) =g= adff;
kisit10.. (sum(i, ca(i)*x(i))+sum(i, ca(i)*e(i)))-(sum(i, f(i)*x(i))+sum(i, f(i)*e(i))) =g= 0;
kisit11.. (sum(i, ca(i)*x(i))+sum(i, ca(i)*e(i)))-2*(sum(i, f(i)*x(i))+sum(i, f(i)*e(i))) =l= 0;
kisit12(i).. e(i) =l= d(i);
kisit13.. sum(i, x('i1'))+sum(i, e('i1')) =l= 40;
kisit14.. sum(i,x('i2'))+sum(i, e('i2')) =l= 40;
kisit15.. sum(i,x('i3'))+sum(i, e('i3')) =l= 60;
kisit16.. sum(i,x('i4'))+sum(i, e('i4')) =l= 70;
kisit17.. sum(i,x('i5'))+sum(i, e('i5')) =l= 10;
kisit18.. sum(i,x('i6'))+sum(i, e('i6')) =l= 10;
kisit19.. sum(i,x('i7'))+sum(i, e('i7')) =l= 30;
kisit20.. sum(i,x('i8'))+sum(i, e('i8')) =l= 20;
kisit21.. sum(i,x('i9'))+sum(i, e('i9')) =l= 30;
kisit22.. sum(i,x('i10'))+sum(i, e('i10')) =l= 40;
kisit23.. sum(i,x('i11'))+sum(i, e('i11')) =l= 10;
kisit24.. sum(i,x('i13'))+sum(i, e('i13')) =l= 6;
kisit25.. sum(i,x('i17'))+sum(i, e('i17')) =l= 7;
kisit26.. sum(i,x('i18'))+sum(i, e('i18')) =l= 1;
kisit27.. sum(i,x('i19'))+sum(i, e('i19')) =l= 40;
kisit28.. sum(i,x('i20'))+sum(i, e('i20')) =l= 15;
kisit29.. sum(i,x('i21'))+sum(i, e('i21')) =l= 25;
kisit30.. sum(i,x('i25'))+sum(i, e('i25')) =l= 20;
kisit31.. sum(i,x('i27'))+sum(i, e('i27')) =l= 10;
kisit32.. sum(i,x('i28'))+sum(i, e('i28')) =l= 40;
kisit33.. sum(i,x('i29'))+sum(i, e('i29')) =l= 30;
kisit34(i).. d(i)-e(i) =l= (1-xc(i))*BM;
kisit35(i).. x(i) =l= xc(i)*BM;
kisit36.. (x('i16')+e('i16')+x('i17')+e('i17')+x('i19')+e('i19')+x('i27')+e('i27')+x('i29')+e('i29')+x('i31')+e('i31')) =g= 0.4*(sum(i, x(i))+sum(i,e(i)));
kisit37.. (x('i16')+e('i16')+x('i17')+e('i17')+x('i19')+e('i19')+x('i27')+e('i27')+x('i29')+e('i29')+x('i31')+e('i31')) =l= 0.6*(sum(i, x(i))+sum(i,e(i)));
kisit38.. sum(i,x('i16'))+sum(i, e('i16')) =l= 0;

Model deneme / all /;
option LP= Cplex;
solve deneme using rmip maximizing z;
Attachments
tez.xlsx
(620.45 KiB) Downloaded 26 times
Post Reply