if statement with constarints Topic is solved

Problems with syntax of GAMS
Post Reply
garvisgarg
User
User
Posts: 5
Joined: 2 years ago

if statement with constarints

Post by garvisgarg » 2 years ago

hello,
In GAMS model, can I use 'if' statement in any constraint. Please tell me it is possible or not. If yes then please tell me syntax of that.

Thanks

User avatar
Renger
Posts: 378
Joined: 3 years ago

Re: if statement with constarints

Post by Renger » 2 years ago

Hi
You can't use if-constructs in constraints, but you can use the $-operator (see the manual for more information) in your constraints if the condition relates to a parameter (not to a variable):

This works

Code: Select all


parameter
    p(t);
    
variable E(t), A(t), B(t);  
myeq..
    E(t) =E= A(t)$(p(t)>0) + B(t)$(p(t) < 0);

Cheers
Rernger
____________________________________
Enjoy modeling even more: The lazy economist

Rofice
User
User
Posts: 22
Joined: 2 years ago

algorithm error

Post by Rofice » 2 years ago

Hi,
Could anyone tell what this error means, apparently syntax for calling algorithm seems correct and as follow
OPTION MINLP = LMLBOA ;

while error massage is attached in attachment, if more information is required to understand error please let me know.

Regards
Attachments
methanol.PNG

Post Reply