0
votes

I have an error in my code in CPLEX which says:

Operator not available for 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];
}

How do I solve this error?

1

1 Answers

0
votes

Your decision variable o is defined to have 3 indices, however, in your constraint you only use two indices.

Also, I think

sum (j in destinations, t in time ) al[i][j][t] * e[j][i][t]-  l[i][j][t-1];

should be written as (note the additional parentheses)

sum (j in destinations, t in time ) (al[i][j][t] * e[j][i][t]-  l[i][j][t-1]);