-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathabstract_optimizer.py
More file actions
31 lines (19 loc) · 895 Bytes
/
abstract_optimizer.py
File metadata and controls
31 lines (19 loc) · 895 Bytes
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
from typing import Set, TypeVar, Optional, Tuple
from .set_info import SetInfo
E = TypeVar('E')
class FuncInfo:
def __init__(self, func_value: float):
self.func_value: float = func_value
class AbstractSubmodularFunctionValueReuse:
def evaluate(self, current_set_info: SetInfo,
previous_func_info: Optional[FuncInfo],
) -> FuncInfo:
raise NotImplementedError('abstract method')
class AbstractOptimizerValueReuse:
def __init__(self, objective_function: AbstractSubmodularFunctionValueReuse, ground_set: Set[E],
debug: bool = True):
self.objective_function: AbstractSubmodularFunctionValueReuse = objective_function
self.ground_set: Set[E] = ground_set
self.debug: bool = debug
def optimize(self) -> Tuple[SetInfo, FuncInfo]:
raise NotImplementedError("abstract method")