trying to solve an optimization problem