Trigonometric functions

Problems with syntax of GAMS
Post Reply
f.javier.heredia
User
User
Posts: 3
Joined: 1 month ago

Trigonometric functions

Post by f.javier.heredia » 1 month ago

Hi everybody!!

I have a weird error using "sin" and "cos" functions. For instance, when running the code of the TRIGX,SEQ=388 example (https://www.gams.com/latest/gamslib_ml/ ... trigx.html), the result is

**** MODEL STATUS 5 Locally Infeasible

and the expansion of the constraints:

con1.. x - sin(2*x + 3*y) - cos(3*x - 5*y) =e= 0;
con2.. y - sin(x - 2*y) + cos(x + 3*y) =e= 0;


are

con1.. - (1)*x - (3)*y =E= 0 ; (LHS = -1, INFES = 1 ****)
con2.. - (1)*x + (3)*y =E= 0 ; (LHS = 1, INFES = 1 ****)


quite strange... it seems as if GAMS were evaluating cos and sin at some fixed argument instead of taking the nonlinear functions defined in the expressions.
The the same happens with my own GAMS code using "cos" and "sin" (an OPF model). I'm using a GAMS Community license with the following distribution:

GAMS Distribution 35.2.0
GAMS Release: 35.2.0 r33388c4 WEX-WEI x86 64bit/MS Windows
Release Date: Jun 2, 2021


Any idea...? Thank you!!

Javier

User avatar
bussieck
Moderator
Moderator
Posts: 618
Joined: 4 years ago

Re: Trigonometric functions

Post by bussieck » 1 month ago

Javier, you are looking at the equation listing (https://www.gams.com/latest/docs/UG_GAM ... ionListing) section of the listing file. This indeed evaluates and displays the gradient of a variable in the equation at the input point.

-Michael

f.javier.heredia
User
User
Posts: 3
Joined: 1 month ago

Re: Trigonometric functions

Post by f.javier.heredia » 1 month ago

bussieck wrote:
1 month ago
Javier, you are looking at the equation listing (https://www.gams.com/latest/docs/UG_GAM ... ionListing) section of the listing file. This indeed evaluates and displays the gradient of a variable in the equation at the input point.

-Michael
Ooops!!.... your right, sorry for that silly question... indeed, I don't have too much experience using GAMS with nonlinear models. Nevertheless, example TRIGX,SEQ=388 is reported INFEASIBLE by CONOPT, which I think it shouldn't be... I'll see..

Thank you very much Michael.

Javier.

User avatar
bussieck
Moderator
Moderator
Posts: 618
Joined: 4 years ago

Re: Trigonometric functions

Post by bussieck » 1 month ago

The trigx model has been added when GAMS added LGO. This is a highly non-convex model and hence a local solver like Conopt will produce local minima and will report "locally" infeasible when started from not so good starting points. So this is all expected behavior.

-Michael

f.javier.heredia
User
User
Posts: 3
Joined: 1 month ago

Re: Trigonometric functions

Post by f.javier.heredia » 1 month ago

Thank you again!!

Javier

Post Reply