removed old code and fixed some comments, for clarification
This commit is contained in:
parent
14a07ff9b2
commit
52615ab663
@ -72,6 +72,7 @@ def get_random_bundles(total_form_items: int, total_bundles: int, bundles: list[
|
||||
else:
|
||||
return get_random_bundles(total_form_items, total_bundles - 1, bundles)
|
||||
|
||||
# legacy solution, keep because it may be usefull
|
||||
def valid_bundle_combinations(total_form_items: int, total_bundles: int, min_bundles: int, bundles: list[Bundle], selected_bundle_combinations: list[list[Bundle]] = []) -> list[list[Bundle]]:
|
||||
if total_bundles < min_bundles:
|
||||
return selected_bundle_combinations
|
||||
|
@ -77,25 +77,8 @@ class LoftService(Base):
|
||||
|
||||
# initiate problem
|
||||
problem = None
|
||||
count = 0
|
||||
|
||||
if bundle_constraint:
|
||||
# # generate valid bundle combinations
|
||||
# bundle_combinations = solver_helper.valid_bundle_combinations(
|
||||
# self.solver_run.total_form_items,
|
||||
# int(bundle_constraint.maximum),
|
||||
# int(bundle_constraint.minimum),
|
||||
# self.solver_run.bundles)
|
||||
|
||||
# # scramble bundle_combinations to ensure distinctiveness for each form generated
|
||||
# random.shuffle(bundle_combinations)
|
||||
|
||||
# for bundles in bundle_combinations:
|
||||
# problem = self.solve(items, bundles)
|
||||
|
||||
# # if optimal solution found, break loop
|
||||
# if LpStatus[problem.status] == 'Optimal':
|
||||
# break
|
||||
bundles_amount = random.randint(int(bundle_constraint.minimum), int(bundle_constraint.maximum))
|
||||
problem = self.recursive_solve(items, bundles_amount)
|
||||
else: # no bundles
|
||||
@ -120,7 +103,7 @@ class LoftService(Base):
|
||||
|
||||
problem = self.solve(items, selected_bundles)
|
||||
|
||||
# if optimal solution found, break loop
|
||||
# if optimal solution found, end recursion
|
||||
if LpStatus[problem.status] == 'Optimal' or attempts == 0:
|
||||
return problem
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user