timnon / pyschedule

pyschedule - resource scheduling in python
Apache License 2.0
295 stars 61 forks source link

Use same resource for related tasks but only where possible #17

Open gausie opened 7 years ago

gausie commented 7 years ago

Hi there!

In the example we have

First remove the old resource to task assignments

green_paint -= Alice|Bob green_post -= Alice|Bob red_paint -= Alice|Bob red_post -= Alice|Bob

Add new shared ones

green_resource = Alice|Bob green_paint += green_resource green_post += green_resource

red_resource = Alice|Bob red_paint += red_resource red_post += red_resource run(S)

Is it possible to say that the same resource should manage related tasks but only where possible (i.e. make this a little more lax).

For example. Alice would ideally postprocess the bike she also painted but is willing to postprocess the bike that Bob painted if necessary.

gausie commented 7 years ago

Basically this needs to be a sort of lax ALTMULT that will schedule a set of tasks to the same resource unless that constraint makes no solution possible.

mcopley08 commented 6 years ago

Did you ever implement a solution for this? I'm encountering the exact same issue I'd like to resolve.

timnon commented 6 years ago

sorry for the late answer: This is currently not possible, you either have to use the same resource or any assignment is allowed. There is the idea to make any constraint "soft" with some cost, but that would be quite some effort.

One way to deal with this problem is to use a small heuristic on top: iteratively add more constraints until no more solution is found. This of course requires that you have some natural order of your constraints (in this case same resource requirements), but maybe there is some natural hierarchy which ones are more important than other ones?