Originally posted by: GGR
Hi Mahmoud
To model the modes in sched_rcpspmm., an alternative constraint tells that a task[t] interval variable is an alternative among itsmodes[m] interval variables.
alternative(task[t], all(m in Modes: m.taskId==t.id) mode[m]);
An optional internal variable it allow to tell a constraint presenceOf(it) that is true if and only if the interval variable is present.
Then you can use this constraint as a Integer [0,1] expression to post constraint. For an unrealistic example, the pondered by task, sum of the mode selection must be less than a constant c
sum (t in tasks) t.taskId*presenceOf(mode(<t.task.id, 0>)) <= c;
You can have a look on
https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.cpo.help/refcppcpoptimizer/html/interval_variables.html
https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_presenceOf.html
https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.ide.help/OPL_Studio/opllangref/topics/opl_langref_scheduling_logical.html
Hope that helps
#DecisionOptimization#OPLusingCPOptimizer