AMPL新手,在以下型号中选择“>>>>&gt ;;<<<<<<<<”作为问题:
set Types;
param demand {Types};
set Machines;
param prod_cost {Machines, Types};
param days_reqd {Machines, Types};
param days_avail {Machines};
var x {Machines, Types} >=0; # amount produced
minimize total_cost: sum {m in Machines, t in Types} prod_cost[m,t] * x[m,t] ;
subject to machine_capacity: sum {m in Machines, t in Types} x[m,t] * days_reqd[m,t] <= days_avail[m] ;
subject to satisfy_demand: sum {m in Machines, t in Types} x[m,t] >= demand ;
答案 0 :(得分:0)
demand
参数在集合Types
上建立索引,因此需要下标,例如
subject to satisfy_demand{t in Types}:
sum {m in Machines} x[m,t] >= demand[t] ;