Hm.... sounds like there could be room for improvement here.
Perhaps if the computer decides it is going to cast some form of damage-dealing spell, it should calculate research level of that spell into the algorithm somehow?
Why should the research level matter? Better spells often need more research, but that doesn't mean they always are. For example, in many cases I prefer Falling Frost to Frozen Heart. Both are good, but for different reasons, and should be used depending on the situation.