Alternative for max Funktion

Problems with modeling
Post Reply
schroesa1
User
User
Posts: 1
Joined: 5 years ago

Alternative for max Funktion

Post by schroesa1 »

Dear Community,

i have following problem:

I work at a topic similiar to the newsvendor model.
I need to find the optimal quantity q that maximizes the profit. In my equation for the profit is a term f, the quantity f is the number of units that could theoretically be sold, but coulnd't in the end, because the demand is higher than the supply.
f = d(s) - q, where d is the demand and q the selected quantity. For the case that q is larger than d, f should simply be zero.
f = max(0, d(s)-q)

The parameter s is for a szenario. I have to generate a given number of random demands d(s).

I have to do this for university, but i have to solve the problem as lp, so i can't use the max funktion.
I declared f as positive variable and i am using the equation f = d(s) - q. But that results in q being the lowest random generatet d(s).
Is there a equation for f, that does the following thing (other than the max function):

If d(s) > q, then f should be d(s) - q,
else f should be zero and should have no influence on q.

f =e= d(s) - q just works as a restriction and not like i want it to.

I hope you can understand my problem. Thanks for any help
Fred
Posts: 372
Joined: 7 years ago

Re: Alternative for max Funktion

Post by Fred »

Schroesa1,

In the GAMS model lbrary, there is a model called nbsimple (https://www.gams.com/latest/emplib_ml/l ... h=nbsimple) that implements a simple version of the newsvendor (aka newsboy) problem with the help of the EMP Framework (https://www.gams.com/latest/docs/UG_EMP_SP.html).

Maybe that is of interest to you.

To get better help for your own modeling approach, it would probably be good if you could share your code. I find it difficult to understand how exactly you tried to model the newsvendor problem.

Cheers,
Fred
Post Reply