本文整理汇总了Python中monitor.Monitor.report方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.report方法的具体用法?Python Monitor.report怎么用?Python Monitor.report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.report方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import report [as 别名]
class Simulation:
"""A simulation.
This is the class which is responsible for setting up and running a
simulation.
The API is given to you: your main task is to implement the run
method below according to its docstring.
Of course, you may add whatever private attributes and methods you want.
But because you should not change the interface, you may not add any public
attributes or methods.
This is the entry point into your program, and in particular is used for
auto-testing purposes. This makes it ESSENTIAL that you do not change the
interface in any way!
"""
# === Private Attributes ===
# @type _events: PriorityQueue[Event]
# A sequence of events arranged in priority determined by the event
# sorting order.
# @type _dispatcher: Dispatcher
# The dispatcher associated with the simulation.
def __init__(self):
"""Initialize a Simulation.
@type self: Simulation
@rtype: None
"""
self._events = PriorityQueue()
self._dispatcher = Dispatcher()
self._monitor = Monitor()
def run(self, initial_events):
"""Run the simulation on the list of events in <initial_events>.
Return a dictionary containing statistics of the simulation,
according to the specifications in the assignment handout.
@type self: Simulation
@type initial_events: list[Event]
An initial list of events.
@rtype: dict[str, object]
"""
# TODO
pass
# Add all initial events to the event queue.
# Until there are no more events, remove an event
# from the event queue and do it. Add any returned
# events to the event queue.
return self._monitor.report()