Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opposite of no_overlap #66

Open
prakashgawas opened this issue Mar 20, 2022 · 2 comments
Open

Opposite of no_overlap #66

prakashgawas opened this issue Mar 20, 2022 · 2 comments

Comments

@prakashgawas
Copy link

prakashgawas commented Mar 20, 2022

Hi, I am using python for CP solving.
I would like to know if there is constraint that does the opposite of no_overlap.
This will be like
overlap(interval, arr, n)
interval - single interval variable
arr - array of interval variables
n - positive integer less than length of arr

this will mean that atleast n interval variables from arr overlap in the interval of interval

This is for a situation in job scheduling when a job is not possible to be scheduled on a machine because there are already n higher priority jobs.

@p-shaw
Copy link

p-shaw commented Apr 5, 2022

Hello, you can use the overlapLength expression to know how much overlap there are between two interval variables. This way you can count the number of non-zero overlaps between 'interval' and all the elements of 'arr'. Something like:

mdl.sum([mdl.overlap_length(interval, a) > 0 for a in arr]) >= n

@prakashgawas
Copy link
Author

Hello,
Thanks for the reply, but actually what I need is a bit more complex.
I need that whenever interval starts then n intervals from a set have already started or start parallelly with interval. that is something above the overlap constraint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants