-
Notifications
You must be signed in to change notification settings - Fork 0
/
batch-run.py
41 lines (34 loc) · 1.17 KB
/
batch-run.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
from mesa.batchrunner import BatchRunner
from mesa.datacollection import DataCollector
from auctions.agents import Auctioneer, EarlyBidder, SniperBidder
from auctions.model import AuctionHouse
import pandas as pd
"""
When running batch-run, comment out all print statements in model.py and agents.py
as this will drastically reduce the computation time.
This program is used to generate the datasets used for analysis.
"""
params = {
"snipers": 7,
"earlyBidders": 7,
"maxValueStandardDeviation": 250,
"bidProba": 0.75,
"watchProba": 0.75,
"bidTimeframe": 20,
"auctionLength": 100
}
br = BatchRunner(
AuctionHouse,
fixed_parameters=params,
iterations=10000,
max_steps=100,
model_reporters={"Data Collector": lambda m: m.datacollector},
)
br.run_all()
br_df = br.get_model_vars_dataframe()
br_step_data = pd.DataFrame()
for i in range(len(br_df["Data Collector"])):
if isinstance(br_df["Data Collector"][i], DataCollector):
i_run_data = br_df["Data Collector"][i].get_model_vars_dataframe()
br_step_data = br_step_data.append(i_run_data, ignore_index=True)
br_step_data.to_csv("data/same_sniper_early_bid increase.csv")