如何声明变量依赖于其他变量作为AMPL中的约束?

How to declare variable depends on other variable as a constraint in AMPL?

如何在AMPL中声明变量依赖于其他变量作为约束?

我正在尝试解决 "maximum number of variable - minimum number of variable"

之间的差异最小化问题

所以,我的 objective 等式是 最小化 max{t in 0..T}production[t] + min{t in 0..T}production[t]; (t 是指数,T 是时间段参数,production 是决策变量。)

然而,它不是线性代数。 因此,我试图将 'max{t in 0..T} production[t]' 声明为变量 'y'。 所以,我想写'var y >= all production'。 但它不起作用。

约束条件

s.t. max_production{t in 0..T}: y >= production[t];

将确保 y 大于或等于所有 t in 0..Tproduction[t]。如果你最小化 y 那么它将正好是 max{t in 0..T} production[t].