Grid Search Method For Optimization