Function cp::LengthOfPrevious(sequentialResource, scheduledActivity, firstValue, absentValue)

# cp::LengthOfPrevious

The function cp::LengthOfPrevious refers to the length of the previous activity in a sequence of activities. A size is an integer in the range $$\{0..card(\texttt{problem schedule domain})-1\}$$. For a resource $$r$$, an activity $$a$$, sizes $$f$$ and $$d$$, the function cp::LengthOfPrevious(r,a,f,d) returns

• $$d$$ if $$a$$ is absent,

• $$f$$ if $$a$$ is present and scheduled as the first activity on $$r$$, and

• $$p\texttt{.length}$$ if $$a$$ is present and not scheduled as the first activity on $$r$$, and $$p$$ is the previous activity of $$a$$ scheduled on $$r$$.

cp::LengthOfPrevious(
sequentialResource,  ! (input) an expression
scheduledActivity,   ! (input) an expression
firstValue,          ! (optional) an expression
absentValue          ! (optional) an expression
)


## Arguments

sequentialResource

An expression that results in a sequential resource.

scheduledActivity

An expression that results in an activity.

firstValue

An optional expression that results in a length. The default value of this expression is 0.

absentValue

An optional expression that results in a length. The default value of this expression is 0.

## Return Value

This function returns a length.