forked from alzbetaH/hackathon_group5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
23 lines (18 loc) · 730 Bytes
/
main.py
File metadata and controls
23 lines (18 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from src.costs.base import BaseCost
from src.optimizers import DummyOptimizer
from src.optimizers.torch_optimizer import TorchOptimizer
from src.data import Simulation, CoilConfig
import numpy as np
def run(
simulation: Simulation, cost_function: BaseCost, timeout: int = 100
) -> 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 = TorchOptimizer(cost_function=cost_function)
best_coil_config = optimizer.optimize(simulation=simulation)
return best_coil_config