Manjot
Manjot

Reputation: 9

Index out of bound error in CPLEX OPL

forall(j in J, c in C, p in P)   
sum(i in I)X[i][j][c][p]+sum(r in R)F[r][j][c][p-1]+r1[c]*sum(m in 
M)A[m][j][p-1]-r1[c]*sum(k in K)Y[j][k][p]==0;

In the above constraint, I am getting errors:

Index out of bound for array "A(1)(1)": 0"and "OPL cannot extract expression: A[m][j][p+(-1)]

Upvotes: 0

Views: 1425

Answers (1)

Alex Fleischer
Alex Fleischer

Reputation: 10062

Can you at least try to replace this:

forall(j in J, c in C, p in P) 

with the following?

forall(j in J, c in C, p in P: (p-1) in P) 

Upvotes: 0

Related Questions