Reference Set Element

I am new to GAMS. This seems like it should be a simple problem, but I haven’t been able to wrap my head around the solution yet. I need a method of being able to reference a specific element (i.e., the currently selected element) within a set.

Two sets: i (crop) and k (depth)
Variable: X(i,k).
Constraints: X2_max… X(“2”,k) =L= 714

For any i, only one k can be selected in the optimization. X(i,k) is used in the objective function. I need a way of saying X(“2”,k) must be less than 714, but only one k can be selected.

When I use: X2_max(k)… X(“2”,k) =L= 714, X is allowed to be less than 714 for each k.
When I use: X2_max… sum(k,X(“2”,k)) =L= 714, X is constrained to 714 over multiple k’s.

Any thoughts would be much appreciated. I’m stuck…

Thank you.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

hi.
I think it’s better to define a set of binary variables for you decision variable(x).
in this manner, you can write a constraint like :

Con… sum(k,b(“2”,k)) =e=1

and somehow, make some relation between your binary variable and decision variable.

you can find the solution in books that talk about modeling, i advice you to check this book :

“model building” by “H.Paul Williams”

best

On Thu, Apr 28, 2011 at 4:03 AM, JessM wrote:

I am new to GAMS. This seems like it should be a simple problem, but I haven’t been able to wrap my head around the solution yet. I need a method of being able to reference a specific element (i.e., the currently selected element) within a set.

Two sets: i (crop) and k (depth)
Variable: X(i,k).
Constraints: X2_max… X(“2”,k) =L= 714

For any i, only one k can be selected in the optimization. X(i,k) is used in the objective function. I need a way of saying X(“2”,k) must be less than 714, but only one k can be selected.

When I use: X2_max(k)… X(“2”,k) =L= 714, X is allowed to be less than 714 for each k.
When I use: X2_max… sum(k,X(“2”,k)) =L= 714, X is constrained to 714 over multiple k’s.

Any thoughts would be much appreciated. I’m stuck…

Thank you.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran

WebRep
Overall rating

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.