Problem with Constraint

Problems with modeling
Post Reply
Rofice
User
User
Posts: 28
Joined: 6 years ago

Problem with Constraint

Post by Rofice »

Hi,
I am facing problem in making some constraints. At the end of this briefing you can find model. One can see eq_2 under mixer section, it is non-linear equation and I want to transform into linear equation because I am using MIP modelling. Eq_5 is basically energy balance equation of the below form
m*cp*t1 = m*cp*t2
where m and t are variables and cp is constant, so multiplication of two variables are not allowed in MIP modelling so in order
to make above equation linear, I introduce a new variable z and replace m and t with z and resulting equation become linear as follows
z1*cp =z2 *cp
and bounds of z is assume z.lo = m.lo*t.lo and z.up = m.up*t.up . Uptill this point constraints work well but when I construct another equation to get back value of t, equation again become non linear because t = z/f where z and f are variables (eq_3 in model). Currently as I knew that f is equal to 6200 so I divided by 6200 instead by F but again problem is I dont want to make variable 'f' a scalar quantity.

Please help me in this regard how to make a constraint that I can get value of t and f remain variable and problem still remain MIP???

Scalars
eps1 /0.0001/
supply Raw material kg per mint /1240 /
Feed_cost Feed cost per kg / 0.068 /



* upper Limits
uflow upper limit to flow / 100000 /
utemp upper limit to temp /7/
upress upper limit to prssure /4/

;
sets

str process streams /1*3/
compon chemical components /
H2O
LAMI
CELL
MANN
ALGI
ASH
PRO
FUC
Lip
/

sets
mxr mixer / 1 /


* ================
*
* Mixer
*
* ================


imxr(mxr,str) inlet streams to mixer /
1.(1,2)


/
omxr(mxr,str) outlet stream from mixer /
1.3
/

;



Parameters
composition(compon) chemical composotion of feed /

LAMI = 0.14
CELL = 0.06
MANN = 0.12
ALGI = 0.23
ASH = 0.26
PRO = 0.12
FUC = 0.05
LIP = 0.02

/




parameter cp(str) pure component heat capacites
/
1 1.00
2 2.99
3 2.59

/



* ================
*
* Streams
*
* ================
binary variable y(str) ;
variable
profit overall profit ($1000 per year);
positive variables

fc(str,compon) component mass flowrate (kg per mint)
f(str) stream mass flowrate (kg per mint)
p(str) stream pressure (mega-pascal)
t(str) stream temperature (100 k)


equations
fbal(str) Total flow
feed(compon) define feed component flows
feed2 ammount of water added to make 70% composition of water
feed3 total flow of stream 2 setting to component flow of water
obj objective function
a100 feed avaialble is equal to supply

;

fbal(str)..
f(str) =e= sum( compon, fc(str,compon) ) ;

feed(compon)$composition(compon)..
fc('1',compon) =e= f('1') * composition(compon) ;

a100.. f('1') =e= supply ;

feed2..
fc('3','h2o') =e= 0.8*f('3') ;

feed3..
f('2') =e= fc('2','H2O') ;




* ================
*
* Mixer 1
*
* ================
positive variable
mxr_qh(mxr)
mxrp(mxr) mixer pressure (m-pa)
mxrt(mxr) mixer temperature (100 k)
z(str)
;

equations
eq_1(mxr,compon) component balance in mixer
eq_2 heat balance in mixer
eq_3 returing value of temperature
eq_4(mxr,str) inlet pressure relation
eq_5(mxr,str) outlet pressure relation


;
*component balance
eq_1(mxr,compon)..
sum(str$omxr(mxr,str),fc(str,compon)) =e= sum(str$imxr(mxr,str),fc(str,compon)) ;


eq_2(mxr)..

* sum( str $ imxr(mxr,str) , f(str) * t(str) * cp(str) ) =e=
* sum( str $ omxr(mxr,str) , f(str) * t(str) * cp(str) ) ;

* Here I introduced new variable z which is equal to z = f(str)*t(Str), for making above equation linear
* and bounds of z is equal to f.lo*t.lo and f.up*t.up

sum( str $ imxr(mxr,str) , z(str) * cp(str) ) =e=
sum( str $ omxr(mxr,str) , z(str) * cp(str) ) ;


eq_3(mxr)..
* below equation has one limitation, I am not finding a way how to formulate constraint
*that can give back value of temperature, actually value of t can be calculated
* dividing z by total flow. However if a do so, constraint will again become non- linear
* because both flow and z are variables, please help me to formulate constraint

sum( str $ omxr(mxr,str) , z(str)/6200) =e= sum( str $ omxr(mxr,str) , t(str)) ;

eq_4(mxr,str) $ (imxr(mxr,str)$(ord(mxr) eq 1))..
mxrp(mxr) =e=
p(str) ;


eq_5(mxr,str) $ (omxr(mxr,str)$(ord(mxr) eq 1))..
mxrp(mxr) =e=
p(str) ;


* ================================
* = Objective function =
* ================================

obj.. profit =e=
-510*(f('1')* Feed_cost)
;

* ==================
* = Bounds =
* ==================
f.lo(str) = 0;
f.up(str)= 100000 ;
p.lo(str) = 0.1;
p.up(str) = 4.0;
t.lo(str) = 2.93 ;
t.up(str) = 7 ;
z.lo(str) = 0 ;
z.up(str) = 43400 ;

* plant design capacity based on ethanol
*f.up('47') = 300;
* Seaweed feed
t.fx('1') = 2.93;
p.fx('1') = 0.1 ;
z.fx('1') = 3633.2;

* Water feed
t.fx('2') = 2.93;
p.fx('2') = 0.1 ;






* ==================
* = m i x e r =
* ==================


mxrt.lo(mxr) = 2.73 ;
mxrt.up(mxr) = 7 ;
mxrp.lo(mxr) = 0.1 ;
mxrp.up(mxr) = 4.0 ;


t.fx('3') = 2.931;
*option nlp = cplex;
model m /all/;

solve m maximize profit using mip;

Display f.l,p.l,t.l,z.l;
Manassaldi
User
User
Posts: 118
Joined: 7 years ago
Location: Rosario - Argentina

Re: Problem with Constraint

Post by Manassaldi »

Hi, try a Mc Cormick relaxation for bilinear product. This is a linear approximation of a product of two variables. obviously you will find a difference with the exact solution. regards!
Post Reply