X
X
Xymis2021-07-11 13:54:45
Algorithms
Xymis, 2021-07-11 13:54:45

What algorithm should be used to solve the problem?

There was a need to optimize some processes in the enterprise
There are a whole bunch of scripts that run on the cron and each works out in about the same time
I figured out matplotlib and as a result the graph will look like this:
60eacd192b427065188137.png
On the horizontal axis, the start and end times of each script
On the vertical axis, respectively, script identifiers
It is necessary to find an optimization algorithm so that the minimum number of scripts work at any given moment.
The start time of each script and the time of its operation will be transmitted.
At the output, the start time of each script proposed by the algorithm is expected so that the intersection of their works is minimal.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmshar, 2021-07-11
@Xymis

What's the problem?
1. Select a set of scripts so that the sum of their running times is as close as possible but less than 24 hours.
2. The selected scripts form a separate sequence of scripts. Throw the selected scripts from the pool in question.
3. If the pool of scripts is not empty, go to step 1. Otherwise, finish.
We get a certain number of script sequences. Each such sequence runs in parallel and independently of the others. The elements in each of these sequences can be run in any order.
The number of such sequences is the minimum possible. And consequently, the number of scripts that will work in parallel is minimal.
Since there are several dozen scripts, and planning is static, i.e. "once and for a long time ahead", the first point can even be done by brute force.
But generally speaking, the problem is reduced to the problem of filling knapsacks - a well-known problem in operations research.
PS The task has nothing to do with Mathematics or Python. Yes, and to Analytics - too. A typical task of operations research.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question