Do a few rounds of capping in the experiment.
@@ -22,28 +22,28 @@ def main():
parser.add_argument('--map_name', default='montlake')
parser.add_argument('--hours', type=int, default=24)
parser.add_argument('--cap_pct', type=int, default=80)
+ parser.add_argument('--rounds', type=int, default=10)
args = parser.parse_args()
print('Simulating {} hours of data/system/scenarios/{}/weekday.bin'.format(args.hours, args.map_name))
- print('')
baseline = abst_helpers.run_sim(args)
- busiest_road, thruput = find_busiest_road(args)
-
- # Cap that road
edits = requests.get(args.api + '/map/get-edits').json()
+
+ for _ in range(args.rounds):
+ print('')
+ print('{} roads have a {}% cap'.format(
+ len(edits['commands']), args.cap_pct))
+ experiment = abst_helpers.run_sim(args, edits=edits)
+ baseline.compare(experiment)
+
+ # Cap the busiest road
+ busiest_road, thruput = find_busiest_road(args)
cmd = requests.get(args.api + '/map/get-edit-road-command',
params={'id': busiest_road}).json()
cmd['ChangeRoad']['new']['access_restrictions']['cap_vehicles_per_hour'] = int(
(args.cap_pct / 100.0) * thruput)
edits['commands'].append(cmd)
- # See what happened
- print('Rerunning with {}% cap on that road'.format(args.cap_pct))
- print('')
- experiment = abst_helpers.run_sim(args, edits=edits)
- busiest_road, thruput = find_busiest_road(args)
- baseline.compare(experiment)
-
# Find the road with the most car traffic in any one hour period
def find_busiest_road(args):
