Function cp::ActivityBegin(optionalActivity, absentValue)

cp::ActivityBegin

The function cp::ActivityBegin(a,d) returns the begin of activity $$a$$ when it is present or default value $$d$$ when it is absent.

Mathematical Formulation

The function cp::ActivityBegin(a,d) is equivalent to

$\begin{split}\left\{ \begin{array}{ll} a.\texttt{begin} & \textrm{if } a.\texttt{present} \\ d & \textrm{otherwise } \end{array} \right.\end{split}$

This function is typically used in scheduling problems to link activities to other components of the problem.

cp::ActivityBegin(
optionalActivity,   ! (input) an expression
absentValue         ! (input) an expression
)


Arguments

optionalActivity

An expression resulting in an activity. This activity may have the property optional.

absentValue

An expression that results in the value used when activity optionalActivity is absent. The result of this expression is an element in the schedule domain of the activity. This expression cannot involve variables.

Return Value

This function returns an element in the schedule domain of the activity and this element is the begin of an activity when that activity is present or a specified default value when it is not.

Example

In the example below, we require that the beginning of the shift represented by element variable evShift matches the begin of the optional activity myAct.

Constraint linkShiftActivity {
Definition :  cp::ActivityBegin( myAct, first(myCal)) = beginHour(evShift) );
}