Пример #1
0
    ('LIFO', schedulers.LIFO),
    ('LIFO_SR', schedulers.LIFO_SR),
    ('PS', schedulers.PS),
    ('SRPT', schedulers.SRPT),
    ('SRPTPS', schedulers.SRPT_plus_PS),
    ('FSP', schedulers.FSP),
    ('FSP+PS', schedulers.FSP_plus_PS),
    ('LAS', schedulers.LAS),
    ('FSP+LAS', schedulers.FSP_plus_LAS),
    ('SRPTLAS', schedulers.SRPT_plus_LAS),
    ('WFQEGPS', schedulers.WFQE_GPS),
]

results = {}
for name, scheduler in instances:
    sim = simulator.simulator(jobs, scheduler,
                              simulator.fixed_estimations(estimations))
    results[name] = {jobid: t for t, jobid in sim}


head_fmt = '\t'.join(['{}'] * (len(instances) + 4))
fmt = '\t'.join(['{}'] + ['{:.2f}'] * (len(instances) + 3))

scheduler_names = [n for n, _ in instances]
header = head_fmt.format('Job', 'Arr.', 'Size', 'Est.', *scheduler_names)
print(header)
print('=' * len(header.expandtabs()))
for (jobid, arrival, d), e in zip(jobs, estimations):
    print(fmt.format(jobid, arrival, d, e,
                     *(results[n][jobid] for n in scheduler_names)))
    jobs = parse_swim(args.file, args.d_over_n, args.load)
else:
    with open(args.file) as f:
        jobs = (line.strip().split() for line in f)
        if args.read_estimations:
            args.sigma = None
            old_jobs = jobs
            jobs, estimations = [], []
            for job in old_jobs:
                jobs.append(job[:-1])
                estimations.append(float(job[-1]))
        if args.nojobid:
            jobs = ((i, t, size) for i, (t, size) in enumerate(jobs))
        jobs = [(jobid, float(t), float(size)) for jobid, t, size in jobs]

error = (lambda: simulator.fixed_estimations(estimations)
         if args.read_estimations
         else lambda: simulator.lognorm_error(args.sigma))

instances = [
    ('FIFO', schedulers.FIFO, simulator.identity, None),
    ('PS', schedulers.PS, simulator.identity, None),
    ('SRPT (no error)', schedulers.SRPT, simulator.identity, None),
    ('FSP (no error)', schedulers.FSP, simulator.identity, None),
    ('LAS', schedulers.LAS, simulator.identity, None),
    ('SRPT', schedulers.SRPT, error(), args.iterations),
    ('SRPT + PS', schedulers.SRPT_plus_PS, error(), args.iterations),
    ('FSP + FIFO', schedulers.FSP, error(), args.iterations),
    ('FSP + PS', schedulers.FSP_plus_PS, error(), args.iterations),
    ('FSP + LAS', schedulers.FSP_plus_LAS, error(), args.iterations),
    ('SRPT + LAS', schedulers.SRPT_plus_LAS, error(), args.iterations),
Пример #3
0
 def run_with_estimations(self, jobs, estimations):
     f = simulator.fixed_estimations(estimations)
     result = self.run_jobs(jobs, error=f)
     return list(result)
Пример #4
0
    jobs = parse_swim(args.file, args.d_over_n, args.load)
else:
    with open(args.file) as f:
        jobs = (line.strip().split() for line in f)
        if args.read_estimations:
            args.sigma = None
            old_jobs = jobs
            jobs, estimations = [], []
            for job in old_jobs:
                jobs.append(job[:-1])
                estimations.append(float(job[-1]))
        if args.nojobid:
            jobs = ((i, t, size) for i, (t, size) in enumerate(jobs))
        jobs = [(jobid, float(t), float(size)) for jobid, t, size in jobs]

error = ((lambda: simulator.fixed_estimations(estimations))
         if args.read_estimations
         else lambda: simulator.lognorm_error(args.sigma))

instances = [
    ('FIFO', schedulers.FIFO, simulator.identity, None),
    ('LIFO', schedulers.LIFO, simulator.identity, None),
    ('LIFO_SR', schedulers.LIFO_SR, simulator.identity, None),
    ('PS', schedulers.PS, simulator.identity, None),
    ('SRPT (no error)', schedulers.SRPT, simulator.identity, None),
    ('FSP (no error)', schedulers.FSP, simulator.identity, None),
    ('LAS', schedulers.LAS, simulator.identity, None),
    ('SRPT', schedulers.SRPT, error(), args.iterations),
    ('SRPT + PS', schedulers.SRPT_plus_PS, error(), args.iterations),
    ('FSP + FIFO', schedulers.FSP, error(), args.iterations),
    ('FSP + PS', schedulers.FSP_plus_PS, error(), args.iterations),
    ('FIFO', schedulers.FIFO),
    ('LIFO', schedulers.LIFO),
    ('PS', schedulers.PS),
    ('SRPT', schedulers.SRPT),
    ('SRPTPS', schedulers.SRPT_plus_PS),
    ('FSP', schedulers.FSP),
    ('FSP+PS', schedulers.FSP_plus_PS),
    ('LAS', schedulers.LAS),
    ('FSP+LAS', schedulers.FSP_plus_LAS),
    ('SRPTLAS', schedulers.SRPT_plus_LAS),
    ('WFQEGPS', schedulers.WFQE_GPS),
]

results = {}
for name, scheduler in instances:
    sim = simulator.simulator(jobs, scheduler,
                              simulator.fixed_estimations(estimations))
    results[name] = {jobid: t for t, jobid in sim}

head_fmt = '\t'.join(['{}'] * (len(instances) + 4))
fmt = '\t'.join(['{}'] + ['{:.2f}'] * (len(instances) + 3))

scheduler_names = [n for n, _ in instances]
header = head_fmt.format('Job', 'Arr.', 'Size', 'Est.', *scheduler_names)
print(header)
print('=' * len(header.expandtabs()))
for (jobid, arrival, d), e in zip(jobs, estimations):
    print(
        fmt.format(jobid, arrival, d, e,
                   *(results[n][jobid] for n in scheduler_names)))
Пример #6
0
 def run_with_estimations(self, jobs, estimations):
     f = simulator.fixed_estimations(estimations)
     result = self.run_jobs(jobs, error=f)
     return list(result)