SlideShare uma empresa Scribd logo
1 de 10
Baixar para ler offline
Upper Division Mathematics Course Schedulings
Chalmer Tomlinson
Tanawat Trakoolthai
Brian Tran
Mohsen Gol shiri Esfahani
March 11, 2015
Abstract
There are currently 59 upper division mathematics courses being oered for the
2015-2016 school year at Cal State Super Happy Fun Time. Tragically however, there
are only 18 faculty members available to teach these courses; and each with their
own individual preferences and constraints. Here at Make Everyone Happy Inc. we
have developed a exible program to handle the complex constraints placed upon
the scheduling of these courses and optimally solve the assignment problem. We had
tried many dierent Linear Programming techniques before nally concluding that our
unique algorithm generates the maximum amount of happy points. In this report, we
examine the results and methods.
1
1 Setting up the Model
From the onset, we knew wanted to constrain the variables to be binary. To do this, we
created a set of dummy variables for each professor to represent the second class that they
would teach and a set for courses that were nonexistent. We then converted our table of
color-coded preferences into numerical happiness values using excel. This allowed us to
model our objective function as a maximizing happiness function. Thus, our objective
function looks like,
Max z =
n
i=1
m
j=1
cij · xij
where
xij = Professor i assigned to class j
cij = Happiness value for professor i assigned to class j
We then created the standard sparse matrix in order to model the constraints for a typical
assignment problem. For the No Two of the Same Courses' constraint, we grouped the
courses, which repeated in the quarter, by the professor and their dummy and set the bounds
to 1. Since the variables are binary, this ensured that only one class from each repeating
group would be taught from that professor. And as for the No Two Dierent Courses
constraint, we rst decided to consider the professors who were only okay with teaching
two dierent courses as not okay. We reasoned that if a feasible solution could be obtained
without requiring these professors to teach two dierent courses, and if every basic variables'
coecient was at least 3, then we would have arrived at an optimal solution.
Next, we created a set of auxiliary variables for every professor not willing to teach two
dierent classes. We grouped the courses that did not repeat into one constraint and set it to
be less than or equal to one of the auxiliary variables y. Then, for the repeating courses, we
grouped the professor and their dummy's courses into individual constraints and set them
to be less than or equal to M · y for each individual set of repeating courses. Then we set
the sum of the y variables to one in order to restrict the class assignments. And nally, after
running our algorithm for one quarter, we would place restrictions on the following quarter
by xing the professors who need to teach their sequenced courses. The results were then
calculated in MATLAB and tabulated as seen in Table 1.
2
Note: There exists multiple optimal solutions. For our initial results, professor 15 was not
assigned any courses for the whole year. We then split one of the courses that was not in a
sequence and assigned it to professor 15 by hand. This kept our happiness level consistent
and did not conict with any constraints. It should also be noted that our algorithm has
found a feasible solution in each case with the maximum amount of happiness points every
time. This tells us that the model worked and we have found an optimal solution for every
quarter.
2 External Report
Assigning professors sections to teach based on their personal preferences may seem like a
simple task on paper; but like many things in life, it can be made much more complicated
(and more fun) by mathematical modelling. A typical scheduling problem was given to our
company Make Everyone Happy, Inc. in which we were tasked to assign 18 mathematics
professors a variety of courses spanning across three quarters. The restrictions placed upon
us were as follows:
1. Every course has exactly one professor
2. Every professor has a maximum of two courses
3. Any professor teaching a part of a sequence must teach the second part in the following
quarter
4. A subset of professors cannot teach two of the same classes
5. A subset of professors cannot teach two dierent classes
Using these restrictions, we were able to rst model the problem into a pseudocode and then
rewrite it into MATLAB in order to solve the assignment. Based on our ndings and the
computations of our algorithm, we have determined an optimal solution to the scheduling
problem. The results are presented in Table 1. The table represents our recommendation
for assigning classes and making everyone as happy as possible. There are alternate optimal
solutions that may also be explored but it was unnecessary for our report. Thus this stands
as our best recommendation for the scheduling coordinator at Cal State Super Happy Fun
Time. The method we used to create our model is a blend of a traditional Assignment
Problem techniques, Binary Integer Programming, Auxiliary Variable techniques, and some
Good `ol Fashioned Linear Programming techniques. A printout of the coding used for our
3
algorithm is included in this report for the readers' pleasure.
Table 1: Optimal Solution for the 2015-2016 School Year
Fall 2015 Professor Winter 2016 Professor Spring 2016 Professor
MATH 113 Gonzalez MATH 113 Gonzalez MATH 136 Liu
MATH 136 Lewis MATH 136 Vinh MATH 149 Gonzalez
MATH 149 Gutierrez MATH 162 Chen MATH 151 Ayala
MATH 149 Gutierrez MATH 162 O'neill MATH 163 Chen
MATH 162 O'neill MATH 162 Tanaka MATH 163 O'Neill
MATH 162 Gupta MATH 163 Gupta MATH 163 Tanaka
MATH 180 Liu MATH 163 O'neill MATH 203 Lewis
MATH 202 Liu MATH 202 Liu MATH 203 Liu
MATH 202 Lewis MATH 202 Lewis MATH 212 Gutierrez
MATH 202 Martinez MATH 203 Martinez MATH 238 Martinez
MATH 303 Gupta MATH 203 Liu MATH 247 Lee
MATH 336 Harris MATH 203 Lewis MATH 261 Gonzalez
MATH 336 Harris MATH 211 Gutierrez MATH 336 Harris
MATH 368 Lee MATH 260 Gonzalez MATH 336 Rivas
MATH 368 Lee MATH 304 Gupta MATH 408 Luong
MATH 391 O'neill MATH 336 Harris MATH 576 Smith
MATH 425 Luong MATH 336 Harris
MATH 460 Ayala MATH 369 Lee
MATH 516 Richards MATH 369 Lee
MATH 576 Gonzalez MATH 407 Luong
MATH 448 Ayala
MATH 516 Richards
MATH 576 Smith
4
3 Internal Report
The approach we took to this problem had not changed since we had started the project.
We decided early on to use binary variables and dummies of the professors/classes, since it
seemed the most clear and easy way to model the scheduling problem. The techniques for
typical Assignment Problems were useful in setting up a few of the constraints as a sparse
matrix. However, our rst diculties were in modelling the No Two Dierent Classes
constraints for certain professors. Because a few of the professors were only okay with
teaching two dierent courses, it was dicult for us to weight their preferences into the
constraints. We tried to scale their variables, but none of those techniques worked. We
eventually opted on considering their preferences as Never.
We were originally going to compare the dierences between Never and Great, but we
later reasoned out that if we can get a feasible solution where every basic variables' happiness
coecient was greater than or equal to 3 then the solution is optimal. Hence there would
be no need to recalculate the scheduling.
In order to model these complex constraints. we eventually settled on adding in auxiliary
variables. This, in turn, complicated our coding immensely in MATLAB. However, with
perseverance and hard work (and one talented programmer), we were able to write our
model as a exible algorithm to solve the problem.
The next biggest hurdle we faced was coding the restriction such that if a professor
taught the rst part of a sequence, then they have to teach the second part of the sequence.
A complex algorithm had to be written in order to force a professor (or their dummy) to
teach any section of the second part of the sequence.
As we were working through each quarter, it became clear that our algorithm would
consider the basic variables in the order in which they appeared. This would result in an
optimal solution where the bottom of the list of professors were given a lower priority than
the rest. For example, in our tables, professor 15 would not be assigned any real classes for
the whole year. This was circumvented by manually assigning a class to professor 15 in the
Spring Quarter. We searched through the list of preferred classes for professor 15 and picked
a class where the happiness value was at least 3. Then we searched for the professor who
was currently teaching that class and switched it to professor 15; so long as it didn't conict
with any other restrictions. It is interesting to consider what would happen if we randomize
the order of professors every quarter and/or if we revised our code to address this slight bias:
5
And if we would arrive at a dierent optimal solution that generated the same happiness
level with dierent basic variables.
4 Appendix
Figure 1: Excel Spreadsheet for the Constraints
In Figure 1, the cells with zeroes and ones represent the subset of professors with tighter
restrictions than the rest.
6
1
Table of Contents
........................................................................................................................................ 1
objective function ................................................................................................................ 1
----- constraints ------ equal to ------ ........................................................................................ 2
----- constraints ------ less than or equal to ------ ....................................................................... 2
classes = 23;
% indexes of professors (only first index) that wil not teach two of the
% same UD
no2same = [1,3,31,33];
% indexes of professors (only first index) that wil not teach two different
% UD in the same quarter
no2diff = [1, 3, 9, 11, 13, 21, 23, 29, 31, 33, 35];
% first index of repeated classes
sameclass = [3,6,8,10,16,18];
% different classes
diffclass = [1,2,13,14,15,20,21,22,23];
% index of class if 3 sections exist
threepeat = [3,10];
% professor i in the middle of a sequence j
prof_seq = [13, 4, 10, 9, 12, 8, 4];
seq = [6, 6, 10, 10, 10, 18, 15];
variables = 1296 + size(no2diff,2) * (1 + size(sameclass,2));
objective function
% initialize coefficient vector for objective function
f = zeros(variables,1);
% Import the data
[~, ~, raw] = xlsread('C:Usersb_ran_000DesktopSpreadsheet A (Autosaved).xlsm','
% Create output matrix
data = reshape([raw{:}],size(raw));
% Populate f
for i = 1:36
for j = 1:36
f((i - 1)*36 + j) = - data(i,j);
end
2
end
% Clear temporary variables
clearvars data raw;
----- constraints ------ equal to ------
% initialize coefficinet matrix Aeq and constraint vector beq
Aeq = zeros(72,variables);
beq = zeros(72,1);
% constraint - one teacher can teach one class
for i = 1:36
for j = 1:36
Aeq(i,(i - 1) * 36 + j) = 1;
end
beq(i) = 1;
end
% constraint - one class can have only one teacher
for i = 1:36
for j = 1:36
Aeq(i + 36,(j - 1) * 36 + i) = 1;
end
beq(i + 36) = 1;
end
% constraints for auxiliary variables used below
for i = 1:size(no2diff,2)
for j = 1:(size(sameclass,2) + 1)
Aeq(i + 72, j + 1296 + (i-1) * (size(sameclass,2) + 1)) = 1;
end
beq(i + 72) = 1;
end
for i = 1:size(prof_seq,2)
Aeq( i + 72 + size(no2diff,2), seq(i) + (prof_seq(i) - 1) * 36) = 1;
Aeq( i + 72 + size(no2diff,2), seq(i) + 1 + (prof_seq(i) - 1) * 36) = 1;
Aeq( i + 72 + size(no2diff,2), seq(i) + prof_seq(i) * 36) = 1;
Aeq( i + 72 + size(no2diff,2), seq(i) + 1 + prof_seq(i) * 36) = 1;
if any(seq(i) == threepeat) == 1
Aeq( i + 72 + size(no2diff,2), seq(i) + 2 + (prof_seq(i) - 1) * 36) = 1
Aeq( i + 72 + size(no2diff,2), seq(i) + 2 + prof_seq(i) * 36) = 1;
end
beq( i + 72 + size(no2diff,2))=1;
if prof_seq(i) == 8
beq( i + 72 + size(no2diff,2))=2;
end
end
----- constraints ------ less than or equal to ------
% initialize coefficinet matrix A and constraint vector b
3
A = zeros(72,variables);
b = zeros(72,1);
% constraint - no two of the same Upper Division in same quarter
% no repeats of class i for prof j
for i = 1:size(no2same,2)
for j = 1:size(sameclass,2)
A( size(sameclass,2) * (i-1) + j, sameclass(j) + (no2same(i) - 1) * 36) = 1
A( size(sameclass,2) * (i-1) + j, sameclass(j) + 1 + (no2same(i) - 1) * 36)
A( size(sameclass,2) * (i-1) + j, sameclass(j) + no2same(i) * 36) = 1;
A( size(sameclass,2) * (i-1) + j, sameclass(j) + 1 + no2same(i) * 36) = 1;
if any(sameclass(j) == threepeat) == 1
A( size(sameclass,2) * (i-1) + j, sameclass(j) + 2 + (no2same(i) - 1) *
A( size(sameclass,2) * (i-1) + j, sameclass(j) + 2 + no2same(i) * 36) =
end
b( size(sameclass,2) * (i-1) + j)=1;
end
end
% constraint - no two different Upper Division in same quarter
for i = 1:size(no2diff,2)
for j = 1:size(diffclass,2)
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1,
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1,
end
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1, 1 +
b( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1) = 0
for k = 1:size(sameclass,2)
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1
if any(sameclass(k) == threepeat) == 1
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1)
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1)
end
A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1
b( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1
end
end
%%[x , fval] = linprog(f,A,b,Aeq,beq,lb,ub);
%%intcon = 1:1296;
%%x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub);
[x , fval] = bintprog(f, A, b, Aeq, beq);
optimal = vec2mat(x,36);
Maximum number of iterations for LP Relaxation exceeded; increase options.M
4
Published with MATLAB® R2013b

Mais conteúdo relacionado

Mais procurados

G6 m4-g-lesson 24-t
G6 m4-g-lesson 24-tG6 m4-g-lesson 24-t
G6 m4-g-lesson 24-t
mlabuski
 
G6 m4-g-lesson 25-t
G6 m4-g-lesson 25-tG6 m4-g-lesson 25-t
G6 m4-g-lesson 25-t
mlabuski
 
G6 m4-g-lesson 27-s
G6 m4-g-lesson 27-sG6 m4-g-lesson 27-s
G6 m4-g-lesson 27-s
mlabuski
 
G6 m4-g-lesson 27-t
G6 m4-g-lesson 27-tG6 m4-g-lesson 27-t
G6 m4-g-lesson 27-t
mlabuski
 
G6 m1-a-lesson 3-t
G6 m1-a-lesson 3-tG6 m1-a-lesson 3-t
G6 m1-a-lesson 3-t
mlabuski
 
G6 m1-a-lesson 8-t
G6 m1-a-lesson 8-tG6 m1-a-lesson 8-t
G6 m1-a-lesson 8-t
mlabuski
 

Mais procurados (15)

G6 m4-g-lesson 24-t
G6 m4-g-lesson 24-tG6 m4-g-lesson 24-t
G6 m4-g-lesson 24-t
 
G6 m4-g-lesson 25-t
G6 m4-g-lesson 25-tG6 m4-g-lesson 25-t
G6 m4-g-lesson 25-t
 
Math 3 Student Orientation Presentation
Math 3 Student Orientation PresentationMath 3 Student Orientation Presentation
Math 3 Student Orientation Presentation
 
Math 1 Orientation Presentation
Math 1 Orientation PresentationMath 1 Orientation Presentation
Math 1 Orientation Presentation
 
Problem Solving and Reasoning
Problem Solving and ReasoningProblem Solving and Reasoning
Problem Solving and Reasoning
 
Presentation9 lab math seidman
Presentation9  lab math seidmanPresentation9  lab math seidman
Presentation9 lab math seidman
 
G6 m4-g-lesson 27-s
G6 m4-g-lesson 27-sG6 m4-g-lesson 27-s
G6 m4-g-lesson 27-s
 
Math for biotechnology bio link-fellows2012
Math for biotechnology bio link-fellows2012Math for biotechnology bio link-fellows2012
Math for biotechnology bio link-fellows2012
 
9th Grade Chapter 1 Lesson 1 pgs.3-5
9th Grade Chapter 1 Lesson 1 pgs.3-59th Grade Chapter 1 Lesson 1 pgs.3-5
9th Grade Chapter 1 Lesson 1 pgs.3-5
 
Arithmetic lp
Arithmetic lpArithmetic lp
Arithmetic lp
 
G6 m4-g-lesson 27-t
G6 m4-g-lesson 27-tG6 m4-g-lesson 27-t
G6 m4-g-lesson 27-t
 
G6 m1-a-lesson 3-t
G6 m1-a-lesson 3-tG6 m1-a-lesson 3-t
G6 m1-a-lesson 3-t
 
Vedic addition
Vedic additionVedic addition
Vedic addition
 
G6 m1-a-lesson 8-t
G6 m1-a-lesson 8-tG6 m1-a-lesson 8-t
G6 m1-a-lesson 8-t
 
Mathematics for Grade 5, Topic: Pie Graph
Mathematics for Grade 5, Topic: Pie GraphMathematics for Grade 5, Topic: Pie Graph
Mathematics for Grade 5, Topic: Pie Graph
 

Destaque

Sistema circulatório
Sistema circulatórioSistema circulatório
Sistema circulatório
Tânia Reis
 

Destaque (16)

Otimização Estática
Otimização EstáticaOtimização Estática
Otimização Estática
 
Week 4 class 2 - di ruth
Week 4   class 2 - di ruth Week 4   class 2 - di ruth
Week 4 class 2 - di ruth
 
Week 4 class 1 di ruth
Week 4 class 1 di ruthWeek 4 class 1 di ruth
Week 4 class 1 di ruth
 
Week 1 21 c literacies
Week 1   21 c literaciesWeek 1   21 c literacies
Week 1 21 c literacies
 
Objetivos Ciências Naturais - Teste nº4
Objetivos Ciências Naturais - Teste nº4Objetivos Ciências Naturais - Teste nº4
Objetivos Ciências Naturais - Teste nº4
 
Week 5 class 2 - vocabulary
Week 5   class 2 - vocabulary Week 5   class 2 - vocabulary
Week 5 class 2 - vocabulary
 
History of fashion 1900-1913
History of fashion 1900-1913History of fashion 1900-1913
History of fashion 1900-1913
 
Chapter 20 ppt
Chapter 20 pptChapter 20 ppt
Chapter 20 ppt
 
US History Chapter 12
US History Chapter 12US History Chapter 12
US History Chapter 12
 
Irena Sendler, Madre De Los Niños Del Holocausto
Irena Sendler, Madre De Los Niños Del HolocaustoIrena Sendler, Madre De Los Niños Del Holocausto
Irena Sendler, Madre De Los Niños Del Holocausto
 
Week 5 class 1 - word study - spelling and grammar
Week 5   class 1 - word study - spelling and grammarWeek 5   class 1 - word study - spelling and grammar
Week 5 class 1 - word study - spelling and grammar
 
Ch. 14, Section 2- Age of Railroads
Ch. 14, Section 2- Age of RailroadsCh. 14, Section 2- Age of Railroads
Ch. 14, Section 2- Age of Railroads
 
Chapter 14 powerpoint
Chapter 14 powerpointChapter 14 powerpoint
Chapter 14 powerpoint
 
module bm bahagian 2
module bm bahagian 2module bm bahagian 2
module bm bahagian 2
 
Sejarah tahun 5 identiti negara bendera kebangsaan
Sejarah tahun 5 identiti negara bendera kebangsaanSejarah tahun 5 identiti negara bendera kebangsaan
Sejarah tahun 5 identiti negara bendera kebangsaan
 
Sistema circulatório
Sistema circulatórioSistema circulatório
Sistema circulatório
 

Semelhante a Project Final

Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docxMath 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
andreecapon
 
Assingment Problem3
Assingment Problem3Assingment Problem3
Assingment Problem3
Evren E
 
Logarithms and logarithmic functions
Logarithms and logarithmic functionsLogarithms and logarithmic functions
Logarithms and logarithmic functions
Jessica Garcia
 
Logarithms and logarithmic functions
Logarithms and logarithmic functionsLogarithms and logarithmic functions
Logarithms and logarithmic functions
Jessica Garcia
 
G6 m4-h-lesson 31-t
G6 m4-h-lesson 31-tG6 m4-h-lesson 31-t
G6 m4-h-lesson 31-t
mlabuski
 
Intro to e as t-tle
Intro to e as t-tleIntro to e as t-tle
Intro to e as t-tle
judeweavers
 

Semelhante a Project Final (20)

Optimization Final Report
Optimization Final ReportOptimization Final Report
Optimization Final Report
 
Solving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson planSolving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson plan
 
Satisfaction And Its Application To Ai Planning
Satisfaction And Its Application To Ai PlanningSatisfaction And Its Application To Ai Planning
Satisfaction And Its Application To Ai Planning
 
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docxMath 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
Math 009 Final Examination Spring, 2015 1 Answer Sheet M.docx
 
PAM Maths
PAM MathsPAM Maths
PAM Maths
 
Assingment Problem3
Assingment Problem3Assingment Problem3
Assingment Problem3
 
Algebra Is Weightlifting For The Brain
Algebra Is  Weightlifting For The  BrainAlgebra Is  Weightlifting For The  Brain
Algebra Is Weightlifting For The Brain
 
HSC Chemistry Revision Module 5.pptx
HSC Chemistry Revision Module 5.pptxHSC Chemistry Revision Module 5.pptx
HSC Chemistry Revision Module 5.pptx
 
ID Unit Report 3
ID Unit Report 3ID Unit Report 3
ID Unit Report 3
 
Gre 1 algebra (book)
Gre 1 algebra (book)Gre 1 algebra (book)
Gre 1 algebra (book)
 
GRE_Algebra_Strategy_Guide
GRE_Algebra_Strategy_GuideGRE_Algebra_Strategy_Guide
GRE_Algebra_Strategy_Guide
 
Logarithms and logarithmic functions
Logarithms and logarithmic functionsLogarithms and logarithmic functions
Logarithms and logarithmic functions
 
Logarithms and logarithmic functions
Logarithms and logarithmic functionsLogarithms and logarithmic functions
Logarithms and logarithmic functions
 
Combining the analytical hierarchy
Combining the analytical hierarchyCombining the analytical hierarchy
Combining the analytical hierarchy
 
G6 m4-h-lesson 31-t
G6 m4-h-lesson 31-tG6 m4-h-lesson 31-t
G6 m4-h-lesson 31-t
 
Visual Presentation in Algebra for First Year Students
Visual Presentation in Algebra for First Year StudentsVisual Presentation in Algebra for First Year Students
Visual Presentation in Algebra for First Year Students
 
Visual Presentation in Algebra for First Year Students
Visual Presentation in Algebra for First Year StudentsVisual Presentation in Algebra for First Year Students
Visual Presentation in Algebra for First Year Students
 
Visual Presentation in Developing Skills in Algebra for First Year Students
Visual Presentation in Developing Skills in Algebra for First Year StudentsVisual Presentation in Developing Skills in Algebra for First Year Students
Visual Presentation in Developing Skills in Algebra for First Year Students
 
Bus 308
Bus 308Bus 308
Bus 308
 
Intro to e as t-tle
Intro to e as t-tleIntro to e as t-tle
Intro to e as t-tle
 

Project Final

  • 1. Upper Division Mathematics Course Schedulings Chalmer Tomlinson Tanawat Trakoolthai Brian Tran Mohsen Gol shiri Esfahani March 11, 2015 Abstract There are currently 59 upper division mathematics courses being oered for the 2015-2016 school year at Cal State Super Happy Fun Time. Tragically however, there are only 18 faculty members available to teach these courses; and each with their own individual preferences and constraints. Here at Make Everyone Happy Inc. we have developed a exible program to handle the complex constraints placed upon the scheduling of these courses and optimally solve the assignment problem. We had tried many dierent Linear Programming techniques before nally concluding that our unique algorithm generates the maximum amount of happy points. In this report, we examine the results and methods. 1
  • 2. 1 Setting up the Model From the onset, we knew wanted to constrain the variables to be binary. To do this, we created a set of dummy variables for each professor to represent the second class that they would teach and a set for courses that were nonexistent. We then converted our table of color-coded preferences into numerical happiness values using excel. This allowed us to model our objective function as a maximizing happiness function. Thus, our objective function looks like, Max z = n i=1 m j=1 cij · xij where xij = Professor i assigned to class j cij = Happiness value for professor i assigned to class j We then created the standard sparse matrix in order to model the constraints for a typical assignment problem. For the No Two of the Same Courses' constraint, we grouped the courses, which repeated in the quarter, by the professor and their dummy and set the bounds to 1. Since the variables are binary, this ensured that only one class from each repeating group would be taught from that professor. And as for the No Two Dierent Courses constraint, we rst decided to consider the professors who were only okay with teaching two dierent courses as not okay. We reasoned that if a feasible solution could be obtained without requiring these professors to teach two dierent courses, and if every basic variables' coecient was at least 3, then we would have arrived at an optimal solution. Next, we created a set of auxiliary variables for every professor not willing to teach two dierent classes. We grouped the courses that did not repeat into one constraint and set it to be less than or equal to one of the auxiliary variables y. Then, for the repeating courses, we grouped the professor and their dummy's courses into individual constraints and set them to be less than or equal to M · y for each individual set of repeating courses. Then we set the sum of the y variables to one in order to restrict the class assignments. And nally, after running our algorithm for one quarter, we would place restrictions on the following quarter by xing the professors who need to teach their sequenced courses. The results were then calculated in MATLAB and tabulated as seen in Table 1. 2
  • 3. Note: There exists multiple optimal solutions. For our initial results, professor 15 was not assigned any courses for the whole year. We then split one of the courses that was not in a sequence and assigned it to professor 15 by hand. This kept our happiness level consistent and did not conict with any constraints. It should also be noted that our algorithm has found a feasible solution in each case with the maximum amount of happiness points every time. This tells us that the model worked and we have found an optimal solution for every quarter. 2 External Report Assigning professors sections to teach based on their personal preferences may seem like a simple task on paper; but like many things in life, it can be made much more complicated (and more fun) by mathematical modelling. A typical scheduling problem was given to our company Make Everyone Happy, Inc. in which we were tasked to assign 18 mathematics professors a variety of courses spanning across three quarters. The restrictions placed upon us were as follows: 1. Every course has exactly one professor 2. Every professor has a maximum of two courses 3. Any professor teaching a part of a sequence must teach the second part in the following quarter 4. A subset of professors cannot teach two of the same classes 5. A subset of professors cannot teach two dierent classes Using these restrictions, we were able to rst model the problem into a pseudocode and then rewrite it into MATLAB in order to solve the assignment. Based on our ndings and the computations of our algorithm, we have determined an optimal solution to the scheduling problem. The results are presented in Table 1. The table represents our recommendation for assigning classes and making everyone as happy as possible. There are alternate optimal solutions that may also be explored but it was unnecessary for our report. Thus this stands as our best recommendation for the scheduling coordinator at Cal State Super Happy Fun Time. The method we used to create our model is a blend of a traditional Assignment Problem techniques, Binary Integer Programming, Auxiliary Variable techniques, and some Good `ol Fashioned Linear Programming techniques. A printout of the coding used for our 3
  • 4. algorithm is included in this report for the readers' pleasure. Table 1: Optimal Solution for the 2015-2016 School Year Fall 2015 Professor Winter 2016 Professor Spring 2016 Professor MATH 113 Gonzalez MATH 113 Gonzalez MATH 136 Liu MATH 136 Lewis MATH 136 Vinh MATH 149 Gonzalez MATH 149 Gutierrez MATH 162 Chen MATH 151 Ayala MATH 149 Gutierrez MATH 162 O'neill MATH 163 Chen MATH 162 O'neill MATH 162 Tanaka MATH 163 O'Neill MATH 162 Gupta MATH 163 Gupta MATH 163 Tanaka MATH 180 Liu MATH 163 O'neill MATH 203 Lewis MATH 202 Liu MATH 202 Liu MATH 203 Liu MATH 202 Lewis MATH 202 Lewis MATH 212 Gutierrez MATH 202 Martinez MATH 203 Martinez MATH 238 Martinez MATH 303 Gupta MATH 203 Liu MATH 247 Lee MATH 336 Harris MATH 203 Lewis MATH 261 Gonzalez MATH 336 Harris MATH 211 Gutierrez MATH 336 Harris MATH 368 Lee MATH 260 Gonzalez MATH 336 Rivas MATH 368 Lee MATH 304 Gupta MATH 408 Luong MATH 391 O'neill MATH 336 Harris MATH 576 Smith MATH 425 Luong MATH 336 Harris MATH 460 Ayala MATH 369 Lee MATH 516 Richards MATH 369 Lee MATH 576 Gonzalez MATH 407 Luong MATH 448 Ayala MATH 516 Richards MATH 576 Smith 4
  • 5. 3 Internal Report The approach we took to this problem had not changed since we had started the project. We decided early on to use binary variables and dummies of the professors/classes, since it seemed the most clear and easy way to model the scheduling problem. The techniques for typical Assignment Problems were useful in setting up a few of the constraints as a sparse matrix. However, our rst diculties were in modelling the No Two Dierent Classes constraints for certain professors. Because a few of the professors were only okay with teaching two dierent courses, it was dicult for us to weight their preferences into the constraints. We tried to scale their variables, but none of those techniques worked. We eventually opted on considering their preferences as Never. We were originally going to compare the dierences between Never and Great, but we later reasoned out that if we can get a feasible solution where every basic variables' happiness coecient was greater than or equal to 3 then the solution is optimal. Hence there would be no need to recalculate the scheduling. In order to model these complex constraints. we eventually settled on adding in auxiliary variables. This, in turn, complicated our coding immensely in MATLAB. However, with perseverance and hard work (and one talented programmer), we were able to write our model as a exible algorithm to solve the problem. The next biggest hurdle we faced was coding the restriction such that if a professor taught the rst part of a sequence, then they have to teach the second part of the sequence. A complex algorithm had to be written in order to force a professor (or their dummy) to teach any section of the second part of the sequence. As we were working through each quarter, it became clear that our algorithm would consider the basic variables in the order in which they appeared. This would result in an optimal solution where the bottom of the list of professors were given a lower priority than the rest. For example, in our tables, professor 15 would not be assigned any real classes for the whole year. This was circumvented by manually assigning a class to professor 15 in the Spring Quarter. We searched through the list of preferred classes for professor 15 and picked a class where the happiness value was at least 3. Then we searched for the professor who was currently teaching that class and switched it to professor 15; so long as it didn't conict with any other restrictions. It is interesting to consider what would happen if we randomize the order of professors every quarter and/or if we revised our code to address this slight bias: 5
  • 6. And if we would arrive at a dierent optimal solution that generated the same happiness level with dierent basic variables. 4 Appendix Figure 1: Excel Spreadsheet for the Constraints In Figure 1, the cells with zeroes and ones represent the subset of professors with tighter restrictions than the rest. 6
  • 7. 1 Table of Contents ........................................................................................................................................ 1 objective function ................................................................................................................ 1 ----- constraints ------ equal to ------ ........................................................................................ 2 ----- constraints ------ less than or equal to ------ ....................................................................... 2 classes = 23; % indexes of professors (only first index) that wil not teach two of the % same UD no2same = [1,3,31,33]; % indexes of professors (only first index) that wil not teach two different % UD in the same quarter no2diff = [1, 3, 9, 11, 13, 21, 23, 29, 31, 33, 35]; % first index of repeated classes sameclass = [3,6,8,10,16,18]; % different classes diffclass = [1,2,13,14,15,20,21,22,23]; % index of class if 3 sections exist threepeat = [3,10]; % professor i in the middle of a sequence j prof_seq = [13, 4, 10, 9, 12, 8, 4]; seq = [6, 6, 10, 10, 10, 18, 15]; variables = 1296 + size(no2diff,2) * (1 + size(sameclass,2)); objective function % initialize coefficient vector for objective function f = zeros(variables,1); % Import the data [~, ~, raw] = xlsread('C:Usersb_ran_000DesktopSpreadsheet A (Autosaved).xlsm',' % Create output matrix data = reshape([raw{:}],size(raw)); % Populate f for i = 1:36 for j = 1:36 f((i - 1)*36 + j) = - data(i,j); end
  • 8. 2 end % Clear temporary variables clearvars data raw; ----- constraints ------ equal to ------ % initialize coefficinet matrix Aeq and constraint vector beq Aeq = zeros(72,variables); beq = zeros(72,1); % constraint - one teacher can teach one class for i = 1:36 for j = 1:36 Aeq(i,(i - 1) * 36 + j) = 1; end beq(i) = 1; end % constraint - one class can have only one teacher for i = 1:36 for j = 1:36 Aeq(i + 36,(j - 1) * 36 + i) = 1; end beq(i + 36) = 1; end % constraints for auxiliary variables used below for i = 1:size(no2diff,2) for j = 1:(size(sameclass,2) + 1) Aeq(i + 72, j + 1296 + (i-1) * (size(sameclass,2) + 1)) = 1; end beq(i + 72) = 1; end for i = 1:size(prof_seq,2) Aeq( i + 72 + size(no2diff,2), seq(i) + (prof_seq(i) - 1) * 36) = 1; Aeq( i + 72 + size(no2diff,2), seq(i) + 1 + (prof_seq(i) - 1) * 36) = 1; Aeq( i + 72 + size(no2diff,2), seq(i) + prof_seq(i) * 36) = 1; Aeq( i + 72 + size(no2diff,2), seq(i) + 1 + prof_seq(i) * 36) = 1; if any(seq(i) == threepeat) == 1 Aeq( i + 72 + size(no2diff,2), seq(i) + 2 + (prof_seq(i) - 1) * 36) = 1 Aeq( i + 72 + size(no2diff,2), seq(i) + 2 + prof_seq(i) * 36) = 1; end beq( i + 72 + size(no2diff,2))=1; if prof_seq(i) == 8 beq( i + 72 + size(no2diff,2))=2; end end ----- constraints ------ less than or equal to ------ % initialize coefficinet matrix A and constraint vector b
  • 9. 3 A = zeros(72,variables); b = zeros(72,1); % constraint - no two of the same Upper Division in same quarter % no repeats of class i for prof j for i = 1:size(no2same,2) for j = 1:size(sameclass,2) A( size(sameclass,2) * (i-1) + j, sameclass(j) + (no2same(i) - 1) * 36) = 1 A( size(sameclass,2) * (i-1) + j, sameclass(j) + 1 + (no2same(i) - 1) * 36) A( size(sameclass,2) * (i-1) + j, sameclass(j) + no2same(i) * 36) = 1; A( size(sameclass,2) * (i-1) + j, sameclass(j) + 1 + no2same(i) * 36) = 1; if any(sameclass(j) == threepeat) == 1 A( size(sameclass,2) * (i-1) + j, sameclass(j) + 2 + (no2same(i) - 1) * A( size(sameclass,2) * (i-1) + j, sameclass(j) + 2 + no2same(i) * 36) = end b( size(sameclass,2) * (i-1) + j)=1; end end % constraint - no two different Upper Division in same quarter for i = 1:size(no2diff,2) for j = 1:size(diffclass,2) A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1, A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1, end A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1, 1 + b( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1) = 0 for k = 1:size(sameclass,2) A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1 A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1 A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1 A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1 if any(sameclass(k) == threepeat) == 1 A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) end A( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1 b( size(no2same,2) * size(sameclass,2) + (i-1)*(size(sameclass,2) + 1) + 1 end end %%[x , fval] = linprog(f,A,b,Aeq,beq,lb,ub); %%intcon = 1:1296; %%x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub); [x , fval] = bintprog(f, A, b, Aeq, beq); optimal = vec2mat(x,36); Maximum number of iterations for LP Relaxation exceeded; increase options.M