added constant drift incrementing for tcc, tif values
This commit is contained in:
@ -12,3 +12,32 @@ class ObjectiveFunction(BaseModel):
|
||||
tcc_targets: List[Target]
|
||||
objective: AnyStr = "minimize"
|
||||
weight: Dict = {'tif': 1, 'tcc': 1}
|
||||
|
||||
def increment_targets_drift(self,
|
||||
limit: float or bool,
|
||||
all: bool = False,
|
||||
amount: float = 0.1,
|
||||
targets: list[Target] = []) -> bool:
|
||||
if all:
|
||||
for target in self.tif_targets:
|
||||
target.drift = round(target.drift + amount, 2)
|
||||
for target in self.tcc_targets:
|
||||
target.drift = round(target.drift + amount, 2)
|
||||
else:
|
||||
for target in targets:
|
||||
target.drift = round(target.drift + amount, 2)
|
||||
print(self.tif_targets)
|
||||
print(self.tcc_targets)
|
||||
return amount
|
||||
|
||||
def minimum_drift(self) -> float:
|
||||
minimum_drift = 0.0
|
||||
|
||||
for target in self.all_targets():
|
||||
if target.drift < minimum_drift:
|
||||
minimum_drift = target.drift
|
||||
|
||||
return minimum_drift
|
||||
|
||||
def all_targets(self) -> list[Target]:
|
||||
return self.tif_targets + self.tcc_targets
|
||||
|
@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
import logging
|
||||
|
||||
@ -20,6 +20,7 @@ class SolverRun(BaseModel):
|
||||
total_form_items: int
|
||||
total_forms: int = 1
|
||||
theta_cut_score: float = 0.00
|
||||
drift_style: Literal['constant', 'variable'] = 'constant'
|
||||
advanced_options: Optional[AdvancedOptions]
|
||||
engine: str
|
||||
|
||||
|
@ -6,3 +6,4 @@ class Target(BaseModel):
|
||||
theta: float
|
||||
value: float
|
||||
result: Optional[float]
|
||||
drift: float = 0.0
|
||||
|
Reference in New Issue
Block a user