Sei sulla pagina 1di 3

Application of Backtracking Algorithm in College Dormitory Assignment Management

Wen-fa WANG, Zhu-lin LI, Yan MA


Institute of Computer Science Yanan University Yaan, ShanXi Province,China ydlizhulin@163.com
AbstractThe multi-constraint conditions, including the entrance examination for college, the region and the dormitory classification and so on, were analyzed and studied enough by assigning management dormitory reasonably. A new backtracking algorithm based on matrix storage was proposed, and the realization detail of the algorithm was discussed. Further, the complexity of the algorithm was analyzed. The analysis result show the algorithm is more efficient comparing the similar method, and the application result show it is effective and reasonable in practice. Keywords- backtracking algorithm; matrix storage; multiconstraint conditions; dormitory assignment management

Software R&D Center Yanan University Yaan, ShanXi Province,China yadxmyy@163.com regions and having respective experience. In their dormitory, they will have intercommunicated and culture exchanged, and the dormitory ambience will affect their life and values greatly. However, at present, the management model is old and inapplicable, most work depend on man-made assigning. So exploring a new modernization, systematization and standardization dormitory management model is crucial to college and university, and the model may realize scientific, reasonable and humanism dormitory assignment management. In fact, the math model of dormitory assignment problem belongs to resource assignment problem. That is, with some constraint conditions, the quantitative resource will assign to the different individual. Selecting felicitous assignment method and combining different students to form optimum dorm-mates by features of student. As an example, the following factors for dormitory assignment are noticed. Requirement set The requirement set is limited, and every element has a series of features. The individual may be recognized respectively by their features. If college students are been defined requirement set, then the name, sex, score, region, interest and so on, are the features of the individual. Resource set The total of resource set is limited, and the different resources may be recognized. To college dormitory assignment, the element of resource set is the student apartment. While the dormitory No., the floor, the scheming people number, the actual assigned people number, the dormitory classification, and the department etc. are the features of every element. Constraint conditions group The math relation between the features of requirement set and the features of resources set is made of constraint conditions group. The main constraint condition of the college dormitory assignment is that every dormitory may hold several students, and a student only belongs to a dormitory. And other constraint conditions are decided by the feature of every student. For example, the uniform major, balanced scores, different regions, and so on. Solution set The solution set is the optimal corresponding relations of the requirement set and resource set under multi-constraint conditions.

I.

INTRODUCTION

Reasonable assignment problem under multi-constraint conditions has application widely in network programming, pattern recognition, multi-objective optimization, and so on[1-3]. The optimized solution of a problem always relates to several conditions, and these conditions constrain each other[4,5]. So searching optimized answer is an important research problem in math and computer fields. Backtracking algorithm is one of important method to solve combined searching problem. In solution space, the optimum solution is gained searching the solution space tree from root node by deep optimization searching technology[6]. In searching process, the optimal conditions and their corresponding priority are decided by the need of the actual problem and the optimization rules. To improve the search speed, the solution space tree is needed to clip reasonably and efficaciously. Multi-constraint reasonable assignment problem was applied in the Management System for Math Analysis Test Database and the Management System for the Dormitory Assignment of college students. Based on these projects, a backtracking algorithm based on matrix storage was proposed to resolve the multi-constraint problem. The following are the basic idea and the detail algorithm steps for the optimization assignment method of the college student dormitory management. II. DORMITORY ASSIGNMENT PROBLEMS

A. Dormitory assignment problem description The dormitory is one of basic activity sites, and the dorm-mate is crucial too. College students are made of a new literal environment because they are coming from different

_____________________________

978-1-4244-4520-2/09/$25.00 2009 IEEE

B. Dormitory assignment factors The factors are the features of dormitory and the features of student for assignment management method. The department, dormitory No., floor, scheming number of student, and dormitory classification are all the features of dormitories. The department, major, class, name, sex, score, region, interest, and so on are the features of students. C. Basic steps for dormitory assignment The basic steps for dormitory assignment are following: Step1: confirm the dormitories and their basic information to form resource set; Step2: confirm the student requirement set by their features; Step3: get the assignment result by a reasonable assignment algorithm; Step4: record the dynamic information about the dormitory state and the number of assigned students during assigning management. III. BACKTRACKING ALGORITHM FOR DORMITORY ASSIGNMENT

number of house are equal for every floor, the house classification is same in the same floor, and all students are assigned the same classification houses in the same requirement set. A. Storage matrix of main information Defination 1: Htr is used to save all rooms of a student rooming house. Where, t is the number of floors for a student building, r is the number of houses for every floor, H[i][j] is element of matrix H, the value of H is the room No., i is the number of the floor, j is the local number of this room, the weight WH[i][j]of H[i][j] is the number of actual students of this room. Defination 2: Hnum is the number of contain students, Snum is the number of students in requirement set. Defination 3: Smn is used to save related information of all students in requirement set. Where, m= Hnum, n=Snum/Hnum; S[i][j] is elements of S after sorted ascending by department, major, and class, and descending by score; the value of S[i][j] is student No., i is the group of this student, j is the local number of this student ; the weight WS[i][j]of S[i][j] is the number of dormitory No.of this student. Defination 4: Amn is used to save all regions information of all students in requirement set, the corresponding rules of matrix elements and students are equal to matrix S. the value of A[i][j] is the region of the student. Defination 5: {S[i][fi]|i=1,2,,m} is the solution set of choosed dormitory, where fi is the cross node of the chosen i and j in matrix S. B. Algorithm steps Select enough rooms from the student apartment H to wait assigned, then select students in requirement set for every dormitory. The main algorithm steps are following: Step1: select a room H[u][v] as resource set. Assume scheming people number is Hnum, and initialize assigned people number is H [u][v]=0; Step2: select a student S[i][j] from matrix S by selecting a student every row, while considering score balance; Step3: compare A[i][j] and A[u][v],where A[u][v] is one of regions of assigned students; Step4: if A[i][j] A[u][v], then H [i][j]= H [i][j] +1; else select student S[i][ j +1], repeat step3 to step4; if A[i][j]= A[u][v] and j>n, where n is maximum of j, then the algorithm backtrack to chosen H [u][v] just now, select other student, repeat step3 to step4; Step5: if the root is not empty after implementing step4, then the root is the optimum solution; else selecting random S[i][j], the root is the approving solution; Step6:repeat step2 to step 5 until H [i][j]= Hnum. C. Algorithm efficiency analysis Solution space deciding by marked characters may be created dynamically in search processing. If the scale of problem is n, the depth of solution space tree is m, the computing time is O(n) every time, then the worst time is O((m)!) using backtracking algorithm. So, the complicacy of backtracking algorithm is O(n(m)!).

A. Basic idea of backtracking algorithm The backtracking algorithm is an optimal search method satisfied with certain constraint conditions. The searching method is realized by multi-stage confirmed step by step. In every stage, a branch is picked out from multi-selection branches. The algorithm must backtrack to the searched node and select other node once finding solution inexistence. If all branches of this node were tried and no solution, then the procedure must backtrack to quondam node. The quondam node is named backtracking node satisfied with the backtracking condition. B. Dormitory assignment and backtracking algorithm The basic task of dormitory assignment is to assign certain dormitory for every student. However, how select a scientific, reasonable and humanism dormitory for students is worth studying deeply based on analyzing the student individual and dormitory collectivity. Furthermore, the assignment algorithm needs to optimize by the following factors: the scores of a dormitory are balance as other dormitory, the regions are difference, the uniform major are centralization, and different dormitory to be selected for the college students. The basic demand and the optimal rules are constraint conditions group for dormitory assignment problem; they are the conditions for the optimum solution too. The priority is descending of the demand and the optimal rules. By optimizing the constraint conditions stage by stage, a backtracking algorithm based on matrix storage for dormitory assignment is proposed. IV. BACKTRACKING ALGORITHM BASED ON MATRIX
STORAGE

To make computing simple, we assume the resources set of dormitories is only belongs to a student building, the

Assume the requirement set S including Snum students. After dividing Snum into m=Hnum groups, the number of students is less than or equal to n=Snum/Hnum 1, and saved as Smn. Thus, searching total number and degree are all reduced, and the depth of solution space tree is less than or equal to m. we may educe the worst time is O(n(m)!), that is, the computing time is less than or equal to O(n(m)!). Compare similar algorithm, the backtracking algorithm based on matrix storage improve computing speed greatly. V. CONCLUSIONS

REFERENCES
[1] [2] XU Ke, LI Wei. Analysis of Backtracking on Random k-SAT[J]. CHINESE JOURNAL OF COMPUTERS,2000,23(05): 454-458. Douglas C. Schmidt, Larry E. Druffel. A Fast Backtracking Algorithm to Test Directed Graphs for Isomorphism Using Distance Matrices[J]. 1976,23(3): 433 - 445. Widyawan Klepal, M. Beauregard, S. A Backtracking Particle Filter for Fusing Building Plans with PDR Displacement Estimates[C]. Positioning, Navigation and Communication, 2008. WPNC 2008. 5th Workshop on. Hannover, 2008, 3: 207-212. I. Lynce, L. Baptista, J. Marques-Silva. Stochastic Systematic Search Algorithms for Satisfiability[J]. Electronic Notes in Discrete Mathematics, 2001, 6(9): 190-204. Lynce I.; Marques-Silva J.P. An Overview of Backtrack Search Satisfiability Algorithms[J]. Annals of Mathematics and Artificial Intelligence,2003, 37(3) :307-326. Xiao-dong Wang. The Design and Analysis of Computer Algorithm [M].Beijing: Electronics Industry Press, 2001.

[3]

[4]

The backtracking algorithm based on matrix storage has been applied successfully in the Management System for Math Analysis Test Database and the Management System for the Dormitory Assignment of college students. In fact, the algorithm may extend to get optimum assignment solution based on resource, reasonable assignment management based on multi-condition, and so on. At the same time, the algorithm is easy to realize using computer based on database technology.

[5]

[6]

Potrebbero piacerti anche