Beispiel #1
0
def test49():
    l1 = []

    test_input = '''
    one two
    three four
    five
    '''
    with sim.ItemFile(test_input) as f:
        while True:
            try:
                print(f.read_item())
            except EOFError:
                break




    with sim.ItemFile('test.txt') as f:
        while True:
            try:
                l1.append(f.read_item_bool())
            except EOFError:
                break

        print('------------------------')

        f = sim.ItemFile('test.txt')
        l2 = []
        while True:
            try:
                l2.append(f.read_item())
            except EOFError:
                break

    for x1, x2 in zip(l1,l2):
        print(x1, x2)
    def setup(self, job_generator, job):
        self.group = job_generator.group_dist()
        self.duration = job_generator.duration_dist()
        self.start_execution = None
        self.an_bar = sim.Animate(rectangle0=(0, 0, 0, 0))

    def animation_objects(self, q):
        an1 = sim.Animate(rectangle0=(0, 0, 60, 12), fillcolor0=self.group.color)
        an2 = sim.Animate(text=str(self.name()), anchor='sw', textcolor0='white', fontsize0=12, offsetx0=2, offsety0=2)
        return (70, 15, an1, an2)


env = sim.Environment(trace=False)

groups = []
with sim.ItemFile('job shop.txt') as f:
    job_select_method = f.read_item()

    while True:
        name = f.read_item()
        if name == '//':
            break
        number_of_machines = f.read_item_int()
        fraction = f.read_item_float()
        color = f.read_item()
        groups.append(Group(name=name, job_select_method=job_select_method,
            fraction=fraction, number_of_machines=number_of_machines, color=color))

    duration_dist = sim.Distribution(f.read_item())
    inter_arrival_time_dist = sim.Distribution(f.read_item())
    number_of_tasks_dist = sim.Distribution(f.read_item())
Beispiel #3
0
class Task(sim.Component):
    '''
    Smallest processing unit on machines.
    Attributes:group, duration
    '''
    def setup(self, job_generator, job):
        self.group = job_generator.group_dist.sample()
        self.duration = job_generator.duration_dist
        self.flag_dist = job_generator.flag_dist


env = sim.Environment(trace=False)

groups = []

with sim.ItemFile('config.txt') as f:
    job_select_method = f.read_item()

    while True:
        name = f.read_item()
        if name == '//':
            break
        number_of_machines = f.read_item_int()
        fraction = f.read_item_float()
        groups.append(
            Group(name=name,
                  job_select_method=job_select_method,
                  number_of_machines=number_of_machines,
                  fraction=fraction,
                  file_name='price.csv'))