def evaluate(self, scope=None):
        """Use the value in the u vector if it exists instead of pulling
        the value from scope.
        """
        if self.pcomp_name:
            scope = self._get_updated_scope(scope)
            try:
                system = getattr(scope, self.pcomp_name)._system
                vname = self.pcomp_name + '.out0'
                if scope._var_meta[vname].get('scalar'):
                    return system.vec['u'][scope.name2collapsed[vname]][0]
                else:
                    return system.vec['u'][scope.name2collapsed[vname]]
            except (__HOLE__, AttributeError):
                pass

        return super(Objective, self).evaluate(scope)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/hasobjective.py/Objective.evaluate