Conditional expressions with variables

Hello,

I’m a beginner in Gams and linear optimization and I have some problems with conditional expressions. I have two cases in two different GamsModels that cause a problem. Both involve variables so that I can’t use the $-assignment if I have understood right.But what can I use instead?

Problem in first Model:

I have got a variable s,
that is 0 if 07 (where x is a variable not a parameter),
it is 25 if 767,
it is 89 if x>67

I first thought I could use a set in some way to solve this problem but the problem is: I have another set named setp and for some elements of setp it is not possible that x will be for example less than 7 and that causes errors I think.

Problem in second model:

I have got a variable s, that is 2x+5 if 05 (where x is a variable) and 6x+34 if 5=25. And I have again another set setp and for some elements of setp it will not be possible that x is for example >=25.

Thanks in advance
Kachtanna


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Dear Kachtanna,

I recommend you to take a look into Chapter 7 of the attached document, as it may help you to solve your problem.



Cheers,
Pedro




On Mon, Oct 19, 2015 at 9:34 AM, Kachtanna wrote:

Hello,

I’m a beginner in Gams and linear optimization and I have some problems with conditional expressions. I have two cases in two different GamsModels that cause a problem. Both involve variables so that I can’t use the $-assignment if I have understood right.But what can I use instead?

Problem in first Model:

I have got a variable s,
that is 0 if 07 (where x is a variable not a parameter),
it is 25 if 767,
it is 89 if x>67

I first thought I could use a set in some way to solve this problem but the problem is: I have another set named setp and for some elements of setp it is not possible that x will be for example less than 7 and that causes errors I think.

Problem in second model:

I have got a variable s, that is 2x+5 if 05 (where x is a variable) and 6x+34 if 5=25. And I have again another set setp and for some elements of setp it will not be possible that x is for example >=25.

Thanks in advance
Kachtanna


AIMMS_modeling.pdf (1.88 MB)

Dear PowerChile,

thank you for your answer, I will take a look…

Regards
Kachtanna


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.