In IBM's docplex optimization library, can you set an interval_var
's size parameter as a function of another variable? Meaning, say for this example I wanted to make the task size dependent on the skill level of the worker. If the worker has a skill level of 2 and another worker has a skill level of 1, the task is completed twice as fast with the first worker. So the size parameter of the interval_var
for that task should be the task.duration / skill_level
.
It is typically set as an integer value based on the documentation, so I am wondering if there is a workaround to make this possible.
From the example:
Task = (namedtuple("Task", ["name", "duration"]))
TASKS = {Task("masonry", 35),
Task("carpentry", 15),
Task("plumbing", 40),
Task("ceiling", 15),
Task("roofing", 5),
Task("painting", 10),
Task("windows", 5),
Task("facade", 10),
Task("garden", 5),
Task("moving", 5),
}
tasks = {} # dict of interval variable for each house and task
for house in HOUSES:
for task in TASKS:
tasks[(house, task)] = mdl.interval_var(start=period_domain,
end=period_domain,
size=task.duration,
name="house {} task {}".format(house, task))