Optimization of the magnetic diagnostics for plasma shape identification in tokamak machines