Search code examples
constraint-programmingoplcp-optimizer

How to put two elements in the same sequence?


I want to force the flexible job shop example model in CP Optimizer that if a specific mode/element is put in a sequence the successor has to be put also in the same sequence which means in this case that both have to be done on the same machine. How can I create such an subject to condition?? Thank you in advance for your help!!

dvar sequence mchs[m in Mchs] in all(md in Modes: md.mch == m) modes[md]

minimize max(j in Jobs, o in Ops: o.pos==jlast[j]) endOf(ops[o]);
subject to {....}

Solution

  • If op_1 and op_2 denote the two operations that must be allocated to the same machine and if mode_1_i and mode_2_i denote the optional interval variables representing the allocation of op_1 (resp. op_2) on machine i, then all you need to do is posting a constraint: presenceOf(mode_1_i)==presenceOf(mode_2_i).