-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
48 lines (30 loc) · 1.18 KB
/
main.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
import ray
import os
from navicatGA.base_solver import GenAlgSolver
from pathlib import Path
import sys
path=sys.argv[1]
sys.path.append(str(Path(__file__).parent))
from ucGA.fitness_evaluation.fitness_evaluation import calculate_fitness_uncertainty_aware_parallelized
from optimization import UncAGA_Runner
from config import Config
def main():
#working_dir = "/home/student7/LucaSchaufelberger/MasterThesis/Paper_Data"
working_dir = Path(__file__).parent
python_path = os.environ.get('PYTHONPATH', '')
# Append your working directory to PYTHONPATH
python_path += f":{working_dir}"
runtime_env = {
"env_vars": {"PYTHONPATH": python_path}
}
# Set up parallelization
ray.init(num_cpus=24,runtime_env=runtime_env)
# Modifications to fitness function determination
GenAlgSolver.calculate_fitness = calculate_fitness_uncertainty_aware_parallelized
# load configuration class with parameters
config = Config(path,-2) #exploitative in this case
# run the uncertainty-aware genetic algorithm (UncAGA)
uncaga_runner = UncAGA_Runner(config)
uncaga_runner.run()
if __name__ == "__main__":
main()