make max_load_person configurable

This commit is contained in:
Yorick van Pelt 2024-04-15 09:49:59 +02:00
parent 19d9a9f6e8
commit 298842222d
No known key found for this signature in database
GPG Key ID: D8D3CC6D951384DE

View File

@ -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: