Gaps between intervals

195 views
Skip to first unread message

Igor Proshkin

unread,
Mar 20, 2021, 2:52:38 PM3/20/21
to or-tools-discuss
I have thousand of intervals in my model. Is there a way to get all gaps between these intervals efficiently? To get these gap intervals I first need to sort my intervals. I tried to do that using AddElement constraints, but it is not very efficient when the number of intervals is very big. 

I am using CP-SAT solver in Python.

P.S.
I see there are helper classes in C++ (IntervalsRepository, SchedulingConstraintHelper) for interval problems. Can they be used for my problem if I'd use C++?


Laurent Perron

unread,
Mar 20, 2021, 5:14:07 PM3/20/21
to or-tools-discuss
See jobshop_ft06_distance.py

This will maintain the sequence of intervals. From the circuit constraint, you can compute all gaps.
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/9d6032bb-b39a-4aa1-b66b-f501775359ecn%40googlegroups.com.

Igor Proshkin

unread,
Mar 20, 2021, 10:47:29 PM3/20/21
to or-tools-discuss
Laurent,

I need those gap intervals to apply other constraints on them or use them in the objective function.
For example, I need to minimize the number of gaps that have a duration > 0.
Sorry, but I can't figure out how can I do this with circuit constraint. Can you elaborate?

Thank you
Reply all
Reply to author
Forward
0 new messages