Scheduling problem : how to hanlde stock variation hover tasks

51 views
Skip to first unread message

Augustin Rungeard

unread,
Jul 23, 2024, 4:40:58 AM (3 days ago) Jul 23
to or-tools-discuss

Hello everyone !

This conversation follows a question asked on stackoverflow: https://stackoverflow.com/questions/78741310/scheduling-problem-how-to-hanlde-stock-variation-hover-tasks

Laurent Perron, thank you very much for this answer !

So I tried to implement my code using a reservoire constraint (see attachment).

Unfortunately I'm still stuck on one point: my aim is to maximize and prioritize tasks with no missing parts (all the references needed for the task are in stock when the task starts). I can't figure out how to retrieve the state of the stock reservoir at a given moment. This is what I've called “GetVar” on line 54.

Do you have any ideas to help me?

Thanks in advance

Augustin




scheduling with stocks.py

Laurent Perron

unread,
Jul 23, 2024, 5:41:23 AM (3 days ago) Jul 23
to or-tools...@googlegroups.com
You cannot directly. 

This is the reason I do not like the reservoir constraint definition. It just ensures the level stays within bounds, but it does not allow querying the state at a given point.

You will need to do it yourself. The reservoir is actually expanded using precedences.

If you want to know the reservoir level at a given time, just to:

level(t) == initial level + sum((event_i <= t) * demand_i)

where event_i <= t is a boolean_var b: b=> event_i <= t, not b => event_i > t.
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/32a39de8-4f01-4af0-b70a-935eb13d72c9n%40googlegroups.com.

Augustin Rungeard

unread,
Jul 23, 2024, 9:39:26 AM (2 days ago) Jul 23
to or-tools-discuss

Hello Laurent,

Thank you very much for your reply. So I've adapted my code to your proposal. It's attached.

However, I don't understand why it's returning to me that there's no optimal solution, when with the JSON I give it as input, as there's enough stock for all the tasks at the start, it should place them all in 0 and that would optimize both constraints.

Do you have any ideas to help the solver find a solution?

Thanks in advance

Augustin

scheduling with stocks 2.py

Augustin Rungeard

unread,
Jul 23, 2024, 12:20:05 PM (2 days ago) Jul 23
to or-tools-discuss

Hello everyone,

I went back over the code and realized that it was my way of assigning boolean constraints that was wrong. Now it works just fine (I still need to add a constraint to take into account the duration of previous tasks, but it shouldn't be too complicated). Attached the functional code if it can help someone else later.

Thanks again for your help !

I don't have the rights to set the conversation as finished/resolved. I leave it to an admin to do so.

Augustin

scheduling with stocks 3.py
Reply all
Reply to author
Forward
0 new messages