Hi,I will create a scheduling model. I have some interval variables represent the container ship unloading tasks.The chain of intervals is nonoverlap and between adjacent tasks need transition time.I want to decide the order of the tasks.Could you tell me how to express the adjacent tasks in OPL so that I can constrain them ? Could you give me a example?
Sorry for my english and hope you can understand me.
Thanks in advance.
Topic
NOTICE: developerWorks Community will be offline May 2930, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
6 replies
Latest Post
 20120918T16:48:29Z by GGR
ACCEPTED ANSWER
Pinned topic How to express adjacent intervals in OPL
20120917T14:14:39Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.
Updated on 20120918T16:48:29Z at 20120918T16:48:29Z by GGR

ACCEPTED ANSWER
Re: How to express adjacent intervals in OPL
20120917T15:01:55Z in response to SystemAdminHi
have you tried endBeforeStart ?
The following precedence constraint states that the end of interval c plus 5 time units is less than or equal to the start of interval d.
endBeforeStart(c,d,5);
regards
ACCEPTED ANSWER
Re: How to express adjacent intervals in OPL
20120917T15:54:44Z in response to AlexFleischerThanks for your answer.
But, how to determine interval c and d are adjacent tasks? I don't know the order of the tasks in the tasks chain.
ACCEPTED ANSWER
Re: How to express adjacent intervals in OPL
20120917T16:11:54Z in response to SystemAdminHi
so then you should use noOverlap which is used to prevent intervals in a sequence from overlapping and (optionally) to enforce a minimal distance between consecutive intervals.
regards



ACCEPTED ANSWER
Re: How to express adjacent intervals in OPL
20120917T17:20:05Z in response to SystemAdminHi
If you mean by adjacent c is the immediate predecessor of d in the sequence, you have also to add the constraint telling it
dvar interval CD[1..2*Nb] = /* the set of c's, d's */ dvar sequence unloader in CD; /* ... */ subject to { /* .. */ noOverlap(unloader); forall(i in 1..Nb) { endBeforeStart(CD[2*i],CD[2*i + 1],5); previous(unloader, CD[2*i], CD[2*i + 1]); } /*...*/ }
Eventually, in this case, there is a stronger model. In fact the unloader will sequence the block (c>d). That is the span of (c, d)
dvar interval CD[1..2*Nb] = /* the set of c's */ dvar interval Chains[1..Nb] dvar sequence unloader in Chains; /* ... */ subject to { /* .. */ noOverlap(unloader); forall(i in 1..Nb) { endBeforeStart(CD[2*i],CD[2*i+1],5); span(Chains[i], all (j in 1..2*Nb, div(j, 2) == i)); } /*...*/
in practice the second model is more <<natural>> as it adjusts the tasks in the sequence by using the hierarchy of the model.
ACCEPTED ANSWER
Re: How to express adjacent intervals in OPL
20120918T16:27:06Z in response to GGRThank you.
That's what I mean. However, could explain your text code? I can not accurately understand. I'm new to OPL.


ACCEPTED ANSWER
Re: How to express adjacent intervals in OPL
20120918T16:48:29Z in response to SystemAdminHi
First I made a mistake, in OPL div (the integer division) must be used as an operator. That is you write
j div 2
About the model.
span(dvar interval master, dvar interval[] slaves) is a constraint that tell that master spans the slaves. That is a slave interval is in the master interval and the master interval start point is the minimum start point among the slaves intervals and conversely with end. please refer to item "Constraints on groups of interval variables in CP Optimizer" of CP Optimizer > CP Optimizer C++ API Reference Manual > Concepts entry of the CP Optimizer reference manual.
I want to build a sequence of C, D interval but I know that C[i] immediately precedes D[i] in the sequence. So, Hierarchically, the sequence is the sequence of block C[i]>D[i]. The block C[i]>D[i] is spanned by intervals CD[i] then I declare the sequence of CD[i].
The main advantage of this model is that the number interval variables of the sequence is minimal and it allows to model exactly the hierarchical structure of a solution 1) block (C precede D) and sequence of such block. Imagine the blocks are composed of 4 intervals instead of 2, the advantage appears quite evidently.
Hope that helps