When to Localize? A POMDP Approach