From 298842222d919241732193b576a15944193acf5c Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Mon, 15 Apr 2024 09:49:59 +0200 Subject: [PATCH] make max_load_person configurable --- magisch_corvee_script.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/magisch_corvee_script.py b/magisch_corvee_script.py index 32ea965..24c6236 100755 --- a/magisch_corvee_script.py +++ b/magisch_corvee_script.py @@ -10,7 +10,11 @@ from pyscipopt import Model, quicksum from typing import Any, Tuple, TypeVar from dataclasses import dataclass, field conf = yaml.safe_load(open('config.yaml', 'r')) -config = conf['config'] + +DEFAULT_CONFIG = { + "max_load_person": 6 +} +config = DEFAULT_CONFIG | conf['config'] config['ignore'].append('') QUADRATIC = False @@ -160,7 +164,7 @@ def scipsol(people: dict[str, Person], tasks: dict[str, TaskConfig]): m.addCons(quicksum(does[(pname, d, task)] for d in ALL_DAYS) <= len(ALL_DAYS) - 1) # max_load_person_total - m.addCons(quicksum([does[(pname, d, task)] * tasks[task].workload for d in ALL_DAYS for task in tasks]) <= 6) + m.addCons(quicksum([does[(pname, d, task)] * tasks[task].workload for d in ALL_DAYS for task in tasks]) <= config['max_load_person']) # hardcode constraint for d, task in person.does: