Error 141 and Error 143 in optimization for devices' capacity

Problems with modeling
Post Reply
piglet
User
User
Posts: 4
Joined: 5 years ago

Error 141 and Error 143 in optimization for devices' capacity

Post by piglet »

Hello all,
I am doing optimization for devices' capacity in order to minimum the cost under the circumstance that every node's voltage is maintained in an acceptable level. The mathematical expression of the model ,the code and the log are attached.
Error 141 and 143 are alarmed repeatedly.
So,please tell me what should I do.
Thanks in advance for your help.
Attachments
log.txt
(10 KiB) Downloaded 194 times
code.gms
(2.06 KiB) Downloaded 181 times
mathematical expression.png
User avatar
bussieck
Moderator
Moderator
Posts: 1037
Joined: 7 years ago

Re: Error 141 and Error 143 in optimization for devices' capacity

Post by bussieck »

You can't write constraints like this in GAMS:

Code: Select all

if((ud11=0)and(ud12=0)and(ud13=0),
ud1.fx=1;
else
ud1.fx=0;);
GAMS requires your to rewrite your constraint without if, and and else. While there are systems that automatically rewrite this for you they often do a poor job. Often you can reuse subexpressions and so forth to get a tighter formulation. I suggest you read up on modeling with logical constraints e.g. in the book Model Building in Mathematical Programming by HP Williams (https://books.google.de/books?id=Cd1HiA--dBcC). I believe OPL from IBM does this automatic reformulation if you don't want to bother learning the reformulation methods.

-Michael
piglet
User
User
Posts: 4
Joined: 5 years ago

Re: Error 141 and Error 143 in optimization for devices' capacity

Post by piglet »

bussieck wrote: 5 years ago You can't write constraints like this in GAMS:

Code: Select all

if((ud11=0)and(ud12=0)and(ud13=0),
ud1.fx=1;
else
ud1.fx=0;);
GAMS requires your to rewrite your constraint without if, and and else. While there are systems that automatically rewrite this for you they often do a poor job. Often you can reuse subexpressions and so forth to get a tighter formulation. I suggest you read up on modeling with logical constraints e.g. in the book Model Building in Mathematical Programming by HP Williams (https://books.google.de/books?id=Cd1HiA--dBcC). I believe OPL from IBM does this automatic reformulation if you don't want to bother learning the reformulation methods.

-Michael
Thank you for your prompt reply. In the book Nonlinear Optimization Applications Using the GAMS Technology by Neculai Andrei, the IF statement can be used to control the execution of statements.Since I want to describe a piecewise function, how should I revise my code?
User avatar
bussieck
Moderator
Moderator
Posts: 1037
Joined: 7 years ago

Re: Error 141 and Error 143 in optimization for devices' capacity

Post by bussieck »

Again, HP Williams is a good source for piecewise linear approximations and how to model them. There are a couple of example in the GAMS Model Library, e.g. https://www.gams.com/latest/gamslib_ml/ ... nspwl.html.

-Michael
Post Reply