## How to compute endogenous cost expressions in GAMs

Problems with modeling
lixlz51
User Posts: 11
Joined: 8 months ago
Location: University of Nottingham, UK

### How to compute endogenous cost expressions in GAMs

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!

Renger
Posts: 263
Joined: 2 years ago

### Re: How to compute endogenous cost expressions in GAMs

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

lixlz51
User Posts: 11
Joined: 8 months ago
Location: University of Nottingham, UK

### Re: How to compute endogenous cost expressions in GAMs

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.

dirkse
Moderator Posts: 47
Joined: 2 years ago
Location: Fairfax, VA

### Re: How to compute endogenous cost expressions in GAMs

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