1
我在想如何重写AMPL中的约束。在一个非常简单的例子:重写AMPL中的约束
var x >= 0 ;
var y >= 0;
minimize cost : x^2 + y^4;
subject to constraint1 : x+2*y >= 100;
subject to constraint1 x+2*y <= 10;
---------------------------------
"constraint1 is already defined"
AMPL使用第一个“constraint1”为约束,而忽略第二个,有没有AMPL使用最后一个“constraint1”什么办法?
对第二个约束使用不同的名称 – kindoflost
我不想使用2个约束,我只是想用新的约束覆盖前面的约束。 – Mahraz
如果您有数据并运行文件,那么您可以在数据文件中编写x + 2 * y> = low_lim和x + 2 * y <= up_lim,使low_lim = 100和up_lim = 999999的约束,运行文件使low_lim = 0和up_lim = 10 – kindoflost