Hey there,
I am working on assigning teachers to teach a class using intlinprog. The class may start any day of the week, Monday through Friday and there are 2 teachers. My 10 decision variables are Monday_teacher1, Monday_teacher2, Tuesday_teacher1, Tuesday_teacher2, … Friday_teacher2 The course needs to be taught twice and it requires 2 teachers. There may be some logic error here, but I am having trouble figuring it out. I would like to assign either 2 teachers on the same day OR zero teachers for that day. I present sample code which will not provide a feasible solution. I believe I may be able to create a function for this, but do not know how to go about it after reading: https://www.mathworks.com/help/optim/ug/or-instead-of-and-constraints.html
f = repelem(1:5,1,2); %Monday preferred over later in the week
intcon = 1:length(f);A = [-1 -1 0 0 0 0 0 0 0 0; 0 0 -1 -1 0 0 0 0 0 0; 0 0 0 0 -1 -1 0 0 0 0; 0 0 0 0 0 0 -1 -1 0 0; 0 0 0 0 0 0 0 0 -1 -1];b = [-2;-2;-2;-2;-2];Aeq = [1 1 1 1 1 1 1 1 1 1];beq = 4;lb = zeros(1,length(f));ub = ones(1,length(f));[x,fval] = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub);
Thank you for any help you can provide.
Best Answer