Are you trying to specify a piecewise-linear function of variable firstA? There's an AMPL piecewise-linear notation that may help; see Chapter 17 of the AMPL book,
http://ampl.com/BOOK/CHAPTERS/20-piecewise.pdf.
Bob Fourer
am...@googlegroups.com
=======
From:
am...@googlegroups.com [mailto:
am...@googlegroups.com] On Behalf Of
czarek...@gmail.com
Sent: Saturday, April 22, 2017 7:40 PM
To: AMPL Modeling Language
Subject: [AMPL 13918] Not "constant" objective function
I would like to solve a task about minimizing cost of storing products. A part of objective function (which I minimize) looks as follows:
minimize f_celu: [....] 3.0*0.1*productionCostA[1]*100 + 3.0*0.15*productionCostA[1]*(firstA - 100) [....]
( productionCostA[1] = 54.97,
firstA is a production size - integer var )
The first summand is the cost of production of first 100 products and the second summand is the cost of production of the rest products.
But what when production will be less than 100?
I would like not to use something like that:
minimize f_celu: if firstA >= 100 then .... else ...
beacuse there are plenty of condtions.
Is there a better option to reach that?