Ejemplo n.º 1
0
    os.makedirs(model_dir)

agent = Agent(name, brain, 1, reward_to_go=True, nn_baseline=True, normalize_advantages=True,
              model_save_path='%s/model.ckpt' % model_dir)


machine_configs = [MachineConfig(2, 1, 1) for i in range(machines_number)]
csv_reader = CSVReader(jobs_csv)
jobs_configs = csv_reader.generate(0, jobs_len)

tic = time.time()
algorithm = RandomAlgorithm()
episode = Episode(machine_configs, jobs_configs, algorithm, None)
episode.run()
print('RandomAlgorithm')
print(episode.env.now, time.time() - tic, average_completion(episode), average_slowdown(episode))

tic = time.time()
algorithm = RandomAlgorithm()
episode = Episode(machine_configs, jobs_configs, algorithm, None)
episode.run()
print('RandomAlgorithm')
print(episode.env.now, time.time() - tic, average_completion(episode), average_slowdown(episode))

tic = time.time()
algorithm = RandomAlgorithm()
episode = Episode(machine_configs, jobs_configs, algorithm, None)
episode.run()
print('RandomAlgorithm')
print(episode.env.now, time.time() - tic, average_completion(episode), average_slowdown(episode))
Ejemplo n.º 2
0
              reward_to_go=True,
              nn_baseline=True,
              normalize_advantages=True,
              model_save_path='%s/model.ckpt' % model_dir)

machine_configs = [MachineConfig(64, 1, 1) for i in range(machines_number)]
csv_reader = CSVReader(jobs_csv)
for job_chunk in range(n_job_chunk):
    jobs_configs = csv_reader.generate(job_chunk * jobs_len, jobs_len)

    tic = time.time()
    algorithm = RandomAlgorithm()
    episode = Episode(machine_configs, jobs_configs, algorithm, None)
    episode.run()
    print(episode.env.now,
          time.time() - tic, average_completion(episode),
          average_slowdown(episode))
    agent.log('makespan-random', episode.env.now, agent.global_step)

    tic = time.time()
    algorithm = FirstFitAlgorithm()
    episode = Episode(machine_configs, jobs_configs, algorithm, None)
    episode.run()
    print(episode.env.now,
          time.time() - tic, average_completion(episode),
          average_slowdown(episode))
    agent.log('makespan-ff', episode.env.now, agent.global_step)

    tic = time.time()
    algorithm = Tetris()
    episode = Episode(machine_configs, jobs_configs, algorithm, None)
Ejemplo n.º 3
0
    os.makedirs(model_dir)

agent = Agent(name, brain, 1, reward_to_go=True, nn_baseline=True, normalize_advantages=True,
              model_save_path='%s/model.ckpt' % model_dir)


machine_configs = [MachineConfig(2, 1, 1) for i in range(machines_number)]
csv_reader = CSVReader(jobs_csv)
jobs_configs = csv_reader.generate(0, jobs_len)

tic = time.time()
algorithm = RandomAlgorithm()
episode = Episode(machine_configs, jobs_configs, algorithm, None)
episode.run()
print('RandomAlgorithm')
print(episode.env.now, time.time() - tic, average_completion(episode), average_slowdown(episode))

tic = time.time()
algorithm = RandomAlgorithm()
episode = Episode(machine_configs, jobs_configs, algorithm, None)
episode.run()
print('RandomAlgorithm')
print(episode.env.now, time.time() - tic, average_completion(episode), average_slowdown(episode))

tic = time.time()
algorithm = RandomAlgorithm()
episode = Episode(machine_configs, jobs_configs, algorithm, None)
episode.run()
print('RandomAlgorithm')
print(episode.env.now, time.time() - tic, average_completion(episode), average_slowdown(episode))