I'm trying to solve a scheduling problem using OPL/CPLEX. In the model, there are nine tasks in which each task has its specific precedence. the precedence relationship is as follows:
[{1}, {1}, {1,2}, {1,2,3}, {4,7}, {6}, {6}, {5}, {8}];
Where, for example, tasks {1,2,3} are the precedence of task four. I have defined two ways to create this relationship. First, by using a nested tuple set:
tuple link{
{int} task;
};
{link} relations[tasks]=
[{<{1}>}, {<{1}>}, {<{1,2}>}, {<{1,2,3}>}, {<{4,7}>}, {<{6}>}, {<{6}>}, {<{5}>}, {<{8}>}];
Second, by nested set:
setof(int) operations[tasks] = [{1}, {1}, {1,2}, {1,2,3}, {4,7}, {6}, {6}, {5}, {8}];
Now, I would like to use this relationship in the following constraint:
\begin{equation}\sum_{h \in H} \sum_{i \in I} i . x_{i h j} \leq \sum_{h \in H} \sum_{i \in I} i . x_{i h t} \forall j, t \in N, j<t\end{equation} Where, ${i \in workstation}$, ${h \in workers}$ and ${j,t \in tasks}$.
The OPL code is:
e4: forall(j,t in tasks: j<t)
sum(h in workers, i in workstation) i*x[i,h,j] <=
sum(h in workers, i in workstation) i*x[i,h,t];
I'm wondering if, which one of these methods can be applied to the constraint and how can I fix this issue?