Пример #1
0
    def arrival(self, agenda):
        # Servers are available, service the customer
        service_time = gamma(self.aS, self.bS)
        if agenda.has_servers():
            # Initialise the customer
            customer = Customer(agenda.current_time, service_time)
            customer.set_service_start(agenda.current_time)

            # Schedule customer for departure
            agenda.get_server()
            agenda.schedule(agenda.current_time + service_time, self.departure, [customer])

        # No servers available, add customer to the queue
        else:
            agenda.add_customer(Customer(agenda.current_time, service_time))

        self.arrivals += 1
        if self.arrivals < self.max_arrivals:
            # New arrival
            new_arr_time = gamma(self.aA, self.bA)
            agenda.schedule(agenda.current_time + new_arr_time, self.arrival, [])