There are 20 teams that must play with each other in pairs(1 - 4 times), i.e.20 * 19=380 matches(with 2 games for a couple).
There are several free slots for every day - i.e.place and time
Condition: if a team plays on that day, then it must have at least 2 games(there should not be exactly one game per day), either 0 or 2+ games.

How to find the arrangement of matches(schedule) with a minimum number of days(or an acceptable result, the minimum + 10%), in an acceptable time?

If you just go through all the options, then this is 380! which is not really check.
I made a decision that makes the arrangement for O(N * M)(matches x slots) using the sieve and demand method, but without the “at least 2 games per day” condition.

If we apply the condition, then my algorithm does not find a solution.
Where to dig, what are the options?

Now in my head 2 directions:
* Recursive brute force + optimization(what? The same sieve and demand cuts?)
* Make ready-made constellation patterns and apply them.

1 Answers 1

Or I did not understand the condition or...
What's so complicated? The minimum number of days will ensure maximum slots loading daily.
If there are an even number of slots(n).Then at each step, select n/2 pairs that have not played yet and they play both their games.

If there are an odd number of slots, then at an odd step we choose(n-1)/2 pairs that have not played yet and they play both their games + 1 pair that have not played yet and she plays 1 game.
In the even-numbered step, we choose(n-1)/2 pairs that have not played yet and they play both their games and the one pair that played their one game at the last step - it plays its second game.

Everything.
  • and they play both their games.

    And really, for 2 pairs of games it’s easy, I corrected the condition(there can be 1 or more games), there are different slots every day.one, some slots can accommodate more than 1 match and be at a distance from each other in time, etc.)

    But in general, the direction is clear, you need to make a number of patterns and work them out.
    – Xenophobic44 Aug 18 '18 at 11:46