You can find some here (page 14): http://www.minlp.org/pdf/GBDEWOGrossmann.pdf
Th Basic Steps are simple, the difficult is the manipulation of the propositions.
Best regard!
Modeling the absolute value

 User
 Posts: 58
 Joined: 1 year ago
 Location: Rosario  Argentina
Re: Modeling the absolute value
Hi guys, I have a further question:
I still have not fully understood how to modell the absolute value of a difference in GAMS. I have used the following equations for binary variables for modelling: abs(x(t)  y(t)):
eq_z_firstCondition(t).. z(t) =l= 2  x(t)  y(t);
eq_z_secondCondition(t).. z(t) =l= x (t) + y(t);
but what if you don't have binary variables but for example a sum:
abs( (sum(t, x(t)))  (sum(t, y(t))).
How could I model something like that?
I still have not fully understood how to modell the absolute value of a difference in GAMS. I have used the following equations for binary variables for modelling: abs(x(t)  y(t)):
eq_z_firstCondition(t).. z(t) =l= 2  x(t)  y(t);
eq_z_secondCondition(t).. z(t) =l= x (t) + y(t);
but what if you don't have binary variables but for example a sum:
abs( (sum(t, x(t)))  (sum(t, y(t))).
How could I model something like that?
Re: Modeling the absolute value
Hi guys,
does nobody have a clue? I just want incoorporate the absolute value of:
abs( (sum(t, x(t)))  (sum(t, y(t))) (with x(t) and y(t) being binary variables)
Manassaldi suggest the following for binary variables:
Let's say x(t) and c(t) are not binary variables. How would you model the absolute value of the difference between them: abs (x(t)c(t))?
does nobody have a clue? I just want incoorporate the absolute value of:
abs( (sum(t, x(t)))  (sum(t, y(t))) (with x(t) and y(t) being binary variables)
Manassaldi suggest the following for binary variables:
Code: Select all
eq1(t).. 1  x(t) + c(t) + absvalue(t) =g= 1;
eq2(t).. 1  x(t) + 1c(t) + 1absvalue(t) =g= 1;
eq3(t).. x(t) + 1c(t) + absvalue(t) =g= 1;
eq4(t).. x(t) + c(t) + 1 absvalue(t) =g= 1;
eq5.. z =e= sum(t,absvalue(t) )

 User
 Posts: 58
 Joined: 1 year ago
 Location: Rosario  Argentina
Re: Modeling the absolute value
Hi again PeterBe, I think this can works
x(t) and c(t) are continuous variables
p(t) are binary variables
M is a sufficiently large number (BigM parameter)
if "p=1", by "eq3" (xc) is greater than 0 so by "eq1" and "eq2" absvalue = xc (the rest of equation are also satisfied)
if "p=0", by "eq6" (xc) is lower than 0 so by "eq4" and "eq5" absvalue = cx (the rest of equation are also satisfied)
eq1(t).. absvalue(t) =l= x(t)  c(t) + (1p(t))*M;
eq2(t).. absvalue(t) =g= x(t)  c(t)  (1p(t))*M;
eq3(t).. x(t)  c(t) =g= (1p(t))*M
eq4(t).. absvalue(t) =l= c(t)  x(t) + p(t)*M;
eq5(t).. absvalue(t) =g= c(t)  x(t)  p(t)*M;
eq6(t).. x(t)  c(t) =l= p(t)*M
eq7.. z =e= sum(t,absvalue(t))
All this restrictions are for "z = sum(t,abs(x(t)c(t)))" with x and c continuous variables
Bye!
x(t) and c(t) are continuous variables
p(t) are binary variables
M is a sufficiently large number (BigM parameter)
if "p=1", by "eq3" (xc) is greater than 0 so by "eq1" and "eq2" absvalue = xc (the rest of equation are also satisfied)
if "p=0", by "eq6" (xc) is lower than 0 so by "eq4" and "eq5" absvalue = cx (the rest of equation are also satisfied)
eq1(t).. absvalue(t) =l= x(t)  c(t) + (1p(t))*M;
eq2(t).. absvalue(t) =g= x(t)  c(t)  (1p(t))*M;
eq3(t).. x(t)  c(t) =g= (1p(t))*M
eq4(t).. absvalue(t) =l= c(t)  x(t) + p(t)*M;
eq5(t).. absvalue(t) =g= c(t)  x(t)  p(t)*M;
eq6(t).. x(t)  c(t) =l= p(t)*M
eq7.. z =e= sum(t,absvalue(t))
All this restrictions are for "z = sum(t,abs(x(t)c(t)))" with x and c continuous variables
Bye!
Re: Modeling the absolute value
Dear Friend
I've Written a MIQCP code which has an absolute value in its constraints and I don't know how exactly I must write it so that the code works.
here is the constraint:
sum((n,m,t),abs(z(n,m,t)  z(n,m,t+1)) =l= 2*j
the summation basically is based on t (time) and I want this absolute value constraint to work within my code
I'll be so thankful if you guide me
Best Reards
Ghassem
I've Written a MIQCP code which has an absolute value in its constraints and I don't know how exactly I must write it so that the code works.
here is the constraint:
sum((n,m,t),abs(z(n,m,t)  z(n,m,t+1)) =l= 2*j
the summation basically is based on t (time) and I want this absolute value constraint to work within my code
I'll be so thankful if you guide me
Best Reards
Ghassem

 User
 Posts: 58
 Joined: 1 year ago
 Location: Rosario  Argentina
Re: Modeling the absolute value
Hi,
What kind of variables are z and j?
What kind of variables are z and j?
Re: Modeling the absolute value
Hi,
Z is a binary variable and J is a scalar
actually the Z variable represents a line status (being in circuit or out of it) and J represents the maximum number of lines which can get out of service
I want to use the mentioned constraint to express the maximum number of switching in a system, but I don't know how to insert it into my codes, so that it works properly.
Z is a binary variable and J is a scalar
actually the Z variable represents a line status (being in circuit or out of it) and J represents the maximum number of lines which can get out of service
I want to use the mentioned constraint to express the maximum number of switching in a system, but I don't know how to insert it into my codes, so that it works properly.

 User
 Posts: 58
 Joined: 1 year ago
 Location: Rosario  Argentina
Re: Modeling the absolute value
Hi, this constraints are equivalent to "sum((n,m,t),abs(z(n,m,t)  z(n,m,t+1)) =l= 2*j"
With the command "$" you must decide what happens with the last t
eq1(n,m,t).. 1  z(n,m,t) + z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq2(n,m,t).. 1  z(n,m,t) + 1z(n,m,t+1) + 1absvalue(n,m,t) =g= 1;
eq3(n,m,t).. z(n,m,t) + 1z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq4(n,m,t).. z(n,m,t) + z(n,m,t+1) + 1absvalue(n,m,t) =g= 1;
eq5.. sum((n,m,t),absvalue(n,m,t)) =l= 2*j;
Bye
With the command "$" you must decide what happens with the last t
eq1(n,m,t).. 1  z(n,m,t) + z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq2(n,m,t).. 1  z(n,m,t) + 1z(n,m,t+1) + 1absvalue(n,m,t) =g= 1;
eq3(n,m,t).. z(n,m,t) + 1z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq4(n,m,t).. z(n,m,t) + z(n,m,t+1) + 1absvalue(n,m,t) =g= 1;
eq5.. sum((n,m,t),absvalue(n,m,t)) =l= 2*j;
Bye
Re: Modeling the absolute value
Just something I didn't catch
what did you mean by "$" command?
what did you mean by "$" command?