[math-fun] Re: Submarine problem
My computer just finished trying (& failing) to find a 16-or-fewer- shot solution for n = 10, so (edited): n=10, 17 shots: 0 0 0 0 0 1 1 6 1 4 8 5 3 9 2 7 7 total_shots_tried = ~4.0e08 shots_tried: 1 1 1 1 1 2 12 1.2e02 1.2e03 1.2e04 1.1e05 9.7e05 7.4e06 4.7e07 1.8e08 1.6e08 2.8e06 hopeless: 0 0 0 0 0 0 0 0 1 1.4e02 4.4e03 1.1e05 1.7e06 2.1e07 1.3e08 1.2e08 0 wasted: 0 0 0 0 0 0 0 0 5 85 1.2e04 1.2e05 1e+06 7.3e06 3.5e07 4.1e07 1.3e06 n=10, <=16 shots can't be done. total_shots_tried = ~1.1e11 shots_tried: 1 1 4 40 4e02 4e03 4e04 4e05 4e06 4e07 3.9e08 3.3e09 2.2e10 6.6e10 2.2e10 6.6e07 hopeless: 0 0 0 0 0 0 0 1 1e03 2.5e05 1.8e07 7.3e08 1.3e10 5.4e10 1.7e10 0 wasted: 0 0 0 0 0 0 6 3.2e02 1.5e04 2.9e05 4.2e07 3.7e08 2.8e09 9.7e09 4.9e09 2.9e07 "shots_tried" shows how many shots were made at each level. You can see it multiply by 10 for about 8 levels. "hopeless" shows how many subtrees were cut off at each level by the "hopeless" rule: too many subs at one velocity to shoot with the remaining shots. "wasted" shows prunings due to the rule that you might as well use a shot that hits at least one previously-unhit sub. You can see that "wasted" takes effect sooner (which means bigger subtrees are pruned), but "hopeless" cuts off more shallow subtrees. I test for Wasted first & if so, don't test for Hopeless (which is harder to test for), so I don't know their intersection. But their combined effect in this case seems to be that the search took ~10^11 moves instead of ~4x10^13. There is a solution for n = 9 with 17 shots. Proving it can't be done in 16 shots takes longer than for n = 10 because Hopeless kicks in a move later. Current state of the code: http://www.tiac.net/~sw/math-fun I know solving cases by brute force is useless but I was sort of hoping to see patterns or something! Or, in the course of inventing optimizations, to get some insight. I don't feel insightful yet. Another trick should reduce the search by another factor of about 20 for n = 9: scan combinations (instead of cross-product) of moves at the same time (mod n). Maybe this will let me tackle n = 12, too. --Steve -- My apples and oranges are beyond compare!
Steve Witham showed 17 shots is optimal for n=10, and wrote:
I know solving cases by brute force is useless but I was sort of hoping to see patterns or something! Or, in the course of inventing optimizations, to get some insight. I don't feel insightful yet.
It wouldn't be too bad if the optimal solution isn't always generalizable. So far we can do p^k and 2p^k in general with 2n-1 shots; if it's always possible to achieve 2n-1, for example, then that's a great result even if it's not always tight. So perhaps the thing to do with your program is not to search for the minimal solution for n=12, but for *all* solutions with up to 23 shots, and see if we find anything that looks generalizable -- maybe it will lead us to a 2^j p^k solution. (I'm still annoyed that I can't *prove* 2n-1 is minimal even for primes, but that's another story.) --Michael -- It is very dark and after 2000. If you continue you are likely to be eaten by a bleen.
participants (2)
-
Michael Kleber -
Steve Witham