-
Notifications
You must be signed in to change notification settings - Fork 0
/
CompositeCalculation.py
32 lines (26 loc) · 1001 Bytes
/
CompositeCalculation.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
import logging
from KernelCalculator import KernelCalculator
from UtilityCalculation import *
log = logging.getLogger('app' + __name__)
class CompositeUtilityCalculator(UtilityCalculator):
def __init__(self):
self.calculators = [
(1.0, ClusterAnalysisCalculator()),
(0.0, ConvolutionKernelCalculator()),
(0.0, FreeSpaceCalculator()),
(0.0, RoughnessCalculator()),
(0.0, MonotonicityCalculator()),
(0.0, MaxTileCalculator()),
(0.0, Kernel2()),
(0.0, KernelCalculator()),
(0.0, ClusteringCalculator()),
(0.0, MisplacedMaxTilePenalty()),
(0.0, FastSnakeCalculator())
]
log.debug("Composite Calculator.")
def compute_utility(self, grid: FastGrid) -> float:
r = 0.0
for weight, calculator in self.calculators:
if weight != 0.0:
r += weight * calculator.compute_utility(grid)
return r