ݺߣ

ݺߣShare a Scribd company logo
Prepared By
Niaz Mohammad
Combinatorial problem
Class Scheduling
                                              Linear Programming

Class Scheduling is a broad general
problem which has been one of the prime       Optimization Problem
area of research. There has been a lot of
algorithms developed for this particular      Genetic Algorithm
problem using different techniques as
shown on the right.
                                              Constraint Propagation
This is a problem with so many variations
due to various constraints that can be tied
to it. And this is why it is so hard and is   Simulated Annealing
considered as NP(Non-Polynomial)
complete i.e. it does not have any
                                              Tabu Search
polynomial time bound.
However, approximate algorithm or
heuristic approach can be taken to attain     Greedy Algorithm
solution in a feasible time bound.
                                              Hill Climbing
Problem Statement
Design a simple class schedule
with no conflict between a set
of teachers and a set of
courses with the following set
of constraints:
i)   No same courses can be
     taken by any teacher or
     batch for a given time
     slot.
ii) Minimize the number of
     time slots required and
     prove that it is optimum.
My Class-scheduling Approach
I researched for this problem a lot and have found
numerous articles, documents that were published on
this topic and have seen so many variants of this            Bipartite Matching
problem and also various approaches such as GA(genetic
algorithm), CSP (Constraint Satisfaction
Problem), Combinatorial approaches have been taken.


But for my purpose of creating or developing the
simplest form of this class-scheduling problem, I tried to     Edge Coloring
develop my own algorithm, it works !
Well, for at least the specific example that Jolly madam
presented in our class.
I put the teachers and the courses into two independent
sets and then created the Bipartite matching according
to the matrix of number of courses taken by each
teacher.
                                                             Draw the timetable
So, in a nutshell, the idea is to find the maximum
Bipartite matching among teacher & courses and then
do an edge coloring to find the time slot so that no
two edges coming out from a vertex have the same
color.
Edge Coloring Model
? Take bipartite graph with          Teacher/Batch   21st   22nd   23rd   24th
  vertices for teachers and for      RAJ             2      0      1      1
  classes                            AR              1      1      0      0
? Look for a coloring of the         SA              0      0      2      1
  edges such that no vertex          SIS             0      2      0      2
  has two incident edges with        KMH             1      1      1      0
  the same color.
? What is the minimum
  number of colors needed?
   C Lower bound: maximum
     degree. (Interpretation!)
   C We can attain the lower bound
     with help of matching!!
Class scheduling
A Theorem
Let G be a bipartite graph with
maximum degree d. Then G has an
edge coloring with d colors.
   ? Step 1: Make G regular
     by adding vertices and
     edges.
   ? Step 2: Repeatedly find
     a matching and remove
     it.
Edge coloring a regular graph
Say G is regular of degree d.
For i = 1 to d do
    ? Find a perfect matching
      M in G.
    ? Give all edges in M color
      i.
    ? Remove all edges in M
      from G. (Note that G
      stays regular!)
Final step
Take the edge coloring c of G. Color
G in the same way: G is subgraph of
G.
Time: carrying out d times a perfect
matching algorithm in a regular
graph:
    ? O(nd3) if we use
      Schrijvers algorithm.
    ? Can be done faster by
      other algorithms.
My Algorithm
1.   Find the maximum number of
     degree(d) from the given bipartite   Time Complexity:
     graph.
                                          O(nd3)
2.   Add vertex and edges so that it      Where n is the number of
     becomes a d-regular bipartite        vertices(in teachers set(t)) and d is
     graph.                               the maximum number of degree.
3.   Split if there are cycles in the
     given Bipartite graph until there
     are no cycle.
4.   For each color c from 1 to d
?    Iteratively color different batch
     for set t ( the edges between
     them) with color c greedily.
5.   Represent it as final matrix which
     is the solution.
Class scheduling
Class scheduling

More Related Content

Class scheduling

  • 2. Combinatorial problem Class Scheduling Linear Programming Class Scheduling is a broad general problem which has been one of the prime Optimization Problem area of research. There has been a lot of algorithms developed for this particular Genetic Algorithm problem using different techniques as shown on the right. Constraint Propagation This is a problem with so many variations due to various constraints that can be tied to it. And this is why it is so hard and is Simulated Annealing considered as NP(Non-Polynomial) complete i.e. it does not have any Tabu Search polynomial time bound. However, approximate algorithm or heuristic approach can be taken to attain Greedy Algorithm solution in a feasible time bound. Hill Climbing
  • 3. Problem Statement Design a simple class schedule with no conflict between a set of teachers and a set of courses with the following set of constraints: i) No same courses can be taken by any teacher or batch for a given time slot. ii) Minimize the number of time slots required and prove that it is optimum.
  • 4. My Class-scheduling Approach I researched for this problem a lot and have found numerous articles, documents that were published on this topic and have seen so many variants of this Bipartite Matching problem and also various approaches such as GA(genetic algorithm), CSP (Constraint Satisfaction Problem), Combinatorial approaches have been taken. But for my purpose of creating or developing the simplest form of this class-scheduling problem, I tried to Edge Coloring develop my own algorithm, it works ! Well, for at least the specific example that Jolly madam presented in our class. I put the teachers and the courses into two independent sets and then created the Bipartite matching according to the matrix of number of courses taken by each teacher. Draw the timetable So, in a nutshell, the idea is to find the maximum Bipartite matching among teacher & courses and then do an edge coloring to find the time slot so that no two edges coming out from a vertex have the same color.
  • 5. Edge Coloring Model ? Take bipartite graph with Teacher/Batch 21st 22nd 23rd 24th vertices for teachers and for RAJ 2 0 1 1 classes AR 1 1 0 0 ? Look for a coloring of the SA 0 0 2 1 edges such that no vertex SIS 0 2 0 2 has two incident edges with KMH 1 1 1 0 the same color. ? What is the minimum number of colors needed? C Lower bound: maximum degree. (Interpretation!) C We can attain the lower bound with help of matching!!
  • 7. A Theorem Let G be a bipartite graph with maximum degree d. Then G has an edge coloring with d colors. ? Step 1: Make G regular by adding vertices and edges. ? Step 2: Repeatedly find a matching and remove it.
  • 8. Edge coloring a regular graph Say G is regular of degree d. For i = 1 to d do ? Find a perfect matching M in G. ? Give all edges in M color i. ? Remove all edges in M from G. (Note that G stays regular!)
  • 9. Final step Take the edge coloring c of G. Color G in the same way: G is subgraph of G. Time: carrying out d times a perfect matching algorithm in a regular graph: ? O(nd3) if we use Schrijvers algorithm. ? Can be done faster by other algorithms.
  • 10. My Algorithm 1. Find the maximum number of degree(d) from the given bipartite Time Complexity: graph. O(nd3) 2. Add vertex and edges so that it Where n is the number of becomes a d-regular bipartite vertices(in teachers set(t)) and d is graph. the maximum number of degree. 3. Split if there are cycles in the given Bipartite graph until there are no cycle. 4. For each color c from 1 to d ? Iteratively color different batch for set t ( the edges between them) with color c greedily. 5. Represent it as final matrix which is the solution.

Editor's Notes

  • #7: Colored does not represent bipartite matching or edge coloringit is used just to give clarity or avoid confusion
  • #11: Simulate the example.
  • #12: Simulate the example from my note