After testing, I have found two optimal strategies, one of which will always produce the best result. I will use a, b, c and d to represent their time to pass the bridge, from fastest to slowest.
The first one is using the faster two people to pass the lamp and let the slower two walk together. The steps are like this (using 1, 2, 7, 10, bracket shows the tally):
c d —> a b (2 min)/ a c d —> b (3 min)/ a —> b c d (13 min)/ a b —> c d (15 min)/ —> a b c d (17 min)
Time taken=a+3b+d.
The second one is using the fastest person to pass the lamp and let others walk one by one. The steps are like this (also using 1, 2, 7, 10):
c d —> a b (2 min)/ a c d —> b (3 min)/ d —> a b c (10 min)/ a d —> b c (11 min)/ —> a b c d (21 min)
Time taken=2a+b+c+d.
If we take out a+b+d to both equations, the first one leaves us with 2b and the second leaves us with a+c, which is what you need to calculate for comparing which strategy is faster (I call this the determining factor). Take 2, 6, 7, 10 as an example, the determining factor of the first method is 6*2=12 while for the second one it’s 2+7=9. Therefore, the second strategy is faster and it takes 2*2+6+7+10=27 min, which is the shortest possible.