A
A
AstonMartin2019-03-29 11:12:51
Algorithms
AstonMartin, 2019-03-29 11:12:51

Need help on the algorithm for arranging / filling the fleet of vehicles. Any ideas?

Good afternoon!
We are writing a system for distributing orders across the database of vehicles.
Condition: there are N identical vehicles. And there are X orders for them to rent. Daily rent, each for its own period, with its own day of beginning and end.
Task: arrange orders according to the transport base so that the fleet loading is as efficient as possible. That is, so that the gaps between orders for each unit of transport are minimal.
Now we are doing a complete enumeration (in php) of all options and it turns out for a very long time.
Maybe there are ready-made efficient algorithms for this task? Or from what other side to approach the decision?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2019-03-29
@AstonMartin

1. Sort orders by start time.
2. We take the first order in the queue.
3. We find a car that is free by this time for the minimum time.
4. Assign the order to her, throw it out of the queue.
5. Returning to point 2.
In point 3, the minimum time is taken if you want to optimize loading and not use more machines than required for orders. Or the maximum, if you need to scatter them as "fairly" as possible and minimize the downtime of each participant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question