Multiple Conditions in one Equation

Problems with modeling
Post Reply
pelorn
User
User
Posts: 14
Joined: 6 months ago

Multiple Conditions in one Equation

Post by pelorn » 6 months ago

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

femibode
User
User
Posts: 3
Joined: 6 months ago

Re: Multiple Conditions in one Equation

Post by femibode » 6 months ago

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?

pelorn
User
User
Posts: 14
Joined: 6 months ago

Re: Multiple Conditions in one Equation

Post by pelorn » 6 months ago

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

femibode
User
User
Posts: 3
Joined: 6 months ago

Re: Multiple Conditions in one Equation

Post by femibode » 5 months ago

then I would try this:

Code: Select all

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

Mollymorgen
User
User
Posts: 1
Joined: 5 months ago

Re: Multiple Conditions in one Equation

Post by Mollymorgen » 5 months ago

Thank you for solution, it worked for me.

Post Reply