You are on page 1of 4

Algorithm for Solving Time Table Questions Based

on GA
Xiaoping Li Xiaoxing Lv Wenbo Mei Hu Xu
Department of Computer Department of Computer Department of Computer Department of Computer
Science and Technology, Science and Technology, Science and Technology, Science and Technology,
Beijing Institute of Beijing Institute of Beijing Institute of Beijing Institute of
Technology, Technology, Technology, Technology,
Beijing, China Beijing, China Beijing, China Beijing, China

Abstract—Time table problem is a multifactor optimized decision chart coloration algorithm, but this method violates the law
problem and is typical problem in constitution and planning. It easy to fall into is partially most superior, thus has affected the
has been proved as a kind of NP-complete problem. Genetic obtained timetable quality.
Algorithm (GA) is based on the biological mechanism of natural
selection and heredity, leveraging colony searching technology,
and is particularly applicable for the resolution of complicated II. GENETIC ALGORITHM(GA)
on-linear problems intractable with traditional searching The genetic algorithm was the recent years widespread use
methods. This paper designs the genetic arithmetic about the uses in the solution complex and the non-linear problem
time table problems, a new method chromosome encoding is algorithm, it based on the natural selection principle, solved
designed. This method mainly aims at in the test time question [5] through the simulation nature biological evolution
arrangement the concrete question to propose each kind of process. The algorithm first carries on the code to the question
corresponding heredity operation strategy. The experiment parameter, production certain quantity (scale) the possible
proved this algorithm in the test time cell and the examination solution, forms the initial population. In which each solution
place number is all not in the very big situation, reduced the may be one-dimensional or the multi-dimensional vector,
average evolution algebra enormously, and can guarantee obtains
indicated by the binary number string or the real number string,
the overall situation optimal solution in the two number random
situation.
calls the chromosome, the chromosome each binary number or
each real value call the gene. The algorithm judges each
Keywords-examination timetabling problem; genetic algorithm; possibility solution performance fit and unfit quality by the
chromosome encoding; Operator sufficiency function achievement the standard, the performance
good solution is chosen by certain probability participates as
the father generation later heredity operation to produce the
I. TIMETABLE QUESTION
new generation of population. The heredity operation mainly
The timetable question (Timetable Problem) is a kind of includes the chromosome choice, in the chromosome the gene
scheduling problem, may define for has in the resources under overlapping and the gene variation, the overlapping result
the limit condition to arrange the event at the appointed time causes a father generation of characteristic to be more
the compartment. According to the constraint condition, the centralized, then the variation is beneficial in producing the
question domain difference, the timetable question may divide new individual, favors the evolution. But after, passes through
into very many types, For example: Workshop scheduling by a generation of optimization, until satisfies the conclusion
problem, railroad timetable arrangement, university timetable condition.
question and so on. This article aims at the university test
arrangement to the timetable question discussion. The With the heuristic chart method of coloring which uses
university test timetable question is the arrangement test in a widely compares, the genetic algorithm has two superiority.
group of limited integer time section, the request avoids First: The genetic algorithm has the very strong overall
conflicting also satisfying certain constraint condition. May see, situation search ability. This is but because the genetic
this question has concentrated the time, the spatial dual algorithm solution space does not limit in one is crowd of spots,
restraints, if only from examination place (space) the angle thus not easy to fall into is partially most superior. Second: The
looked, this question similar packing question (bin-packing), genetic algorithm has the extension. This is because the genetic
but increased many restraints in the time, this is one compared algorithm has the separation appraisal function, we may change
to packing question more complex question [3]. the new timetable which the constraint condition and the code
produce need.
The university test timetable is a NP complete question,
the present solution method mainly has the heuristic chart III. CONCRETE DESCRIPTION ABOUT UNIVERSITY TEST
coloration algorithm, heuristic mountain climbing law, restraint
TIMETABLE QUESTION
logical program design, based on rule system, integer
programming, simulation annealing method, taboo The university test timetable question definition is five
reconnaissance method [4].Uses universally is the heuristic tuple <course, room, time, group, monitor>, in which course

18
represents the test subject, room represents the examination arrangement in specific time section, for example: Some day
place, time represents the test time, group represents the evening time section.
student group, representative monitor monitors an exam the
teacher. Need shows following several points:
group (student group) the subset which the definition is IV. SOLUTION UNIVERSITY TEST TIMETABLE QUESTION
must participate in the student who identical gate test gathers. BASED ON GA
Here student group's concept does not equate in an
administrative class's concept, and requests a student not to be Carries on before the test time arrangement, the student first
able simultaneously to subordinate in several student groups. acts according to this semester to teach the plan to choose
Supposes altogether has n gate test subject C1, C2 ......Cn, oneself requests the participation the test subject, these students
participates in the ith test student's set is Gi(1İiİn), we take chooses the test subject the data to be possible to form after the
the student to gather gi1, gi2, ......And, gi k causes gi1Ĥgi2 reorganization about the test subject, the student group's
information. Has the examination place information in the
Ĥ ...... Ĥgi k=Gi gi1ģgi2ģ ...... ģgi k=Φ , then group= {gi j| basic database, which monitors an exam the teacher
1İiİn,1İjİk, k is in Gi member's integer}. information and is concrete several days to be possible to
room (examination place) is the standardized examination arrange the test.
place, each examination place 60 seats. First selects may
participate in the test arrangement the classroom, the A. chromosome encoding
insufficient 60 seat classroom may not participate in the Uses the direct code expression, each individual
arrangement, then surpasses the seating capacity 60 classrooms (chromosome) expresses a test time arrangement. The
to divide into certain standard examination places and individual may express for a length which constitutes by five
according to the smooth hypothesis serial number, after in tuples is the 5n vector (n is test subject total) ([time1, day1,
which classroom is divided the surplus insufficiency 60 seat room1, teacher1, group1]; ......; [timei, dayi, roomi, teacheri,
parts not to participate the examination place arrangement. For groupi]; ......; [timen, dayn, roomn, monitorn, groupn]), timei
example: The classroom aggregate capacity 128 seats, may expressed the ith test test time section, dayi expressed the ith
divide are two seats are 60 examination places, the surplus 8 test date, roomi expressed the ith test is at the examination
seats do not participate in the examination place arrangement. place, monitori expressed the ith test monitors an exam the
Uses the standardized examination place to have the merit in teacher, groupi indicated participates in the ith test the student
the practical application aspect, because has some test subject group.Timei, dayi jointly expresses this test time cell; timei,
participation test population to be very many, is unable to dayi, roomi and groupi possibly separately include many values,
arrange in any independent classroom, for example, higher this is because a test possibly participates by many student
mathematics. Divides the classroom after the size non- group takes the continual several test time cell and takes many
difference standard examination place, may also carry on a test examination places.
arrangement in certain examination places, whether moreover
uses this method not to have the test population and the After in fact each subject monitors an exam the teacher is
classroom size best match question, simplified the computation. arranges the test time to assign, moreover participates in the
random test the student group is before the arrangement test
Time (test time) uses the two-dimensional information to time has determined, therefore the individual may simplify the
indicate that, and puts forward the test time cell concept. expression is three tuple vectors: ([time1, day1, room1]; ......;
Carries on the test arrangement in certain dates, each test date [timei, dayi, roomi]; ……; [timen, dayn, roomn]).Does this only
divides 5 section of test time section, each period of time 2 is in order to simplify the code, in fact group and the monitor
hours. The test time cell on indicated together by the test date information has not lost, may see in under to the sufficiency
and the test time section that. For example 1 day the 2nd time function description in the concealment group and the monitor
section expressed a concrete test time cell. information can apply in the restraint examination. Each
The problem controls definition. The restraint may divide timetable (chromosome) may use a three dimensional structure
into the hard restraint and the soft restraint, the hard restraint to indicate, like Figure I.
for the restraint which must satisfy, the soft restraint for in
satisfies the hard restraint in the foundation as far as possible
the satisfied restraint.
The hard restraint includes: The identical student cannot
test in the identical test time cell is more than a test subject;
The identical examination place cannot be more than a test
subject in the identical test time cell arrangement; Certain tests
must use the examination place which assigns, like the Figure 1. Expresses the timetable with the three dimensional structure
computer hands-on programming test must use the engine
room. This encoding method has not considered the constraint
condition, therefore can have the massive individuals not to
The soft restraint includes: The student should have at least satisfy the constraint condition, also has the massive
a test time cell time-gap between the participation test, is individuals is the test time arrangement question non feasible
advantageous for the rest and the review; Some test hope

19
solution. But is precisely because these not feasible solution each examination place and each student group. Also is
existence enables the search effective to jump out this sector, corresponding Xdtrg =1.With the formula expressed this
examination conflict method is˖ 
thus made the algorithm to maintain good search ability [4].If course 1
DŽFor example:
has used other code method, although each individual all is
feasible, but these methods often excessively many limit Supposition test time cell situation like Figure II which
adaptation value sector, thus has limited the obtained timetable expressed by dayi and timej.
quality.

B. Adaptation value function


We use the penalty function to process the restraint as the
adaptation value, to violates the restraint the individual to carry
on the penalty, the constraint condition which the individual
violates are more, the penalty which receives is bigger, the
corresponding adaptation value is also smaller, in which most Figure 2. Test time cell situation
superior individual adaptation value is biggest. The adaptation
value function description is as follows: Needs to carry on the examination operation is:
group2˖ course1+course2+course3İ1
1If the c j restraint is violated
1  group3˖course2+course4İ1
f  v(c j )  
1   w j v (c j ) 0If the c restraint is satisfied
 j
C. Operator
wj is the jth restraint the penalty value which violates. 1) Heuristic variation operator:
The algorithm violates the penalty value regarding the We use the heuristic variation operator to produce the new
restraint the assignment to be quite sensitive, some restraint individual, this operator is as follows: Regarding wants the
penalty value is higher, violates this penalty the individual variation the timetable, selects a test subject stochastically,
more to be able to plant the populace to eliminate, therefore chooses the variation test time cell or the variation examination
must compared to restrain softly to the hard restraint penalty place stochastically, if variation test time cell, then first
heavily. inspects this test subject whether needs the continual many test
time cell, if only needs a test time cell, then carries on all test
The restraint is divided as mentioned above and restrains time cell the championship tournament to choose, chooses
hardly into the soft restraint two kinds. In actual examination penalty value smallest achievement new individual the test time
individual whether satisfies the restraint in the process, is most cell, If needs n(nı2) continual test time cell, then selects all n
greatly also most complex to the resource conflict restraint continuously test time cell the combination to carry on the
examination computation load, the resource conflict restraint championship tournament to choose, chooses penalty value
contains in the hard restraint. The so-called resources are refer smallest achievement new individual the test time cell; If the
to the examination place and the student group. The resource choice variation examination place, selects m the examination
conflict is refers to in the test time arrangement process in place combination which is composed by n examination place
some test time cell two or two above test subjects takes the to take stochastically new individual the test examination place,
identical resources. The concrete resource conflict has 1, two or in which n value should under guarantee these examination
two above test subject is arranged in the identical test time cell, places tolerate this test subject all examinees. If needs n(nı2)
but has the student to have to participate in these tests.2nd, in
continual test time cell, then selects all n continuously test time
the identical examination place has arranged two or two above
cell the combination to carry on the championship tournament
test subjects in the identical test time cell. Following we to
to choose, chooses penalty value smallest achievement new
explain the method of examination resources conflict.
individual the test time cell; If the choice variation examination
First defines the binary variable Xcdtrg ˈWhen also only place, selects m the examination place combination which is
works as in d and in the t union expression test time cell, composed by n examination place to take stochastically new
student group g participates in the c test subject when individual the test examination place, in which n value should
examination place r the test, the Xcdtrg value is 1, otherwise the under guarantee these examination places tolerate this test
Xcdtrg value is 0. May use two three dimensional structures to subject all examinees.
express the test time cell, the student group, the examination Uses such algorithm to have two reasons: Firstly, because
place, between the test subject these attribute relations. In in the usual situation in the university test arrangement all
which all three dimensional structures x and y coordinates subject of examination altogether takes the test time cell integer
expressed the date and in time section, in each structure z are not many, generally is smaller than 100, moreover only
coordinates separately express the examination place and the then in the extremely special situation will only then present a
student group every day. Regarding each test time cell all needs test to take continuously certain test time cell situation,
to examine whether has the resource conflict. If is more than therefore in variation time cell time, even if will carry on all
test subject competition identical resources (student group or test time cell the championship tournament to choose, like this
examination place), has a resources conflict. This method had will not increase the computation load oversized; Secondly, in
guaranteed in each test time cell, all only has arranged a test for

20
the university may participate in the test arrangement the S9: The algorithm ended, output test timetable
classroom to be many, mostly surpasses 200, and after dividing
the standard examination place, this number doubled and re- V. EXPERIMENTAL RESULT AND CONCLUSION
doubled will also increase, moreover in university's public class
test population can be many, for example the higher Chooses this school distance learning institute student and
mathematics, English and so on, these subject's test can take the collated and corrected copy department undergraduate is
certain examination places, for therefore as for does not the test model, the distance learning institute 2002-2003 school
increase the computation load we only stochastically to select year spring the semester altogether has 35 test time cell, may
m oversized the examination place combination which is participate in the test arrangement standard examination place
composed of n examination place to take new individual the 97, the student approximately 3000 people. The collated and
test examination place, here m should not be oversized. corrected copy department 2002-2003 school year spring the
semester altogether has 75 test time cell, may participate in the
This kind of heuristic variation operator will compare the test arrangement standard examination place 232, the student
simple direct variation both to speed up the search speed and approximately 8000 people. Result like table I.
not to increase the procedure computation load oversized,
moreover the championship tournament chose the scale was
TABLE I. TEST RESULT
relatively small some can obtain the good solution.
Average evolution Least evolution
2) Choice operator: Question
algebra algebra
According to adaptation value function size and the School of Distance
probability to choice outstanding test time arrangement. learning 4578 2012
Main campus 12085 6786
3) Regeneration operator:
The regeneration operator may describe is:
This algorithm with the C language establishment, the
The new individual adaptation value is bigger than is equal initial population scale is 50, the resources conflict penalty
to the father individual, then the new individual replaces the value is 20, other hard restraint penalty value is 15, restrains
father individual. the penalty value is softly 3.Moves on AMD 1G PC machine,
The new individual adaptation value is smaller than the finally succeeded obtained the question optimal solution.
father individual, also the father individual is not in the Based on the genetic algorithm university test timetable
community the best individual, then the new individual question solution method, this method mainly aims at in the
replaces the father individual by certain probability. test time arrangement the concrete question to propose each
This method has guaranteed the filial generation individual kind of corresponding heredity operation strategy, the
best solution not compared to the father generation of experiment proved this algorithm in the test time cell and the
individual best prisoner escort. examination place number is all not in the very big situation,
reduced the average evolution algebra enormously, and can
D. Operator guarantee obtains the overall situation optimal solution in the
two number random situation.
University test timetable question genetic algorithm flow
S1:Stochastic production initial timetable community P(0) REFERENCES
= {X1, X2, ......Xn}, t=0;
S2: Calculates P(0) individual the adaptation value; [1] Di,Gaspero,L,Schaerf,A,Burke,E,Erbens,W. Tabu search techniques for
examination timetabling .The practice and theory of automated
S3: If the adaptation value satisfies certain request (for timetabling III: selected papers from the 3rd International Conference,
example continual q generation of adaptation value invariable) lecture notes in computer science 2079. Berlin Heidelberg New York:
or the evolution algebra achieved a predetermined value Springer, 2001, :104~117.
changes to step 9; [2] Erich Gamma, Richard Helm, Ralph Johnson, John VIissides, Design
Patterns: Elements of Reusable Object-Orient Software. Addison Wesley,
S4: In P(t) with the choice factor choice individual, obtains 1995.
the new individual with the heuristic variation operator, then [3] Inderjeet Singh, Beth Steams, Mark Johnson and the Enterprise Team,
carries on the regeneration operation; Designing Enterprise Applications with the J2EETM Platform Second
Edition. 2002.4.
S5: The filial generation replaces the entire community, [4] Ted Husted, Cedric Dumoulin, George Franciscus, David Winterfeldt㧘
produces new population P (t+1); Struts in action Building web applications with the leading Java
framework. 2003.
S6: Calculates P (t+1) the individual adaptation value; [5] Michael A. Trick: a schedule-then-break approach to sports.
timetabling[A]. In:PATAT2000[C]. Konstanz Germany, 2000.242 253.
S7: t=t+1;
S8: Changes to step 3;

21

You might also like