I think it will be better to avoid the use of two functions T! in the solution of this model. It should be possible to return value and policies in one shot. Or am I missing something?
Thanks for the great work!
@lorenzo.garlappi Thanks for your comment Lorenzo. I didn’t write this particular piece of code but I think the idea of having two functions is to maximize efficiency. The first T!
does value function iteration. It could compute the best guess of the optimal policy too, but there’s really no need to do that until the end. That’s were the second T!
comes in.
It’s not pretty, but sometimes efficiency is more important. If you can suggest an improvement then please do