-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tournament.py
64 lines (58 loc) · 2.43 KB
/
run_tournament.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import json
import os
from pathlib import Path
import time
from utils.runners import run_tournament
RESULTS_DIR = Path("results", time.strftime('%Y%m%d-%H%M%S'))
# create results directory if it does not exist
if not RESULTS_DIR.exists():
RESULTS_DIR.mkdir(parents=True)
# Settings to run a negotiation session:
# You need to specify the classpath of 2 agents to start a negotiation. Parameters for the agent can be added as a dict (see example)
# You need to specify the preference profiles for both agents. The first profile will be assigned to the first agent.
# You need to specify a time deadline (is milliseconds (ms)) we are allowed to negotiate before we end without agreement.
tournament_settings = {
"agents": [
{
"class": "agents.boulware_agent.boulware_agent.BoulwareAgent",
},
{
"class": "agents.conceder_agent.conceder_agent.ConcederAgent",
},
{
"class": "agents.hardliner_agent.hardliner_agent.HardlinerAgent",
},
{
"class": "agents.linear_agent.linear_agent.LinearAgent",
},
{
"class": "agents.random_agent.random_agent.RandomAgent",
},
{
"class": "agents.stupid_agent.stupid_agent.StupidAgent",
},
{
"class": "agents.template_agent.template_agent.TemplateAgent",
"parameters": {"storage_dir": "agent_storage/TemplateAgent"},
},
{
"class": "agents.super_agent.super_agent.SuperAgent",
"parameters": {"storage_dir": "agent_storage/SuperAgent"},
}
],
"profile_sets": [
["domains/domain00/profileA.json", "domains/domain00/profileB.json"],
["domains/domain01/profileA.json", "domains/domain01/profileB.json"],
],
"deadline_time_ms": 10000,
}
# run a session and obtain results in dictionaries
tournament_steps, tournament_results, tournament_results_summary = run_tournament(tournament_settings)
# save the tournament settings for reference
with open(RESULTS_DIR.joinpath("tournament_steps.json"), "w", encoding="utf-8") as f:
f.write(json.dumps(tournament_steps, indent=2))
# save the tournament results
with open(RESULTS_DIR.joinpath("tournament_results.json"), "w", encoding="utf-8") as f:
f.write(json.dumps(tournament_results, indent=2))
# save the tournament results summary
tournament_results_summary.to_csv(RESULTS_DIR.joinpath("tournament_results_summary.csv"))