Exemplo n.º 1
0
class CommandInterpreter(cmd.Cmd):

    call_center = CallCenter()

    # ----- commands -----
    def do_register_operator(self, arg):
        'register a new operator with id <arg>'

        self.call_center.new_operator(arg)

    def do_call(self, arg):
        'makes application receive a call whose id is ​ <arg>​ '

        self.call_center.new_call(arg)

    def do_answer(self, arg):
        'makes operator ​<arg>​ answer a call being delivered to it'

        self.call_center.answer(arg)

    def do_reject(self, arg):
        'makes operator ​<arg>​ reject a call being delivered to it'

        self.call_center.reject(arg)

    def do_hangup(self, arg):
        'makes call whose ​id is <arg> be finished​'

        self.call_center.hangup(arg)

    def do_exit(self, arg):
        return True
Exemplo n.º 2
0
from callcenter import CallCenter
from prediction import get_weather_predictions

weather_events = get_weather_predictions()
print("Prediction of severe weather conditions:", weather_events)

call_center = CallCenter("time.csv")

regular_day_sche = call_center.create_regular_schedule()

call_center.load_schedule(regular_day_sche, weather_events)

# a schedule and its utilizaiton can be computed upfront.
# It could be easily optimized even without running the simulation
print("Utilization:", call_center.get_utilization())

call_center.run_simulation()

print("Avg. wait time:", call_center.get_avg_wait())
print("QoS (% under 20s wait):", call_center.get_qos())

call_center.write_stats("wtime-output.csv")
Exemplo n.º 3
0
from mathdojo import MathDojo
from hospital import Patient
from hospital import Hospital
from car import Car
from callcenter import Call
from callcenter import CallCenter
from bike import Bike
from animals import Animal
from animals import Dog
from animals import Dragon

md = MathDojo(0)
print md
hosp = Hospital("Great Hospital", 6)
print hosp
patient = Patient(1, "Bob")
print patient
car = Car(5000, "75mph", "Full", "25mpg")
print car
call = Call(1, "Stephen", "770-789-7038", 8.30, "For Fun")
print call
call_center = CallCenter()
print call_center
bike = Bike(150, "15mph")
print bike
fox = Animal("Fox")
print fox
pitbull = Dog("Pitbull")
print pitbull
trogdor = Dragon("Trogdor the Burninator")
print trogdor