0
votes

I am begginer in OPL programming and CPLEX. I am working on a optimization project I have a variable named days it has range to 30 and have 2 decision variables assign and rest . I need to do a constraint following 9 days Like:

''' forall(i in crew, j in days, l in locations) assign[i][j][l]+assign[i][(j+1)][l]+assign[i][(j+2)][l]+assign[i][(j+3)][l]+assign[i][(j+4)][l]+assign[i][(j+5)][l]+assign[i][(j+6)][l]+rest[i][(j+7)][l]+rest[i][(j+8)][l] == 9.'''

And I am getting cplex cannot extract expression error. Can somebody help me how can I write the true code for this?

1

1 Answers

0
votes
forall(i in pilots, j in days, l in locations:(j+8) in days)
  (assign[i][j][l]+assign[i][j+1][l]+assign[i][j+2][l]+assign[i][j+3][l]+
  assign[i][j+4][l]+assign[i][j+5][l]+assign[i][j+6][l]+rest[i][j+7][l]+rest[i][j+8][l] == 9);