syntax-error - CPLEX中没有运算符

标签 syntax-error constraints cplex opl

我在CPLEX中的代码中有一个错误:
运算符不适用于dvar int + [] [time] + dexpr float。

int i=...; //set of origins
int j=...; //set of destinations
int t=...;//set of time


//parameters
float al[origins][destinations][time]=...;//Proportion of all utilized vehicles that are dispatched

//variables
dvar int+ o[origins][destinations][time];//numbers of vehicles present at i at beginning of t
dvar int+ l[origins][destinations][time];//numbers of rented vehicles dispatched from i to  j during t
dvar int+ e[origins][destinations][time];//numbers of unutilized vehicles dispatched from  i to j during t

subject to{
constraint:
    forall(i in origins, t in time:(t-1) in time) 
     o[i][t]== o[i][t-1]+ sum (j in destinations, t in time ) al[i][j][t] * e[j][i][t]-  l[i][j][t-1];
}

我该如何解决这个错误?

最佳答案

您的决策变量o定义为具有3个索引,但是,在约束中,您仅使用两个索引。
另外,我认为

sum (j in destinations, t in time ) al[i][j][t] * e[j][i][t]-  l[i][j][t-1];
应写为(请注意附加括号)
sum (j in destinations, t in time ) (al[i][j][t] * e[j][i][t]-  l[i][j][t-1]);

关于syntax-error - CPLEX中没有运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62745501/

相关文章:

syntax - 此Assign语句中的语法有什么问题?

iOS 更新 TableViewCell 约束

ios - 如何让 CAShapeLayer 快速处理约束?

sql - 如何在我的SQL Case Statement中添加URL?

r - As 公式中的意外符号,无法找到

c++ - 在 CPLEX (c++) 中使用 IloRange 定义约束时出错

java - 在cplex中输出二维变量数组

python - 添加约束 CPLEX Python API

MySQL 存储过程语法错误

Magento 订单保存错误 : Integrity constraint violation