def set_objective(self, objective, extraobjexpr=None):
if objective is not None and self.matrix_var_dim is not None:<EOL><INDENT>facvar = self.__get_trace_facvar(objective)<EOL>self.obj_facvar = facvar[<NUM_LIT:1>:]<EOL>self.constant_term = facvar[<NUM_LIT:0>]<EOL>if self.verbose > <NUM_LIT:0> and facvar[<NUM_LIT:0>] != <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% facvar[<NUM_LIT:0>])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>super(SteeringHierarchy, self).set_objective(objective, extraobjexpr=extraobjexpr)<EOL><DEDENT>
Set or change the objective function of the polynomial optimization
        problem.

        :param objective: Describes the objective function.
        :type objective: :class:`sympy.core.expr.Expr`
        :param extraobjexpr: Optional parameter of a string expression of a
                             linear combination of moment matrix elements to be
                             included in the objective function
        :type extraobjexpr: str.