Friday, 20 March 2015

Assignment 3: Memoization, Pruning, Myopia

Continuing from the previous assignment, the goal of Assignment 3 is to extend the game by adding computer strategies. Minimax strategy, which effectively looked at all the possible combination of moves leading to an end of game was really slow and impractical for Tippy. Here, three different "optimization" techniques are employed to speed up the minimax strategy. Myopia is really an optimization in my opinion because it does not neccessarily generate the same result as minimax.

Memoization: avoids redundancy by storing the value returned by recursive calls
Pruning: avoid "travelling" through states that you will never choose anyways
Myopia: Avoid "travelling" through all the states by limiting how far you look ahead

At the end, to decrease computation time, what you need to do is decrease the number of states you consider. What these options show for the most part is something like "entropy-enthalpy tradeoff" in chemistry. To speed things up, you need to use more memory(memoization) or give up accuracy (myopia). To gain speed, you need to trade something else. Pruning is particularly interesting since it does not seem to compensate speed. My guess is that the "tradeoff" lies in what happens where there are no avoidable paths. Since pruning tries to avoid checking certain states, it needs to check whether things can be avoided. In some sense, this is a time investment. In certain (probably very many) situations, you may get the benefit, but you may not.

I currently have a more or less working version of all three. I am very surprised by the speed at which these work, particularly pruning. One big problem though is that I'm not entirely sure HOW to test these. Maybe I can see that they are faster and they give accurate results but that does not mean that the algorithm is implemented perfectly. Maybe it is still visiting certain nodes that it can avoid. One sloppy way of checking of course is to verify that the results agree, but does not ensure that the code is working properly.

At the end, I think option B is way easier. You don't need to write any docstrings or care about formatting too much and the functions are similar to what we have seen in labs. Also, to check your code for the minimax optimizations, you kind of need game_state_tree. I think the only way to truly check your minimax optimization algorithms is to collect which nodes have been visited and show that it matches your expectations. To obtain your expectations, you probably need a game state tree...

Time to get working... I will do my lab 9 and post my soln probably today. I don't like to get behind on weekly commitments...




No comments:

Post a Comment