D
D
Dreaded2018-08-17 19:29:28
Task Management
Dreaded, 2018-08-17 19:29:28

How to solve the problem of the distribution of time intervals?

One time interval is set, within which the processes will be distributed. For example 100 days.
There are N number of processes that have different duration from 1 to M days. More than K processes cannot run at the same time.
The task is to distribute all processes as rationally as possible using a given interval.
We have one executor, and at the same time he can execute no more than K processes. Sequence and intervals - do not matter.
By maximum rationality it is meant to shove all available processes into the initially specified interval, in such a way that more than K processes would not be executed at one time.
If this is not possible, then solve the problem minimally going beyond. Those. When a situation arises that all processes do not fit in the specified interval, we can hang another K + n process on the executor, but we cannot go beyond the initially specified interval.
At the output, we should get a sequence of process execution.
I can't figure out how to solve this problem. Can you tell me the algorithm, or in general in which direction to dig?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2018-08-17
@xmoonlight

https://planetcalc.ru/917/

S
Sergey Sokolov, 2018-08-17
@sergiks

This is a typical packing problem.
In a "box" 100 long and K wide, you need to push a set of sausages 1 wide and of different lengths.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question