Originally posted by: GGR
Hi
Two part in the answer
1) The model you have written is a simple case of open shop where all operation have the same size, independent of the machine, let's say that is not the case.
// j jobs of m operations, one per machine (implicitly m machines)
// declarations of all the operations: one intervals variable per jobs and per machines dvar interval X[a in 1..j][b in 1..m] in r[a]..d[a] size p[a];
Each machine is disjunctive (aka unary machine). That is you model it with a noOverlap constraint on the sequence defined by the set of interval variable (the operations) executed on the machine.
That is the purpose of the following code elements:
// declaration of the m machine as m sequence dvar sequence machines[b in 1..m] in all(a in 1..j) X[a][b]; subject to
{
// constraint: disjunctive resource forall(b in 1..m) noOverlap(machines[b]);
}
Now we have to organize the jobs: a job is a succession of operations you do not know the order of execution. You have to sort the operations of a job such that they cannot be executed at the same time (i.e that are not overlapping). That is the basic usage of a sequence: it constraint to organize in sequence a set of interval variables using a constraint to sort it: the constraint is the noOverlap.
As all the size and the machine are
That is the purpose of the following code elements:
// declaration of the sequence of operation of a job dvar sequence jobs[b in 1..m] in all(a in 1..j) X[a][b]; subject to
{
// constraint: disjunctive resource forall(a in 1..j) noOverlap(jobs[a]);
}
2) It's seem to me you want that the operations of a job are executed on the same machine you do not know. That is completely different. In the previous sample, you decomposed the jobs on the machine, and now you decompose the jobs in k tasks. Each task are executed by one of the machine.
// declarations of all the tasks: one interval variable per jobs and per tasks dvar interval T[a in 1..j][b in 1..k]; / declarations of all the potential operations: one interval variable per (job, task)
's and per machines dvar interval X[a in 1..j][b in 1..k][c in 1..m] optional in r[a]..d[a] size p[a][b];
// declaration of the m machine as m sequence dvar sequence machines[c in 1..m] in all(a in 1..j, b in 1..k) X[a][b][c]; subject to
{
// constraint: disjunctive resource forall(b in 1..m) noOverlap(machines[b]);
}
// the jobs are sequences of tasks dvar sequence jobs[b in 1..m] in all(a in 1..j) T[a][b];
// the tasks subject to
{
// constraint: disjunctive resource forall(a in 1..j) noOverlap(jobs[a]);
// constraint sort of the jobs as no overlaping sequence of tasks forall(a in 1..j) noOverlap(jobs[a]);
// each task is executed by one machine forall(a in 1..j, b in 1..t) alternative(T[a][b], all (c in 1..m) X[a][b][c];
}
Note if you need an interval variable for each jobs in order to add extra constraint or objective term than release date due date, you have to use a span constraint
{code}
dvar interval J
http://a in 1..j;
subject to {
forall(a in 1..j)
span(J[a], all (b in 1..t) T[a][b];
}
Hope that helps
#ConstraintProgramming-General#DecisionOptimization