need HELP for define Variable boundary

Hi

I have serious problem with defining a variable NOT to be between two number

for example X>2 and X<0.1

How should i write this boundary in GAMS equations?

Thanks for your help in advance!

Azad


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.

So you mean that X can be either in (-inf, 0.1) or (2, inf)?

For starters, the strict inequalities are a problem. See Arne’s response from this post from a few months ago: https://groups.google.com/d/msg/gamsworld/l3Vkkss6cQQ/ofAZR-vMSQMJ

If you can settle for non-strict inequality, like X >= a and X = 0) and when x >= b (because x-a >= 0 and b-x 2 and X<0.1

How should i write this boundary in GAMS equations?

Thanks for your help in advance!

Azad


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.

Thanks for the help dear Trish

I use the advice and define my variable as :

positive variables
usage(n,a,h)

usage.up(n,a,h) = ((E(a)/time(a))+0.2);

loadieq(n,a,h) … (usage(n,a,h)-0.01 )* ((E(a)/time(a))- usage(n,a,h) ) =l= 0 ;



to variable usage be very close to ‘zero’ OR ‘( E(a)/time(a) )’ {are 2 parameter} but the result are wrong :frowning: and all usage are between 0 and 0.01 !!

i know i can use binary variable but i have to use NLP solver.

any new advice or solution??


tanks you in advance









On Friday, November 14, 2014 11:56:12 PM UTC+3:30, Trish Gillett wrote:

So you mean that X can be either in (-inf, 0.1) or (2, inf)?

For starters, the strict inequalities are a problem. See Arne’s response from this post from a few months ago: https://groups.google.com/d/msg/gamsworld/l3Vkkss6cQQ/ofAZR-vMSQMJ

If you can settle for non-strict inequality, like X >= a and X = 0) and when x >= b (because x-a >= 0 and b-x 2 and X<0.1

How should i write this boundary in GAMS equations?

Thanks for your help in advance!

Azad


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.

Hi Azad,

I’m not sure I understand you, but here are a few things you can check.

Your constraint
(usage(n,a,h)-0.01 )* ((E(a)/time(a))- usage(n,a,h) ) =l= 0
will be satisfied in two cases:
Case 1: usage(n,a,h) = 0.01 AND usage(n,a,h) >= E(a)/time(a)

Idea #1) Double check that you definitely have E(a)/time(a) >= 0.01 in your problems.

Together with the rest of the code you include, each usage(n,a,h) has two possible ranges: [0, 0.01] and [E(a)/time(a), E(a)/time(a) + 0.2].
The reason this is important is because if you accidentally had E(a)/time(a) = a and X = b" like I described in the rest of the message. It looks like you understood me correctly despite this, thankfully.


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.

Tanks a lot dear Trish

based on your advice i write a new version of my code but it not work very well with solver you mentioned so i attach both version of my code

would you or any other help me about it

which solver i should use ? and is there any problem in my codes?
because as far i know all of three constrains i used are mathematically correct!!

thank you in advance,
your helps mean a lot to me

Azad




On Friday, November 14, 2014 5:45:49 PM UTC+3:30, Azad Mirzaiee wrote:

Hi

I have serious problem with defining a variable NOT to be between two number

for example X>2 and X<0.1

How should i write this boundary in GAMS equations?

Thanks for your help in advance!

Azad


binary4help5.gms (24.1 KB)
NLP4help5.gms (24 KB)