コード例 #1
0
 def reset(self):
     SimEntityBase.reset(self)
     self.number_in_queue1 = 0
     self.number_in_queue2 = 0
     self.number_available_server1 = self.number_server1
     self.number_available_server2 = self.number_server2
     self.number_blocked = 0
コード例 #2
0
 def __init__(self, interarrival_time_generator, service_time_generator,
              prob_needs_rework):
     SimEntityBase.__init__(self)
     self.interarrival_time_generator = interarrival_time_generator
     self.service_time_generator = service_time_generator
     self.prob_needs_rework = prob_needs_rework
     self.number_in_queue = nan
     self.number_available_resources = nan
コード例 #3
0
 def __init__(self, initial_loc, max_speed):
     SimEntityBase.__init__(self)
     self.initial_loc = initial_loc
     self.max_speed = max_speed
     self.last_stop_loc = None
     self.velocity = None
     self.start_move_time = nan
     self.destination = None
コード例 #4
0
 def __init__(self, number_servers, service_time_generator):
     SimEntityBase.__init__(self)
     self.number_servers = number_servers
     self.service_time_generator = service_time_generator
     self.number_available_servers = nan
     self.queue = []
     self.delay_in_queue = nan
     self.time_in_system = nan
コード例 #5
0
 def __init__(self, total_number_servers, service_time_generator):
     SimEntityBase.__init__(self)
     self.total_number_servers = total_number_servers
     self.service_time_generator = service_time_generator
     self.queue = []
     self.number_available_servers = nan
     self.number_reneges = nan
     self.number_served = nan
コード例 #6
0
 def __init__(self, interarrival_time_generator, service_time_generator,
              number_resources):
     SimEntityBase.__init__(self)
     self.interarrival_time_generator = interarrival_time_generator
     self.service_time_generator = service_time_generator
     self.number_resources = number_resources
     self.number_in_queue = nan
     self.number_available_resources = nan
コード例 #7
0
 def __init__(self, number_stations, number_machines,
              service_time_generators):
     SimEntityBase.__init__(self)
     self.number_stations = number_stations
     self.service_time_generators = service_time_generators
     self.number_machines = number_machines
     self.queue = []
     self.number_available_machines = []
     self.validate()
コード例 #8
0
    def __init__(self, mover, path, start_on_run):
        SimEntityBase.__init__(self)
        self.mover = mover
        self.path = path
        self.start_on_run = start_on_run

        self.next = nan

        self.add_sim_event_listener(self.mover)
        self.mover.add_sim_event_listener(self)
コード例 #9
0
    def __init__(self, total_number_servers, service_time_generator,
                 queue_capacity):
        SimEntityBase.__init__(self)
        self.total_number_servers = total_number_servers
        self.service_time_generator = service_time_generator
        self.queue_capacity = queue_capacity
        self.number_in_queue = nan
        self.number_available_servers = nan
        self.number_balks = nan
        self.number_potential_customers = nan

        if (self.queue_capacity < 0):
            raise ValueError(
                'queue_capacity must be \u2265 0: {cap:%d}'.format(
                    cap=self.queue_capacity))
コード例 #10
0
 def __init__(self, interarrival_time_generator, number_server1, number_server2, \
              service_time1_generator, service_time2_generator, buffer_size):
     SimEntityBase.__init__(self)
     # Parameters
     self.interarrival_time_generator = interarrival_time_generator
     self.number_server1 = number_server1
     self.number_server2 = number_server2
     self.service_time1_generator = service_time1_generator
     self.service_time2_generator = service_time2_generator
     self.buffer_size = buffer_size
     # State variables
     self.number_in_queue1 = nan
     self.number_in_queue2 = nan
     self.number_available_server1 = nan
     self.number_available_server2 = nan
     self.number_blocked = nan
コード例 #11
0
 def __init__(self, number=1):
     SimEntityBase.__init__(self)
     self.number = number
     self.name = 'Pinger2'
コード例 #12
0
    heappush(heap, evt3)
    heappush(heap, evt4)

    copy = heap.copy()
    copy.sort()

    dump='Event List:'
    for e in copy:
        dump += '\n' + str(e)

    print(dump)

    el = EventList()

    evt = source.schedule('Foo', 1.0)
    evt1 = SimEntityBase().schedule('bar', 2.0, [1])
    evt2 = SimEntityBase().schedule('boo', 2.0, [], priority=Priority.HIGH)

    print (EventList.dump())


    print (Priority.DEFAULT < Priority.HIGH)
    print (Priority.DEFAULT > Priority.HIGH)
    # print(evt1 < evt2)
    # print(evt1 > evt2)

    copy = EventList.event_list
    copy.sort()
    for e in copy:
        print(e)
コード例 #13
0
 def __init__(self, name='TestSimEntity'):
     SimEntityBase.__init__(self)
     self.count = 0
コード例 #14
0
 def __init__(self, interarrival_time_generator):          # (3)
     SimEntityBase.__init__(self)
     self.interarrival_time_generator=interarrival_time_generator
     self.number_arrivals = nan
コード例 #15
0
 def reset(self):
     SimEntityBase.reset(self)
     self.next = 0
コード例 #16
0
 def reset(self):
     SimEntityBase.reset(self)
     self.number_in_queue = 0
     self.number_available_servers = self.total_number_servers
     self.number_balks = 0
     self.number_potential_customers = 0
コード例 #17
0
from simkit.stats import IndexedSimpleStatsTally
from simkit.base import IndexedStateChangeEvent
from simkit.base import SimEntityBase
from simkit.rand import RandomVariate

source = SimEntityBase()
print(source.describe())

name = 'foo'
rv = RandomVariate.instance('Exponential', mean=2.3)

stats = IndexedSimpleStatsTally(name)
for i in range(1000):
    for j in range(4):
        event = IndexedStateChangeEvent(j, source, name, rv.generate)
        stats.state_change(event)

print(stats)
コード例 #18
0
 def __init(self, interarrival_time_generator, service_time_generator,
            closing_time):
     SimEntityBase.__init__(self)
     self.interarrival_time_generator = interarrival_time_generator
     self.service_time_generator = service_time_generator
     self.closing_time = closing_time
コード例 #19
0
 def __init__(self, number):
     SimEntityBase.__init__(self)
     self.number = number
コード例 #20
0
 def __repr__(self):
     return SimEntityBase.__repr__(self) + ' (' + str(self.interarrival_time_generator) + ', ' + str(self.renege_time_generator) + ')'
コード例 #21
0
 def __init__(self):
     SimEntityBase.__init__(self)
     self.count = 0
コード例 #22
0
 def __init__(self):
     SimEntityBase.__init__(self)
     self.queue = []
     self.berths = []
     self.delay_in_queue = nan
     self.time_in_System = nan
コード例 #23
0
 def reset(self):
     SimEntityBase.reset(self)
     self.number_arrivals = 0
     self.number_available_servers = self.number_servers
     self.queue = []
     self.number_in_queue = 0
コード例 #24
0
 def reset(self):
     SimEntityBase.reset(self)
     self.queue.clear()
     self.berths.clear()
     self.delay_in_queue = nan
     self.time_in_System = nan
コード例 #25
0
 def reset(self):
     SimEntityBase.reset(self)
     self.number_in_queue = 0
     self.number_available_resources = 1
コード例 #26
0
 def reset(self):                        # (4)
     SimEntityBase.reset(self)
     self.number_arrivals = 0
コード例 #27
0
 def __int__(self):
     SimEntityBase.__init__(self)
     self.outer = None
     self.truncation_point = nan
コード例 #28
0
 def __init__(self, interarrival_time_generator):
     SimEntityBase.__init__(self)
     self.interarrival_time_generator = interarrival_time_generator