I am trying to add few more constraint with existing resource constraint project scheduling problem available OPL examples. Here I am attaching the example files of RCPSP problem. At present in this example problem I can start as many tasks as possible based on resource capacity. I want to add an additional constraint on maximum number of tasks performed in an interval variable should be less than or equal to 5. In other words simultaneously I can't do more than 5 tasks at a time.
The example problem can be located in OPL at examples/opl/sched_rcpsp
You could use cumul function.
Before the subject to block you could write:
cumulFunction nbTasks =
sum(t in Tasks) pulse(itvs[t],1);
And then in the subject to block you simply add:
nbTasks<=5;