Suppose that the course consists of 5 training programs, named from A to E, and during the course the student learns 7 unique pieces of information, which I number from 1 to 7. The information obtained in this textbook is set in stone, however I I can study textbooks in any order. For example, I could teach Tut C first if I wanted to.
Tut A: (1,2,3,4)
Tut B: (5,6,7)
Tut C: (2,3)
Tut D: (5,6)
Tut E: (1,2,3)
So let's say I had to teach textbooks in the following order:
Ordering 1:
Tut A: (1,2,3,4)
Tut B: (5,6,7)
Tut C: (2,3)
Tut D: (5,6)
Tut E: (1,2,3)
Tut F: (1,3)
Then the student will study 4 pieces of information in the first textbook and 3 new pieces of information in the second textbook. There is nothing to learn in subsequent textbooks. This is not a good way to order training programs, as the student must learn too much new information at the beginning of the course (steep learning curve). The following order is better:
Ordering 2:
Tut C: (2,3)
Tut F: (1,3)
Tut E: (1,2,3)
Tut A: (1,2,3,4)
Tut D: (5,6)
Tut B: (5,6,7)
: 1 , 1 , , 1 ,
:
Ordering 3:
Tut C: (2,3)
Tut E: (1,2,3)
Tut F: (1,3)
Tut A: (1,2,3,4)
Tut D: (5,6)
Tut B: (5,6,7)
:
def curve(tutorials):
covered = set()
for t in tutorials:
new = set(t).difference(covered)
covered.update(new)
yield len(new)
print(tuple(curve(((1,2,3,4), (5,6,7), (2,3), (5,6), (1,2,3), (1,3)))))
print(tuple(curve(((2,3), (1,3), (1,2,3,4), (1,2,3), (5,6), (5,6,7)))))
print(tuple(curve(((2,3), (1,2,3), (1,3), (1,2,3,4), (5,6), (5,6,7)))))
, . :
(4, 3, 0, 0, 0, 0)
(2, 1, 1, 0, 2, 1)
(2, 1, 0, 1, 2, 1)
, :
def steepness(r):
return sum((r[i]*(len(r)-i) for i in range(len(r))))
:
39
26
25
, .
, :
import itertools
def curve(tutorials):
covered = set()
for t in tutorials:
new = set(t).difference(covered)
covered.update(new)
yield len(new)
def steepness(r):
r = tuple(r)
return sum((r[i]*(len(r)-i) for i in range(len(r))))
tutorials = ((1,2,3,4), (5,6,7), (2,3), (5,6), (1,2,3), (1,3))
print(min(itertools.permutations(tutorials), key=lambda x: steepness(curve(x))))
:
((2, 3), (1, 2, 3), (1, 3), (1, 2, 3, 4), (5, 6), (5, 6, 7))
, 30 , 5, 20 . , ?