forked from mvrcii/hackathon_group1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (18 loc) · 688 Bytes
/
main.py
File metadata and controls
21 lines (18 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from src.costs.base import BaseCost
from src.data import Simulation, CoilConfig
from src.optimizers.optuna_optimizer import OptunaOptimizer
def run(simulation: Simulation,
cost_function: BaseCost,
timeout: int = 300) -> CoilConfig:
"""
Main function to run the optimization, returns the best coil configuration
Args:
simulation: Simulation object
cost_function: Cost function object
timeout: Time (in seconds) after which the evaluation script will be terminated
"""
optimizer = OptunaOptimizer(
cost_function=cost_function,
timeout=timeout
)
return optimizer.optimize(simulation)