Long Optional Intervals and Reservoir Constraint

381 views
Skip to first unread message

R. Timothy Weeks

unread,
May 13, 2019, 2:55:47 PM5/13/19
to or-tools-discuss
I'm working on a Python job-shop problem with a reservoir constraint with actives and some long-running jobs (optional intervals with duration 40-75 time steps). I create a "t" IntVar for each t in the interval and constrain it to t==interval_start + 0, t ==interval_start + 1, etc. and append that t, the interval active, and a constant demand to lists that are passed into the reservoir constraint.

Is there a simpler way to use the reservoir constraint that uses fewer variables? AddCumulative seems to combine intervals and the reservoir constraint, but I need to have positive/negative demands and ensure the cumulative value is constrained for every time step. The model will run on small datasets, but larger datasets (even a few, long intervals) can take a couple hours to "pre-process" before multi-threaded search begins.

Also, would it ever be possible to use the upper-bound of a reservoir constrain as the objective variable?

Thanks!
Timothy

Laurent Perron

unread,
May 13, 2019, 3:57:58 PM5/13/19
to or-tools-discuss
Do you mean you want the filling/emptying to be gradual ?
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



De : R. Timothy Weeks <rtimot...@gmail.com>
Date : lun. 13 mai 2019 à 20:55
À : or-tools-discuss

--
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/160eeea6-7295-47f1-9135-5594bdd34bd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

R. Timothy Weeks

unread,
May 13, 2019, 4:23:34 PM5/13/19
to or-tools-discuss
Yes: if I have a job represented by an interval from 0 start to 50 end, I want to ensure the reservoir constraint to apply for t = 0,1,2,3... 50

Ideally, I would like to complete my jobs while keeping the max reservoir level as low as possible.

Laurent Perron

unread,
May 13, 2019, 4:39:43 PM5/13/19
to or-tools-discuss
The reservoir constraint is always valid at any time, it is just that emptying/refilling only happens at a certain time.

I believe that to check your reservoir constraint, you only need to check at each start/end of each intervals, not at each point in time.

I would suggest you look cp_model_expand.cc, the reservoir is expanded as a combination of simple constraints. 
At any start, end, you sum the contributions of other actions, and you check it is valid.

W.r.t. the capacity as a variable, it would be easy to adapt.

it seems tricky but doable,

Le lun. 13 mai 2019 à 22:23, R. Timothy Weeks <rtimot...@gmail.com> a écrit :
Yes: if I have a job represented by an interval from 0 start to 50 end, I want to ensure the reservoir constraint to apply for t = 0,1,2,3... 50

Ideally, I would like to complete my jobs while keeping the max reservoir level as low as possible.

--
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.

For more options, visit https://groups.google.com/d/optout.


--
--Laurent

Reply all
Reply to author
Forward
0 new messages