This commit is contained in:
Adrian Manteza 2022-03-25 22:02:10 +00:00
parent a8396051b6
commit 5e13db79b6
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ from models.item import Item
from lib.errors.item_generation_error import ItemGenerationError
def build_constraints(solver_run: SolverRun, problem: LpProblem,
items: list[Item], bundles: list[Bundle], selected_items, selected_bundles) -> LpProblem:
items: list[Item], bundles: list[Bundle], selected_items: list[Item], selected_bundles: list[Bundle]) -> LpProblem:
logging.info('Creating Constraints...')
try:

View File

@ -113,7 +113,7 @@ class SolverRun(BaseModel):
else:
return self.items
def select_items_by_percent(self, percent) -> list[Item]:
def select_items_by_percent(self, percent: int) -> list[Item]:
items = self.unbundled_items()
total_items = len(items)
selected_items_amount = round(total_items - (total_items *
@ -121,7 +121,7 @@ class SolverRun(BaseModel):
return random.sample(items, selected_items_amount)
def select_bundles_by_percent(self, percent) -> list[Bundle]:
def select_bundles_by_percent(self, percent: int) -> list[Bundle]:
total_bundles = len(self.bundles)
selected_bundles_amount = round(total_bundles - (total_bundles *
(percent / 100)))