def set_objective(self, expression):
        """Set linear objective of problem."""

        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()))
def set_objective ( self , expression ) : if isinstance ( expression , numbers . Number ) : expression = Expression ( ) self . _p . setObjective ( self . _grb_expr_from_value_set ( expression . values ( ) ) )
Set linear objective of problem.