I am trying to write an optimization model related to the resource-constrained project schedule based on

*Pritsker et al.*formulation. The model is as follows: When I have defined the objective function as shown in the model, the final solution is incorrect but, when I write it in the following form, it seems to work fine.

The first attempt:

Code: Select all

`z =e= sum(t,(ord(t))*x("end",t));`

Code: Select all

`z =e= sum(t,(ord(t)-1)*x("end",t));`

The first attempt:

Code: Select all

`sum((i,tt)$(ord(tt)> (max(0,(ord(t))-p(i)+1)) and ord(tt)< ord(t)+1), d(i,r)*x(i,tt)) =l= cap(r);`

Code: Select all

`sum((i,tt)$(ord(tt)> (max(0,(ord(t)-1)-p(i)+1)) and ord(tt)< ord(t)+1), d(i,r)*x(i,tt)) =l= cap(r);`

- Why we will have to define the set index (t) from (t-1)?

- In the second constraint to loop over (t2), why we will need to use (</>) in contrast to (<=/>=)? (In the second form, the solution is incorrect.).

Thanks in advance

Abbas