将 AMPL 转换为 CPLEX
Convert AMPL to CPLEX
以下约束是在 AMPL 环境中编写的,我想将其转换为 CPLEX?
subject to ex_one{b in B}: sum{t in T: t >= early[b]} y[b,t] <= 1;
#subject to most_one{tt in T, b not in BT[tt]}: sum{t in T} y[b,t] <= 1;
subject to grade1{t in T}: G_min*sum{b in B: early[b] <= t}(if g[b] > total[b] then
total[b] else 0)*y[b,t] <= sum{b in B: early[b] <=t}(if g[b] > total[b] then g[b] else
0)*y[b,t];
range B=1..4;
range T=1..3;
{int} BT[t in T]=asSet(1..t);
int early[b in B]=b;
dvar boolean y[B][T];
subject to
{
forall(b in B)ex_one: sum(t in T: t >= early[b]) y[b,t] <= 1;
forall(tt in T, b in B:b not in BT[tt]) mostone: sum(t in T) y[b,t] <= 1;
}
在 OPL CPLEX 中工作正常
以下约束是在 AMPL 环境中编写的,我想将其转换为 CPLEX?
subject to ex_one{b in B}: sum{t in T: t >= early[b]} y[b,t] <= 1;
#subject to most_one{tt in T, b not in BT[tt]}: sum{t in T} y[b,t] <= 1;
subject to grade1{t in T}: G_min*sum{b in B: early[b] <= t}(if g[b] > total[b] then
total[b] else 0)*y[b,t] <= sum{b in B: early[b] <=t}(if g[b] > total[b] then g[b] else
0)*y[b,t];
range B=1..4;
range T=1..3;
{int} BT[t in T]=asSet(1..t);
int early[b in B]=b;
dvar boolean y[B][T];
subject to
{
forall(b in B)ex_one: sum(t in T: t >= early[b]) y[b,t] <= 1;
forall(tt in T, b in B:b not in BT[tt]) mostone: sum(t in T) y[b,t] <= 1;
}
在 OPL CPLEX 中工作正常