Optimization and uncertainty quantification of gradient index metasurfaces