Ejemplo n.º 1
0
 def zephyrize(self):
     Zephyr.registerLabeledCollection(self, "demons", "")
     monitoredList = [self.verifiers, self.environment, self.demons]
     for monitored in monitoredList:
         zepy.advertise(monitored, self.clock)
         self.logfile.add(monitored, 0)
     monitor = ZephyrPlotting.createMonitor(self.clock)
     for rewardFunction in self.rewards:
         zepy.monattr(rewardFunction, "rewardValue", clock=self.clock, label=rewardFunction.label())
Ejemplo n.º 2
0
 def zephyrize(self):
     Zephyr.registerLabeledCollection(self, "demons", "")
     monitoredList = [self.verifiers, self.environment, self.demons]
     for monitored in monitoredList:
         zepy.advertise(monitored, self.clock)
         self.logfile.add(monitored, 0)
     monitor = ZephyrPlotting.createMonitor(self.clock)
     for rewardFunction in self.rewards:
         zepy.monattr(rewardFunction,
                      'rewardValue',
                      clock=self.clock,
                      label=rewardFunction.label())
Ejemplo n.º 3
0
def advertise(clock, obj):
    Zephyr.advertise(clock, obj)
Ejemplo n.º 4
0
def monfunc(clock, func, name = None):
    monitor = Zephyr.getSynchronizedMonitor(clock)
    monitor.add(func.__name__ if name is None else name, (lambda : float(func())))
Ejemplo n.º 5
0
def monattr(clock, obj, name, label = None):
    monitor = Zephyr.getSynchronizedMonitor(clock)
    attr = getattr(obj, name)
    monitored = ((lambda : float(attr())) if callable(attr) 
                 else (lambda : float(getattr(obj, name))))
    monitor.add(name if label is None else label, monitored)