more extensive logging
This commit is contained in:
@ -17,6 +17,7 @@ def build_constraints(solver_run, problem, items, bundles):
|
||||
max = constraint.maximum
|
||||
|
||||
if attribute.type == 'metadata':
|
||||
logging.info('Metadata Constraint Generating...')
|
||||
con = dict(zip([item.id for item in solver_run.items],
|
||||
[item.attribute_exists(attribute)
|
||||
for item in solver_run.items]))
|
||||
@ -27,10 +28,9 @@ def build_constraints(solver_run, problem, items, bundles):
|
||||
* items[item.id]
|
||||
for item in solver_run.items]) <= round(total_form_items * (max / 100)), f'{attribute.id} - {attribute.value} - max'
|
||||
elif attribute.type == 'bundle':
|
||||
logging.info('Bundles Constraint Generating...')
|
||||
# TODO: account for many different bundle types, since the id condition in L33 could yield duplicates
|
||||
if solver_run.bundles != None:
|
||||
# total_bundles = randint(constraint.minimum, constraint.maximum)
|
||||
# selected_bundles = sample(solver_run.bundles, total_bundles, solver_run.bundles)
|
||||
total_bundle_items = 0
|
||||
selected_bundles = get_random_bundles(solver_run.total_form_items, solver_run.bundles, int(constraint.minimum), int(constraint.maximum))
|
||||
|
||||
@ -62,6 +62,7 @@ def get_random_bundles(total_form_items: int, bundles: list[Bundle], min: int ,
|
||||
selected_bundles = None
|
||||
total_bundle_items = 0
|
||||
total_bundles = randint(min, max)
|
||||
logging.info(f'Selecting Bundles (total of {total_bundles})...')
|
||||
|
||||
while found_bundles == False:
|
||||
selected_bundles = sample(bundles, total_bundles)
|
||||
|
Reference in New Issue
Block a user