gride before optimize