Page 1 of 1

Multiple Conditions in one Equation

Posted: Mon Jun 10, 2019 7:09 pm
by pelorn
Hi there,

I want to set multiple variables equal to each other without having to define multiple equations for that. Is there a smooth way to do this?

I.e. something like this:

Neweq.. AI("1")=E=BI("1")=E=CI("1")=E=DI("1")

Thank you

Re: Multiple Conditions in one Equation

Posted: Wed Jun 12, 2019 12:05 am
by femibode
1. If GAMS allows using multiple mathematical operators in an equation, yes but if not, no.

2. This is the general syntax for defining equation in GAMS:

Code: Select all

eqn_name(index_list)[$logical_condition(s)].. expression eqn_type expression; 
3. Do you only need to ensure equality of these multiple entities? And or do you know the value of each of them and are you trying to avoid multiple equations?

Re: Multiple Conditions in one Equation

Posted: Wed Jun 12, 2019 7:31 am
by pelorn
Hey,

It didnĀ“t work the way I tried it with the multiple =E= signs.

And I don't know the value, I try to optimize different paths that diverge, but they need to be equal in the first period.

Thanks

Re: Multiple Conditions in one Equation

Posted: Thu Jun 13, 2019 12:26 am
by femibode
then I would try this:

Code: Select all

 Neweq.. AI("1")$(BI("1") = CI("1") and CI("1") = DI("1") ) =E= BI("1") 

Re: Multiple Conditions in one Equation

Posted: Thu Jun 27, 2019 12:57 pm
by Mollymorgen
Thank you for solution, it worked for me.