1

I want to model a constraint where I want to say if a mode mode1 is scheduled on a sequence before another mode mode2 then a mode mode3 on a parallel working machine (so in an other sequence) cannot be started before the end of mode1 in an other sequence. So more or less I want to code an if (before...) block for that. How does it work correctly?

forall(m1 in Modes, m2 in Modes, m3 in Modes: 
       m1.opId==1 && m2.opId==2 && 
       m3.opId==3 && m1.mch==m2.mch==1) {
    if (before(mchs[1], modes[m1], modes[m3]) == 1) {
        endBeforeStart(modes[m1],modes[m2);
    }
;}
Alex
  • 71
  • 6
  • Hi, have you tried sameSequence ? https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.9.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_sameSequence.html – Alex Fleischer Apr 23 '19 at 16:22
  • Hello Alex, in my case I want to start another mode (m2) in an other sequence for example mchs[2] after mchs [1] in sequnence mchs [1] is finished. Does this work with the sameSequence?? – Alex Apr 23 '19 at 19:48

1 Answers1

1

Of course, you could post a constraint like (H is a large number):

(endOf(mode1,H) <= startOf(mode2,-H)) => (endOf(mode1,-H) <= startOf(mode3,H))

Explanation:

  • if mode1, mode2 and mode3 are all present, the constraint is: (endOf(mode1) <= startOf(mode2)) => (endOf(mode1) <= startOf(mode3))
  • if mode1 or mode2 is absent, because of the constants H, the left side of the implication is false, so it does not constrain mode3
  • if mode1 or mode3 is absent, the right side of the implication is true, so it does not constrain mode2

Now, if you have many triplets (mode1,mode2,mode3) on which this constraint holds, it will be very useful to consider a more global formulation that also exploits other constraints of the problem: what do mode2 and mode3 have in common so that if mode2 is executed after mode1 then mode3 also needs to be executed after? Is there some other temporal dependency between mode2 and mode3? Are there some logical constraints underneath (like presenceOf(mode1)==presenceOf(mode2)) ? etc.

In fact, the definition of the problem is still not clear to me. Let me summarize my understanding :

  • each job i consists of two activities: ‘prep_i’ followed by ‘op_i’
  • both ‘preparation’ and ‘operation’ activities must be allocated to some machines (a machine can only perform one activity at a time)
  • it is possible that the ‘preparation’ and ‘operation’ of a given job are performed on the same machine, but it is not required

Now what is still not clear:

  • it seems that, for a given machine M, if we denote ‘op_i1’ -> ’op_i2’ -> ‘op_i3’ … the sequence of operation on the machine, then the corresponding preparation activities ‘prep_i1’, ‘prep_i2’, ‘prep_i3’, … must also be ordered in the same way (even if they are not necessarily executed on the same machine). Is it true? And also could it be that you additionally want the ordering: ‘prep_i1’ -> ‘op_i1’-> ‘prep_i2’ -> ‘op_i2’ -> ‘prep_i3’ -> ‘op_i3’ … ?
  • if not, and if the problem is only that the preparation activities ‘prep_i’ additionally require some additional resources available in a limited number, why don’t you just model these additional resources using a cumul function (or other noOverlap if you need also to handle the allocation of these resources) to limit the number of preparation activities that can be executed in parallel ?
  • So in my case every Job consists out of 2 modes (m1=prepereation and m2=operation itself). The preperation can be done on the machine (1) itsellf or on an other machine machine (2). So I want to froce the model that the preperation of the next job (j2) can not be started on a the parallel machine (2) as long as the operation mode2 of job1 is not finished. Lets say this is because you have only a limited number of saff however but with the folowing code it does not work. So it is compiled but not done. Where is my mistake? – Alex Apr 24 '19 at 09:54
  • forall(m1 in Modes, m2 in Modes, m3 in Modes: m1.opId==2 && m2.opId==3 && m3.opId==4 &&m1.mch==m2.mch &&m1.mch==1 && m2.mch==2) { (endOf(modes[m1])<=startOf(modes[m3]))=>(endOf(modes[m1]) <=startOf(modes[m2])); } – Alex Apr 24 '19 at 09:56