Update puzzle optimization to do minimization instead of maximization.