Commit 64f00398 authored by Martin Řepa's avatar Martin Řepa

Log file opened in 'a' mode. Repeat game when iter==1

parent bb814372
......@@ -138,7 +138,7 @@ if __name__ == "__main__":
os.mkdir(base_dir)
log_file = f'{base_dir}/log'
with open(log_file, 'w') as log:
with open(log_file, 'a') as log:
sys.stderr = log
sys.stdout = log
main(experiment_conf, base_dir)
......@@ -138,7 +138,7 @@ if __name__ == "__main__":
os.mkdir(base_dir)
log_file = f'{base_dir}/log'
with open(log_file, 'w') as log:
with open(log_file, 'a') as log:
sys.stderr = log
sys.stdout = log
main(experiment_conf, base_dir)
......
......@@ -64,14 +64,19 @@ def exec_new_setup(conf: RootConfig, folder: str, iterations: int) -> Setup:
cur_epochs = conf.model_conf.defender_conf.nn_conf.epochs
sub_results = []
for i in range(iterations):
os.mkdir(f'{folder}/{i}')
if not os.path.exists(f'{folder}/{i}'):
os.mkdir(f'{folder}/{i}')
print(f'Starting {i+1}. iteration of setup with {cur_epochs} epochs')
game = Game(conf)
start = time.time()
result = game.solve_game()
result = Game(conf).solve_game()
time_taken = time.time() - start
if result.iterations == 1:
i -= 1
continue
attacker_actions = []
for p1_action, p1_prob in zip(result.ordered_actions_p1,
result.probs_p1):
......@@ -168,7 +173,7 @@ if __name__ == "__main__":
os.mkdir(base_dir)
log_file = f'{base_dir}/log'
with open(log_file, 'w') as log:
with open(log_file, 'a') as log:
sys.stderr = log
sys.stdout = log
main(experiment_conf, base_dir)
......
......@@ -199,7 +199,7 @@ if __name__ == "__main__":
os.mkdir(legacy_folder)
log_file = f'{legacy_folder}/log'
with open(log_file, 'w') as log:
with open(log_file, 'a') as log:
sys.stderr = log
sys.stdout = log
main()
......
......@@ -215,7 +215,7 @@ if __name__ == "__main__":
os.mkdir(legacy_folder)
log_file = f'{legacy_folder}/log'
with open(log_file, 'w') as log:
with open(log_file, 'a') as log:
sys.stderr = log
sys.stdout = log
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment