-
Notifications
You must be signed in to change notification settings - Fork 0
/
reformulate_keren.py
42 lines (40 loc) · 1.87 KB
/
reformulate_keren.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
import os
if __name__ == '__main__':
"""experiments_path = 'keren_grd/aaai_24-benchmarks/'
for domain in os.listdir(experiments_path):
for problem in os.listdir(f'{experiments_path}/{domain}/'):
hyps_file = open(f'{experiments_path}/{domain}/{problem}/hyps.dat')
text = ''.join(hyps_file.readlines())
hyps_file.close()
text = text.replace('(and ','').replace('))',')').replace(') (', '),(')
hyps_file = open(f'{experiments_path}/{domain}/{problem}/hyps.dat', 'w')
hyps_file.write(text)
hyps_file.close()
template = open(f'{experiments_path}/{domain}/{problem}/template.pddl')
ttext = ''.join(template.readlines())
template.close()
ttext = ttext.replace('<hypothesis>','<HYPOTHESIS>')
template = open(f'{experiments_path}/{domain}/{problem}/template.pddl', 'w+')
template.write(ttext)
template.close()"""
"""experiments_path = 'keren_grd/aaai_24-benchmarks/grid-navigation/'
for problem in os.listdir(experiments_path):
domain = open(f'{experiments_path}{problem}/domain.pddl')
text = ''.join(domain.readlines())
domain.close()
text = text.replace('(:types\n','(:types\nplace locatable - object\n')
domain = open(f'{experiments_path}{problem}/domain.pddl','w+')
domain.write(text)
domain.close()"""
experiments_path = 'keren_grd/aaai_24-benchmarks/logistics/'
for problem in os.listdir(experiments_path):
domain = open(f'{experiments_path}{problem}/domain.pddl')
text = []
for line in domain:
if not '=' in line:
text.append(line)
text = ''.join(text)
domain.close()
domain = open(f'{experiments_path}{problem}/domain.pddl', 'w+')
domain.write(text)
domain.close()