I am working on job shop scheduling problem where i have tasks that are defined as interval variables:
IntervalVar taskInterval = model.NewIntervalVar(start, duration, end, $"interval_{task.WorkOrder_Id}_{task.TaskId}");
Each task can be done on a certain workstation and each work station has its own calendar. As an example workstation A, can have 1 worker assigned today and 2 workers assigned for tomorrow.
List<UserCalendarsDTO> userCalendarsDTOs = userCalendars.Where(x => x.WorkProviderCode == task.UserWorkStation &
x.IdCategory == CalendarGroupCategoryEnum.Available).
OrderBy(x => x.Date).ToList();
//we can only plan
for (int calendarID = 0; calendarID < userCalendarsDTOs.Count() - 1; ++calendarID)
{
//add daily constraints
...
//How to add AddCumulative only for tasks that starts on this day?
}
So today I can only expect 1 task to be worked on at workstation A and tomorrow I want to see 2 tasks.
I was looking at AddCumulative constraint however it looks to me as this can be used only for static collection of IntervalVar. Which is not satisfying since I do not know when the task will start (today or tomorrow, so capacity has to be either 1 or 2).
I have checked question text, however I do not understand the solution there.
Can someone clarify that for me ?
Also AddComultaive in C# is used differently than in python, so any references on that would be much appreciated.
I tried to dynamically add intervals to collection however I did not find any way to do it with any of or tools functions.
PeterK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.