Hi, I'm developing a Constraint Programming (CP) model for a simple scheduling problem. I decided to develop my model in IBM Ilog CPLEX Optimization Studio. I defined my both interval and sequence variables as follows: dvar interval INTERVALS[i in machines][j in jobs] size PROCESS[i][j]; dvar sequence MACHINES[i in machines] in all(j in jobs) INTERVALS[i][j]; Here is my question: Can I access the position of interval variables (INTERVALS) in the sequence variable (MACHINES) during the optimization process? asked 19 Feb '16, 01:41 monash 
Hello, There is no "direct" way to get this expression in CP Optimizer. One of the reasons why this expression is not provided is that, often (but not always) there are other more efficient ways to model the problem without them. So my first question is, why do you need this positional variable for ? This being said, there are several ways to get these variables in an indirect way. For instance, you could duplicate the sequence and the interval variables on the sequence so as to have a sequence variable with only unit length intervals. If you use "sameSequence" constraint between the two sequences, the position is given by the start value of the intervals on the "position" sequence. It is probably more clear with a pseudocode:
You may want to avoid the interval variables UNITDURATION to mess up with the search (they are not real decision variables) so you can either use search phases (fix INTERVALS first) or translate the intervals UNITDURATION[j] to the left with a big H value:
You can also consider using the "isomorphism" constraint (see delivered example sched_learningeffect). But it would be good to know what you need these positional variables for because there may be more direct models. Philippe answered 19 Feb '16, 07:55 Philippe Lab... Many thanks @philippelaborie. Actually, my initial purpose was to sort an array of interval variables based on their "end" property. Have you any solution for this?
(19 Feb '16, 12:08)
monash
@philippelaborie: I tested your solution but it seems it doesn't work!
(24 Feb '16, 00:59)
monash
