-
Notifications
You must be signed in to change notification settings - Fork 6
/
main_determinism.py
43 lines (33 loc) · 1.22 KB
/
main_determinism.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
"""
Random version of the framework, used to compare as base line.
"""
from apollo.ApolloContainer import ApolloContainer
from config import APOLLO_ROOT, MAX_ADC_COUNT
from framework.oracles.ViolationTracker import ViolationTracker
from framework.scenario import Scenario
from framework.scenario.ScenarioRunner import ScenarioRunner
from hdmap.MapParser import MapParser
from main_ga import eval_scenario
def main():
mp = MapParser('./data/maps/borregas_ave/base_map.bin')
containers = [ApolloContainer(
APOLLO_ROOT, f'ROUTE_{x}') for x in range(MAX_ADC_COUNT)]
for ctn in containers:
ctn.start_instance()
ctn.start_dreamview()
print(f'Dreamview at http://{ctn.ip}:{ctn.port}')
srunner = ScenarioRunner(containers)
vt = ViolationTracker()
# randomly generate a chromosome
# chromosome = Scenario.get_one()
# parse an existing chromosome (c.json)
chromosome = Scenario.from_json('/home/sora/Desktop/yhuai/DoppelTest/data/c.json')
# Run scenario 5 times and check printed violation.
chromosome.gid = 0
for i in range(5):
chromosome.cid = i
eval_scenario(chromosome)
vt.print()
vt.clear()
if __name__ == '__main__':
main()