def eval_args(updated_args, model, tasks, servers, repeat): """ Evaluates the arguments by updating the arguments and then testing the model, tasks, servers and repeat are equalled to the parsed arguments :param updated_args: List of updated args :param model: Value for the model location :param tasks: Value for the number of tasks :param servers: Value for the number of servers :param repeat: Value for the number of repeats """ sys.argv = ['location'] + updated_args args = parse_args() assert args.model == model and args.tasks == tasks and args.servers == servers and args.repeat == repeat, \ f'Expects: {args.model}, {args.tasks}, {args.servers}, {args.repeat}, ' \ f'actual: {model}, {tasks}, {servers}, {repeat}'
price_change=price_change, initial_price=initial_price) for auction_repeat in range(auction_repeats): reset_model(tasks, servers) auction_result = optimal_decentralised_iterative_auction( tasks, servers, time_limit=time_limit) auction_result.pretty_print() repeat_results[f'repeat {auction_repeat}'] = auction_result.store() model_results.append(repeat_results) # Save all of the results to a file with open(filename, 'w') as file: json.dump(model_results, file) print('Finished running') if __name__ == "__main__": args = parse_args() if args.extra == '' or args.extra == 'task mutation': full_task_mutation(get_model(args.model, args.tasks, args.servers)) elif args.extra == 'mutation grid search': mutation_grid_search(get_model(args.model, args.tasks, args.servers)) elif args.extra == 'value only': value_only_mutation(get_model(args.model, args.tasks, args.servers)) elif args.extra == 'dia repeat': dia_repeat(get_model(args.model, args.tasks, args.servers)) else: raise Exception(f'Unknown extra argument: {args.extra}')