Function cp::ActivitySize(optionalActivity, absentValue)

# cp::ActivitySize

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

## Mathematical Formulation

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

$\begin{split}\left\{ \begin{array}{ll} a.\texttt{size} & \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::ActivitySize(
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. This expression cannot involve variables.

## Return Value

This function returns the size 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 size of the shift represented by element variable evShift matches the size of the optional activity myAct.

Constraint linkShiftActivity {
Definition :  cp::ActivitySize( myAct, 3) =, shiftSize(evShift);
}