# How to express a constraint in GAMS?

 1 sets j /1*8/ k /1*8/ l /1*8/; ... parameter s(i) DEFINED; ... variables x(j,k,l) y; equations ... definey(j,k,l) y calcucation ... definey(j,k,l) ?????  in Gams, how should I express the following inequality after definey(j,k,l); sum(i=0 through l-1) s_i * x_{j,k,l} >= y for all j,k,l  I don't know how the above i should be defined in SETS and how to express the above inequality. Thank you very much in advance. asked 04 Nov '13, 21:47 Mike390 21●4 accept rate: 0% fbahr ♦ 4.6k●7●16

 2 You define the set i separately in your sets section and do as follows. Set i/1*n/; definey(j,k,l).. y =l= sum(i\$(ord(i) lt l), s(i)) * x(j,k,l); Please note that as x(j,k,l) is not part of the summation over i, you can bring it out of the summation. answered 05 Nov '13, 00:48 Ehsan ♦ 4.8k●3●11●22 accept rate: 16% Thanks very much. That helps me a lot. (05 Nov '13, 10:10) Mike390
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×51
×2