code: def set_objective(self, expression):
          
  
          if isinstance(expression, numbers.Number):
              # Allow expressions with no variables as objective,
              # represented as a number
              expression = Expression()
  
          self._p.setObjective(
              self._grb_expr_from_value_set(expression.values()))
docs: Set linear objective of problem.