Hi Arne,

Thanks again for your complete answer. The solution that you have given me works perfectly. Of course I was thinking about getting a GAMS with license. IÂ´m researching in the university and they told me that they have bought some licenses for one of the computing centers. Anyway, since my model is little I decided to use the free demo. I think itÂ´s a really powerful tool.

Regards,

GermÃ¡n.

2009/5/28 Arne Stolbjerg Drud

## German:

The answer is a little technical:

You are probably using the solver DICOPT to solve the MINLP model. If you look at the documentation / theoretical background for DICOPT you will see that it solves a sequence of NLP and MIP models. The NLP models are the same size as the model GAMS generates with only bounds on the integer variables changing from instance to instance. The MIP model includes the linear part of your model plus linearizations of the nonlinear part from a growing number of points plus some logical components to tie it all together. The MIP model can therefore become considerably larger than your original model and this is what happens here. I realize that the error message can be hard to interpret – I cannot promise that it will be improved because it only happens to users who have a demo license, i.e. it never happens to a real GAMS client.

Next step: you should consider getting a real GAMS license.

Alternative: Use the MINLP solver SBB. Add the line “Option MINLP=SBB;” before the solve statement. SBB does not increase the size of the model so it should work within the demo limit. (In your particular case it is even faster!)

Regards

Arne

\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne af GermÃ¡n BenÃtez

Sendt: 27. maj 2009 11:09

Til: gamsworld@googlegroups.com

Emne: Re: the function SQRT is called with non-constant arguments

Hi Arne,

Could you help me with my (I hope) last problem? GAMS says:

*** No license found

*** To update your license, please contact your distributor.

*** Too many variables for demo mode

*** Number of variables : 307

*** Maximum allowed : 300

The point is that IÂ´m nearly sure that IÂ´m not working with so many variables. In fact some lines below you can read:

MODEL STATISTICS

BLOCKS OF EQUATIONS 4 SINGLE EQUATIONS 103

BLOCKS OF VARIABLES 9 SINGLE VARIABLES 108 1 projected

NON ZERO ELEMENTS 410 NON LINEAR N-Z 303

DERIVATIVE POOL 11 CONSTANT POOL 174

CODE LENGTH 3,571 DISCRETE VARIABLES 3

Regards,

GermÃ¡n.

El 26 de mayo de 2009 19:40, GermÃ¡n BenÃtez escribiÃ³:

Hi Arne…

I had a confusion with sqr and sqrt and I didnÂ´t understand what you meant about replacing **2 terms. You are right, with these changes the algorithm converge.

I will tell you my next steps.

Thanks for your help and regards,

GermÃ¡n.

## 2009/5/26 Arne Stolbjerg Drud

GermÃ¡n:

You should replace V(K)**2 by sqr(V(K)) and similarly for the other ‘**2’ terms.

Arne

\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne af GermÃ¡n BenÃtez

Sendt: 25. maj 2009 19:10

Til: gamsworld@googlegroups.com

Emne: Re: the function SQRT is called with non-constant arguments

Hi Arne…

The equations that I have shown belong to the non linear model, althoght they are linear. This is the point… I donÂ´t know why I get this message in a linear equation. I suppose that this error is releated with the rest of the model. The linear and non-linear constraints for linear and non linear models are respectively Vi(1) and Vi(2)…

Vi1(I)… V(I) =e= sum(K$L(K,I),V(K)-(Rh(K,I)*fij(K,I)

- Xh(K,I)*qij(K,I)))(ord(I) gt 1)+ Xnet(I,'oltcref')(ord(I) eq 1);

Vi2(I)… V(I) =e= sqrt(sum(K$L(K,I),V(K)**2+2*(Rh(K,I)*fij(K,I)

- Xh(K,I)
*qij(K,I))-(fij(K,I)**2+qij(K,I)**2)*(Rh(K,I)**2

+Xh(K,I)**2)/V(K)**2))(ord(I) gt 1) + Xnet(I,'oltcref')(ord(I) eq 1);

The value inside sqrt should be always bigger than 0, because the non linear term is really little releated with the rest.

During the execution flow I donÂ´t see the sqrt operation, perhaps GAMS discard sqrt operation after the error…

---- Vi2 =E=

Vi2(1)… V(1) =E= 1.03 ; (LHS = 1.03)

Vi2(2)… - (0.00197093483009281)*fij(1,2) - (0.000868589759984563)*qij(1,2)

- (0.999781928193272)*V(1) + V(2) =E= 0 ;

(LHS = -0.000456262249454165, INFES = 0.000456262249454165 ****)

Vi2(3)… - (0.00132204949720727)*fij(2,3) - (0.000582698788932692)*qij(2,3)

- (0.999853670962972)*V(2) + V(3) =E= 0 ;

(LHS = -0.000305988855276773, INFES = 0.000305988855276773 ****)

Regards,

GermÃ¡n.

2009/5/25 Arne Stolbjerg Drud

## GermÃ¡n:

You have shown the equation listing where the linearized model is listed. We need the actual equation (defined around line 409 and 418).

As the message says, you have an expression, x**y where x is negative. You should know that '**’ in GAMS means a real number to a real-valued power. If the exponent, y, is 2 then you should replace x**2 by sqr(x) and if y is another integer, use power(x,y) that defines a real value to an integer power. If y is not an integer them you will need to restrict x to be non-negative since a negative number to a non-integer power is mathematically undefined (not a GAMS issue, but hard math).

Regards

Arne

\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne af GermÃ¡n BenÃtez

Sendt: 25. maj 2009 14:23

Til: gamsworld@googlegroups.com

Emne: Re: the function SQRT is called with non-constant arguments

Hi again…

Thanks Arne for your help. It’s being really useful. I have already modelled the linear equations and I obtain good results. Now I have modelled the non linear problem and if run it I obtain *WARNING, because like you told me I have to use the solution of linear problem like initial point in nlp problem.

I have done this, but the next messages are shown…

---- cost =E=

cost… obj - Pgcurt(30) =E= 0 ; (LHS = 0)

**** Exec Error at line 409: rPower: FUNC DOMAIN: x**y, x

## Hi GermÃ¡n

It is a good idea to start linear and simple and then add the nonlinear term. You may even use the result of a linear model as a starting point for a nonlinear model (initial values can be important for nonlinear models).

The problem with UNDF is probably, that although SQRT(0) is well defined as 0, the derivative at zero is undefined. You may add a small positive number (like 1.e-8 or 1.e-10) inside the SQRT. The value at zero will then be 1.e-4 or 1.e-5 and the derivative will be finite at around 1.e+4 or 1.e+5.

Regards

Arne

\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne af GermÃ¡n BenÃtez

Sendt: 19. maj 2009 12:11

Til: gamsworld@googlegroups.com

Emne: Re: the function SQRT is called with non-constant arguments

Hi Arne,

Thanks for your response. MINLP works, but I obtain UNDF errors. IÂ´m new in GAMS so IÂ´m going to reduce the constraints to linear equations to begin to solve

little errors and after that try to complete the problem. What do you think?

Best regards.

GermÃ¡n.

2009/5/18 Arne Stolbjerg Drud

Hi GermÃ¡n

Your model is nonlinear and the constraints in MIP models must be linear.

You will probably have to use model type MINLP. If you can change the

constraint to a quadratic constraint then you can use additional model types

with better specialized algorithms.

Good luck

Arne

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk

-----Oprindelig meddelelse-----

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne

af fcogerman

Sendt: 18. maj 2009 13:02

Til: gamsworld

Emne: the function SQRT is called with non-constant arguments

Hello all,

IÂ´m solving an optimal power flow problem with MIP algorith and I get

the next message…

51 equation Vi … the function SQRT is called with non-constant

arguments

Vi is defined like this…

Vi(I)… V(I) =e= sqrt(sum(K$L(K,I),V(K)**2-2*(Rh(K,I)*fij(K,I)

- Xh(K,I)
*qij(K,I))+(fij(K,I)**2+qij(K,I)**2)*(Rh(K,I)**2

+Xh(K,I)**2)/V(K)**2))(ord(I) gt 1) + Xnet(I,'oltcref')(ord(I) eq

- ;

I would thanks some help.

Best regards.

GermÃ¡n BenÃtez.

–~–~---------~–~----~------------~-------~–~----~

To post to this group, send email to gamsworld@googlegroups.com

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en

-~----------~----~----~----~------~----~------~–~—