Optimization of out-vessel magnetic diagnostics for plasma boundary reconstruction in tokamaks