Page 1 of 1

Closed form of a constraint

Posted: Fri Aug 31, 2018 1:07 pm
by mrv_ce
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.

Re: Closed form of a constraint

Posted: Fri Aug 31, 2018 4:07 pm
by cbhomia

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 . ... Definition

Re: Closed form of a constraint

Posted: Tue Nov 13, 2018 7:52 pm
by mrv_ce
Thanks a lot. It become very useful for me.