Function cp::SequentialSchedule(jobBinding, jobBegin, jobDuration, jobEnd)

# cp::SequentialSchedule

The function cp::SequentialSchedule(j,s_j,d_j,e_j) models a resource that can handle only one job at a time. A job $$j$$ is scheduled from start time $$s_j$$ until, but not including, end time $$e_j$$ and over a number of periods $$d_j$$. This function returns 1 if the jobs are scheduled such that no two jobs overlap.

## Mathematical Formulation

cp::SequentialSchedule(j,s_j,d_j,e_j) is equivalent to

$\begin{split}\begin{array}{l} \forall i,j,i \neq j: (s_i+d_i\leq s_j) \vee (s_j + d_j \leq s_i) \\ \forall j: s_j + d_j = e_j \end{array}\end{split}$

## Function Prototype

cp::SequentialSchedule(
jobBinding,  ! (input) an index binding
jobBegin,    ! (input) an expression
jobDuration, ! (input) an expression
jobEnd       ! (input) an expression
)

## Arguments

jobBinding

An index binding that specifies and possibly limits the scope of indices. This argument follows the syntax of the index binding argument of iterative operators.

jobBegin

An expression that involves variables. The result is a vector with an element for each possible value of the indices in jobBinding.

jobDuration

An expression that may involve variables. The result of this expression is an integer non-negative value. The result is a vector with an element for each possible value of the indices in jobBinding.

jobEnd

An expression that involves variables. This expression has the same data type as jobBegin. The result is a vector with an element for each possible value of the indices in jobBinding.

## Return Value

This function returns 1 if the jobs can be scheduled such that no two jobs overlap. If the index binding argument job is empty, this function will return 1. Otherwise it returns 0.

Note

• The arguments to this function involve discrete AIMMS variables and AIMMS parameters, not AIMMS activities.

• This and similar constraints are also known in the Constraint Programming literature as unary or disjunctive constraints.

## Example

The following example models the intuitive idea that with an increase in the size of a task also the time window in which that task is to be executed increases.

Definition   :  10;
}
Parameter smallestWidth {
Definition   :  4;
}
Index        :  t;
}
Parameter release {
IndexDomain  :  (t);
Definition   :  Ord(t);
}
IndexDomain  :  (t);
}
Parameter processingTime {
IndexDomain  :  (t);
}
Variable startTime {
IndexDomain  :  (t);
Range        :  {
}
}
Variable endTime {
IndexDomain  :  (t);
Range        :  {
}
}
Constraint UnaryResource {
Definition   : {
cp::SequentialSchedule(t, startTime(t),
processingTime(t), endTime(t))
}
}

This leads to the following results (extracted from the listing file):

name                    lower    level    upper