how to solve optimization problems