minor stying and typing

This commit is contained in:
Khalim Conn-Kowlessar 2026-02-18 12:46:25 +00:00
parent ecaf742a18
commit e0f897bf44
3 changed files with 16 additions and 3 deletions

View file

@ -1,4 +1,5 @@
from mip import Model, xsum, minimize, BINARY, OptimizationStatus
from typing import Mapping
from utils.logger import setup_logger
logger = setup_logger()
@ -13,7 +14,11 @@ class CostOptimiser:
BUFFER = 0.2
def __init__(
self, components, min_gain, verbose=False, allow_slack=True
self,
components: list[list[Mapping[str, int | float | str]]],
min_gain: float | int,
verbose: bool = False,
allow_slack: bool = True
):
self.components = components
self.min_gain = min_gain

View file

@ -1,5 +1,6 @@
from mip import Model, xsum, maximize, BINARY, OptimizationStatus
from utils.logger import setup_logger
from typing import Mapping
logger = setup_logger()
@ -9,7 +10,14 @@ class GainOptimiser:
This class is used to maximise gain, given a constrained cost
"""
def __init__(self, components, max_cost, max_gain, allow_slack=True, verbose=False):
def __init__(
self,
components: list[list[Mapping[str, int | float | str]]],
max_cost: float | int,
max_gain: float | int,
allow_slack: bool = True,
verbose: bool = False
):
"""
This function will try and maximise the gain, given a constrained cost. If we specific a max_gain, then the
optimisation routine is constained to try not to exceed a maximum increase

View file

@ -85,7 +85,7 @@ class StrategicOptimiser:
# min cost
# subject to
#
# gain >= 𝐺
# gain >= G
# cost <= B
# multiple-choice constraints
#