Closed form of a constraint

Problems with syntax of GAMS
Post Reply
mrv_ce
User
User
Posts: 1
Joined: 3 weeks ago

Closed form of a constraint

Post by mrv_ce » 3 weeks ago

Hello everybody,

I'm conducting a research and I need to write this constraint to the GAMS in my model. Can you help me?

L(A(i),C(m)) +e =l= L(A(i),C(k))-r the constraint will work for every i and m not equal to k set. e is error decision variable. r is very small constant value to get rid of equality of L functions.

In this constraint L is distance function it calculates the distance between A(i) and C(m). i is alternative set. m is class set. The constraint compares their distance values. However I can not write the equation closed form for m not equal k case.(k is also same set with m) Up to now I write their open form but for more alternative set or class set member this code can not e written.

Thanks a lot.

cbhomia
User
User
Posts: 8
Joined: 3 months ago

Re: Closed form of a constraint

Post by cbhomia » 3 weeks ago

Hello,

Assuming that 'k is also same set with m' means have the same elements defined in the same order, (or they are declared aliases), you can use the dollar control option to define equations only when m is not equal to k as follows


eq1(i,m,k) $(ord(m) <> ord(k)).. L(A(i),C(m)) +e =l= L(A(i),C(k))-r

i.e. you define eq1 over domains (i,m,k) only for cases where m<>k .

https://www.gams.com/latest/docs/UG_Con ... Definition

Post Reply