How to declare variable depends on other variable as a constraint in AMPL?
I'm trying to solve the minimize the difference between "maximum number of variable - minimum number of variable"
So, my objective equation is minimize max{t in 0..T}production[t] + min{t in 0..T}production[t]; (t is index and T is time periods parameter and production is decision variable.)
However, it is not linear algebra. Thus, I'm trying to declare 'max{t in 0..T} production[t]' as a variable 'y'. So, I would like to write 'var y >= all production'. But it's not working.
The constraint
s.t. max_production{t in 0..T}: y >= production[t];
will ensure that y
is greater or equal than production[t]
for all t in 0..T
. If you minimize y
then it will be exactly max{t in 0..T} production[t]
.