# How to model a cumulative resource constraint with same family condition?

Assume that we have 3 tasks to schedule : $$x_{a1}, x_{a2}, x_{b3}$$. They all use the same cumulative resource : $$r_1$$. Each activity increases $$r_1$$ by $$1$$ at it starts time and decreases $$r_1$$ by $$1$$ at it's end time. $$r_1$$ has a maximum capacity of $$1$$. Where things get complicated is that $$x_{a1}$$ and $$x_{a2}$$ can be executed at the same time and only consume $$1$$ resource of $$r_1$$. So in this example, $$x_{a1}$$ and $$x_{a2}$$ can be executed at the same time while $$x_{b3}$$ must be executed before of after both $$x_{a1}$$ and $$x_{a2}$$ are executed. Basically, tasks from the same family only consume $$1$$ resource even if multiple tasks from this family are overlapping.

Note that the maximum capacity of the ressource could be $$>1$$

With CPOptimizer I know how to use cumulFunction() but I don't know how I could implement the fact that multiple activites can be scheduled simultaneously while only consuming one resource.

• Do you mean to say each activity decreases the resource (consumes it) at start and increases it (returns it) at end? Nov 18 '21 at 20:18