就是说变量名不存在

时间:2019-01-24 19:32:00

标签: cplex ibm-ilog-opl

决策变量

dvar float+ Inside[Products][Periods][Cites];
dvar float+ Outside[Products][Periods][Cites];

最小化功能:

minimize
sum(p in Products, t in Periods, c in Cites)
(InsideCost[p]*Inside[p][t][c] + 
OutsideCost[p]*Outside[p][t][c]+
TransportCostInside[c]*Inside[p][t][c] + 
TransportCostOutside[c]*Outside[p][t][c]);

边框功能

subject to{
forall(r in Resources, t in Periods)    
//ctCapacity:
sum(p in Products, c in Cites)
  Consumption[r][p] * Inside[p][t][c] <= Capacity[r];

forall(p in Products, c in Cites)    
//ctDemand:
sum(T in Periods)
    Inside[p][T][c] + Outside[p][T][c]  == Demands[p][c];
    (Here it is saying with variable Outside that T doesen't exist)
}

我不知道为什么会有这个问题,变量里面没有显示任何问题?

1 个答案:

答案 0 :(得分:-1)

您应该使用括号

forall(p in Products, c in Cites)    
//ctDemand:
sum(T in Periods)
    (Inside[p][T][c] + Outside[p][T][c])  == Demands[p][c];