I can not seem to find the needed functions to model the following problem through the Java API (CP Optimizer): a machine that has downtime and sequence-dependent setup times, with the extra constraint, that the physical preparation (setup) of a job ends right before the job starts.
Since there are no preemptions, I am using IloIntervalSequenceVar (with a noOverlap that contains the setup time matrix) and IloNumToNumStepFunction for downtimes. This leads to solutions in which a job can start right after a downtime, because the downtime offers enough distance for the transition time to take place (or at least a part of it). The problem is that this transition itself is also an activity, so it is illegal for it to overlap with downtime.
Next, I tried modeling the setup times and/or downtimes as intervals themselves, which solves the overlap problem. However, I always bump into the same problem: it is possible to access intervals and their properties after the model has been solved, but not when formulating decision variables. Since setup times are sequence-dependent, I want to assign a certain size to a setup interval, based on its predecessor (its successor is implied through the constraint I mentioned earlier). I have no way of retrieving this. Methods such as getPrev are Native, methods such as prev are Constraints. I basically want a Boolean matrix for each setup interval so I can assign the correct size to it based on the setup time matrix, but I can not find any method that provides this. I can think of ways without modeling setups as intervals, using extra constraints, but they need this same functionality.
What do I oversee, is there a better way to go about this?
Edit for clarification with $A$, $B$, $\rm Setup$ and $\rm Downtime$ being intervals, $A$ being the last job before $B$:
\begin{align}{\rm End}(A) + |{\rm{Setup}}(A,B)| &\leq {\rm Start}(B)\\{\rm End}({\rm Setup}(A,B)) &= {\rm Start}(B)\\{\rm Downtime} \cap (A \cup {\rm Setup}(A,B) \cup B)&= \emptyset\end{align}
Which propagates the following constraint I am trying to model as such:
\begin{align}&{\rm Start}({\rm Downtime}) - {\rm End}(A) < |{\rm Setup}(A,B)| + |B|\\\implies&{\rm End}({\rm Downtime}) + |{\rm Setup}(A,B)| \leq {\rm Start}(B) \end{align}
π(a), using for instanceIloCP::typeOf? When checking the position before an interval, I don't yet know what interval is at that position. So to detect whetheritv acomes right beforeitv b, one of the contructions I can think about isprev(a) == prev(b) - 1, creating annoying bound conditions. For now, I get-1as return value (and I can't seem to find what's wrong), but your answer should fix it once I figure out my mistake. Thanks. – Maarten Mar 01 '20 at 14:21π(a)during the modeling. The main reason is that it is not the way the solver works internally. The advantage of expressions such astypeOfPrevis that they can propagate even if position in the sequence is still unknown.The idea is that usually it is not important what interval is before in particular but what are the properties of the previous interval. And those are accessible bytypeOfPrev,endOfPrev,lengthOfPrevandsizeOfPrev. Note that there are optional arguments for the case the interval is first or absent. – Petr Vilím Mar 01 '20 at 17:44