Constraints restricting using upper and lower bounds

147 views
Skip to first unread message

Saber Jalilzadeh-Galaeh

unread,
Feb 4, 2009, 2:57:03 AM2/4/09
to AMPL Group
Hello every body!
 
 
I want to have a constraints which is restricted by upper bound and lower bound.
If it be just a term and not a equation it can be write using many model in AMPL book.
 
But my constraints are all equation like this one:
 
subject to constraint_2 {i in 1..N, k in 1..N, l in 1..N: i < k}:
                  sum{j in 1..N: j <> l} v[i,j,k,l] = v[k,l,k,l]  ;
 
I want to restrict this constraint by upper bound "1" and lower bound "zero".
If it is written as:
 
subject to constraint_2 {i in 1..N, k in 1..N, l in 1..N: i < k}:
               0 <= sum{j in 1..N: j <> l} v[i,j,k,l] = v[k,l,k,l] <=1 ;
 
for sure I have a error, because it is impossible we have two limit in upper bound. I mean that the term"v[i,j,k,l] = v[k,l,k,l] <=1".
 
Do you know how could I write my constraints something like the second one that have a upper and lower bound?
 
 
Thank you very much in advance for your helps !!!

Robert Fourer

unread,
Feb 8, 2009, 7:25:28 PM2/8/09
to am...@googlegroups.com, Saber Jalilzadeh-Galaeh

Given that you already have

 

   subject to constraint_2 {i in 1..N, k in 1..N, l in 1..N: i < k}:

      sum {j in 1..N: j <> l} v[i,j,k,l] = v[k,l,k,l];

 

then if you also want this sum to be greater than or equal to zero and less than or equal to one, you could specify a second constraint,

 

   subject to constraint_3 {i in 1..N, k in 1..N, l in 1..N: i < k}:

      0 <= sum{j in 1..N: j <> l} v[i,j,k,l] <= 1;

 

Or, since the sum is already constrained to equal v[k,l,k,l], you could equivalently say

 

   subject to constraint_3 {k in 1..N, l in 1..N}:

      0 <= v[k,l,k,l] <= 1;

 

Incidentally, a more concise way to write the constraint indexing is

 

   subject to constraint_2 {i in 1..N, k in i+1..N, l in 1..N}: ...

 

Bob Fourer

4...@ampl.com

 

 


From: am...@googlegroups.com [mailto:am...@googlegroups.com]

On Behalf Of Saber Jalilzadeh-Galaeh [sbr_6...@yahoo.com]
Sent: Wednesday, February 04, 2009 1:57 AM
To: AMPL Group
Subject: [AMPL 2206] Constraints restricting using upper and lower bounds

 

Thank you very much in advance for your help !!!

 


Reply all
Reply to author
Forward
0 new messages