Optimized magnetic confinement configurations for cold atoms