How to compute endogenous cost expressions in GAMs

Problems with modeling
Post Reply
lixlz51
User
User
Posts: 11
Joined: 5 years ago
Location: University of Nottingham, UK

How to compute endogenous cost expressions in GAMs

Post by lixlz51 »

Capture.PNG
Hi everyone,

I saw some papers using GAMs to optimize a MINLP model(attached the obj for your consideration in the example of Liu et al (2010)). For the inventory holding cost, the computation is very complex involving calculus, normal distribution and then square root with decision variables. how do you write those expressions in GAMS?

in the last term of the objective function TC, the square root value depends on decision variable Yij as well. how to compute those? Also, for the value of R(Z), how to write it in GAMs?

Thank you very much for your help!
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: How to compute endogenous cost expressions in GAMs

Post by Renger »

Hi
As in most modeling and programming languages there is a way to write the square root. In Gams there is an explicit function SQRT(x) or you can use x**0.5.

Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
lixlz51
User
User
Posts: 11
Joined: 5 years ago
Location: University of Nottingham, UK

Re: How to compute endogenous cost expressions in GAMs

Post by lixlz51 »

Hi Renger,
Thank you very much for your reply.
Is there any math function to calculate the calculus expression I posted before? What I did was to compute the calculus and reverse function of the standard normal distribution in Mathematica before I put all those values are known scalar in GAMs. It would be ideal to write all in the GAMs file.
User avatar
dirkse
Moderator
Moderator
Posts: 214
Joined: 7 years ago
Location: Fairfax, VA

Re: How to compute endogenous cost expressions in GAMs

Post by dirkse »

Hi,

GAMS ships with stolib, an extrinsic function library full of functions relevant to probability and statistics. For example, the CDF and inverse-CDF functions for many distributions (including the normal distribution) are contained in this library. Details and examples are in the docs:

https://www.gams.com/latest/docs/UG_Ext ... tions.html
https://www.gams.com/latest/docs/UG_Ext ... rch=stolib

That should allow you to use the inverse CDF with endogenous arguments.

-Steve
Post Reply