Student dormitory one-key allocation method, device and equipment and storage medium
By employing a multi-dimensional attribute bucket rotation strategy and local search optimization, the problem of unbalanced composition and high management risk in dormitory allocation is solved, achieving diversity and fairness within dormitories and providing visualized analysis and reproducible allocation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NEWCAPEC ELECTRONICS CO LTD
- Filing Date
- 2025-12-23
- Publication Date
- 2026-05-01
AI Technical Summary
The existing student dormitory allocation method has problems such as uneven composition within the dormitory, high management risk, lack of reproducibility and global optimization, especially under gender segregation and bed capacity constraints, it is difficult to achieve global optimization.
A multi-dimensional attribute bucket rotation strategy is adopted to allocate students based on factors such as gender, ethnicity, place of origin, and surname. Combining hard constraints and soft objectives, the allocation results are optimized and adjusted through local search to generate a dormitory allocation mapping table and provide visualization analysis.
It improves diversity and fairness within dormitories, reduces management risks, achieves reproducibility of allocation results and traceability of the process, and is highly adaptable, enabling rapid algorithm adjustments to meet the needs of different schools.
Smart Images

Figure CN121961049A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of campus accommodation management and intelligent scheduling technology, specifically a method, device, equipment and storage medium for one-click allocation of student dormitories, which is an automated one-click allocation of dormitory beds under multiple constraints and multiple objectives. Background Technology
[0002] The existing student dormitory allocation schemes mainly include the following: Fixed allocation rules: Dormitory beds are allocated based on gender, college / major, class, or order of registration, and proximity to the dormitory.
[0003] Random / rotational allocation: Beds are filled randomly or in rotation, provided that basic constraints such as gender segregation and bed capacity are met.
[0004] Priority allocation based on student preferences: Roommates will be allocated based on the students' submitted roommate preferences or preferred combinations (such as sharing a room with acquaintances).
[0005] The aforementioned dormitory bed allocation methods have several shortcomings. For example, fixed-rule allocation can easily lead to excessive concentration of students with similar backgrounds in certain dormitories, resulting in an imbalance between different dormitories and posing management risks. Random allocation lacks specificity and may lead to uncontrollable extreme allocation situations. While allocation based on student preferences takes into account student wishes, it may neglect overall fairness. Furthermore, most of these allocation methods lack reproducibility, making it difficult to verify or adjust them afterward. They typically only achieve local or empirical optimization and do not fully consider the global optimization objective. Summary of the Invention
[0006] To overcome the aforementioned problems in the prior art, the present invention provides a method, apparatus, device, and storage medium, employing the following technical solution: In a first aspect, the present invention provides a method for one-click allocation of student dormitories, comprising: Students are divided into different subsets based on gender to obtain data on students to be assigned. Based on the preset strategy parameters, estimate the global and target distribution of student data to be assigned on each floor; A multi-dimensional attribute bucket rotation strategy is adopted to allocate students to dormitory beds based on the target distribution. The initial allocation results are obtained by suppressing the excessive concentration of names and classes in the same dormitory through a preset threshold. Within a preset range, student dormitories in the initial allocation results are exchanged and adjusted to improve the global objective function value. The allocation results are then optimized through local search to obtain the final allocation results. Based on the final allocation results, a dormitory allocation mapping table and analysis report are generated.
[0007] Furthermore, students are divided into different subsets based on gender. Before obtaining the data of students to be assigned, the following steps are included: The input student information is standardized. The standardization process includes unifying and standardizing the various encoding formats of different fields to obtain standardized encoded data. Extract students' last names and first names from the standardized coded data and label them with special identity tags.
[0008] Furthermore, based on preset strategy parameters, the target distribution of the student data to be assigned globally and on each floor is estimated, including: Based on the distribution of students by ethnicity and place of origin, we initialize the estimated number of students of each type in each dormitory under ideal equilibrium conditions, which is used as a reference for allocation. When the allocation reference was obtained, all students were unassigned and all beds were vacant.
[0009] Furthermore, students are assigned to dormitory beds based on target distribution, including: allocation based on hard constraints and soft objectives; among which hard constraints include: dividing dormitory buildings, floors and rooms according to gender, ensuring that the actual number of people occupying each dormitory room does not exceed the bed capacity, and meeting the specified requirements for special room types; The soft objectives include: while meeting the hard constraints, improving the diversity and fairness of the student composition in dormitories, including promoting a balanced distribution of ethnic groups and a diverse range of student origins, curbing the excessive concentration of students with the same surname in the same dormitory, and meeting the upper limit threshold for students in the same class.
[0010] Furthermore, employing a multi-dimensional attribute bucket rotation strategy to allocate students to dormitory beds based on the target distribution also includes: A multi-dimensional attribute bucket rotation strategy is adopted. In each round of selection, a student who can fill the current scarcest attribute is selected for allocation until the allocation ends. The allocation ends when all students have been allocated or the beds are full.
[0011] Furthermore, within a preset range, adjustments are made to the student dormitories in the initial allocation results, including: Based on a preset local search and exchange strategy, the system iterates through a loop, selecting a preset number of students for dormitory exchange each time. If the exchange improves the global score, the local exchange is accepted; otherwise, it is not accepted. When the number of iterations is met or the global score no longer improves, the local search terminates, and the final allocation result is obtained.
[0012] Furthermore, the global scoring formula is as follows:
[0013] in Dormitory r ethnic diversity Dormitory r The diversity of student origins Dormitory r Surname conflict penalties Dormitory r Class-wide concentrated punishment; the goal of global scoring is to maximize the overall... Value, improve diversity indicators, and reduce conflict penalties; , , , They are respectively , , , The weighting coefficients.
[0014] Secondly, the present invention also provides a one-click student dormitory allocation device, comprising: The strategy configuration module is used to set and manage the strategy parameters for dormitory allocation and to provide the configuration to the execution part of the allocation algorithm. The data validation module is used to verify the integrity and correctness of imported student and dormitory data before the allocation begins, ensuring that the input data is legal and valid. The heuristic allocation module is used to perform initial allocation according to predetermined strategy parameters, assigning students to dormitory rooms and obtaining the initial allocation results; The local search optimization module is used to further optimize and adjust the initial allocation results. It is responsible for executing the local exchange algorithm, which improves the overall allocation score and obtains the final allocation result by exchanging students in the dormitory while ensuring that the hard constraints are not violated. The results audit and reporting module is used to perform statistical analysis on the final allocation results and generate evaluation reports and visualizations for various indicators. The rollback and replay module is used to save and manage key data in a complete allocation process. It can roll back and undo specific allocation results as needed, or replay the entire allocation process based on the saved data to reproduce the results at that time.
[0015] Thirdly, the present invention provides an electronic device, comprising: One or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the device, cause the device to perform the method as described in the first aspect.
[0016] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method described in the first aspect.
[0017] Fifthly, the present invention provides a computer program that, when executed by a computer, performs the method described in the first aspect.
[0018] In one possible design, the program in the fifth aspect can be stored wholly or partially on a storage medium packaged with the processor, or it can be stored wholly or partially on a memory not packaged with the processor.
[0019] The present invention has the following beneficial effects: 1. Enhanced Diversity and Fairness: Compared to traditional allocation methods, this invention significantly improves diversity and overall fairness within dormitories. For example, the ethnic and regional composition of students in each dormitory is more balanced, the allocation differences between different dormitories are reduced, and situations where some dormitories have an overly homogeneous student population are avoided.
[0020] 2. Reduced Management Risks: Because this invention deliberately avoids assigning a large number of students with the same surname or similar names to the same dormitory, it reduces confusion during roll call and attendance checks. Furthermore, the diverse backgrounds of the students in each dormitory help prevent the formation of unmanageable cliques and reduce potential management risks.
[0021] 3. Reproducible Results and Auditable Process: This invention achieves reproducible allocation results and traceable processes through a fixed random seed and complete log recording. Administrators can rerun the algorithm later to obtain the same results or check the logs to understand the basis for each decision, which improves the transparency and credibility of dormitory allocation.
[0022] 4. Flexible and adaptable: This invention provides configurable strategy parameters and a modular design, allowing for rapid algorithm adjustments based on the policies or specific needs of different schools. For example, the weights can be reduced for schools with a single ethnic composition, while special constraints can be added for schools with a high proportion of minority students. This invention is also easily extended with new constraints or optimization objectives, demonstrating strong adaptability and scalability. Attached Figure Description
[0023] Figure 1 This is a flowchart of a one-click student dormitory allocation method according to an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the data structure and field relationships involved in an embodiment of the present invention; Figure 3 This is a schematic diagram of the local search interchange optimization process according to an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the objective function and weight relationship in an embodiment of the present invention; Figure 5 This is a schematic diagram of a student dormitory one-click allocation device according to an embodiment of the present invention. Detailed Implementation
[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains; the terminology used herein in the specification is for the purpose of describing particular embodiments only and is not intended to limit the invention; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings are used to distinguish different objects and not to describe a particular order.
[0025] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0026] To enable those skilled in the art to better understand the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.
[0027] Glossary: Ethnic code: The national standard numerical or alphanumeric code is used to represent the student's ethnic information. For example, Han, Zhuang, Uyghur and other ethnic groups have corresponding codes, which facilitates program processing.
[0028] Place of Origin: This refers to the student's place of origin, generally recorded according to the three-tiered administrative division of province / city / county (district). This invention focuses on the diversity of student origin at the provincial level, that is, on the number of different provinces included in each dormitory. Differences between cities and counties within a province are generally not considered as a primary optimization objective unless they need to be taken into account under certain special strategies.
[0029] Surname Conflict Classification: Surname conflicts can be classified and handled according to their severity. If two students in the same dormitory share the same surname and the same first letter of their given name (e.g., both are "Zhang Wei" or "Li Jia" and "Li Jian" share the same first letter of both surname and given name), it is considered the highest level of name conflict. If only the surname is the same but the given name is different, it is considered a general conflict; different surnames do not constitute a conflict. This invention assigns different weights to these levels when calculating name conflict penalties, thus more accurately reflecting the potential for confusion in management.
[0030] Example Report: This invention supports generating detailed dormitory allocation result reports. The example report, organized by dormitory, includes: "a bar chart showing the proportion of different ethnic groups within the dormitory, a list of all students' provinces of origin, a list of all students' surnames, and the dormitory's final score with a brief explanation." Through this report, dormitory administrators can intuitively understand the composition and scoring of each dormitory to assess the rationality of the allocation plan.
[0031] Based on the problems existing in the background technology, this invention provides a one-click student dormitory allocation method that comprehensively considers factors such as organizational structure (department / class), gender, ethnicity, place of origin, and surname. This invention addresses the problems of group aggregation, unfairness, and unreproducibility in existing dormitory allocation methods. Through the dormitory allocation method of this invention, automated and optimized allocation of dormitory beds can be achieved while strictly meeting hard constraints such as gender segregation and soft objectives. This improves the diversity and balance of allocation results, reduces management risks, and ensures the traceability and reproducibility of the allocation process. The technical solution of this invention will be further described below in conjunction with specific aspects.
[0032] This invention can run automatically with one click, and the results are consistent each time. It can be reproduced by setting a fixed random seed, record a complete log to make the process traceable, and provide reasonable explanations for the allocation results.
[0033] The solution process of the one-click allocation method proposed in this invention includes the following steps: S1 Data Preprocessing: Standardize the input student and dormitory information. This includes standardizing various encoding formats (e.g., unifying the encoding of fields such as ethnicity and major), extracting the last name and first letter of the first name from student names for subsequent conflict detection, and labeling special identity tags (e.g., students with accessibility needs, counselors, or dormitory heads). Then, the student dataset is split into subsets of different dormitory buildings or floors based on gender to prepare for subsequent allocation (e.g., separate processing for males and females).
[0034] S2 Initialization: Based on the statistical results of all students to be assigned, estimate the target distribution globally and on each floor. Specifically, calculate the distribution of all students by ethnicity, place of origin, etc., and estimate the approximate number of students of each category that each dormitory should contain under ideal equilibrium conditions, which will be used as a reference for allocation. Set a random number seed to ensure the reproducibility of the algorithm. Initialize the allocation state (all students are unassigned, all beds are vacant).
[0035] S3 Heuristic Round-Robin Filling: Students are gradually assigned to dormitory rooms according to the principle of "most scarce attribute priority". The algorithm maintains a multi-dimensional student pool and dynamically selects the dormitory room that most needs a certain type of student based on the current allocation status of each dormitory. For example, if it is found that the students already assigned to a dormitory have a relatively homogeneous ethnicity, students of different ethnicities will be selected from the unassigned students to be assigned to that dormitory. Similarly, if a dormitory has a high proportion of students from a certain province, students from other provinces will be prioritized to increase regional diversity. During each student selection, the algorithm also avoids assigning too many students with the same surname to the same dormitory (for example, if a dormitory already has a student with the surname "Wang", students with different surnames will be selected in this round to gradually suppress potential name conflicts). This process is equivalent to selecting students in a round-robin fashion from multiple attribute dimensions; that is, each round selects one student who can fill the current most scarce attribute for allocation, until all students are assigned or all beds are filled. This multi-dimensional rotation strategy ensures a balanced distribution of students across different ethnicities, hometowns, and other dimensions within each dormitory room. The specific implementation process is as follows: Example 1, please refer to Figure 1 This is a flowchart of a one-click student dormitory allocation method provided by an embodiment of the present invention. Figure 1 The flowchart illustrates the main steps and their sequential relationship in steps S1-S5, showing the complete process from data preprocessing and initialization to heuristic round-robin filling, local search optimization, and final result output. The input-output relationship of each step is indicated by connecting arrows. The specific implementation process of the method is as follows: Step S1: Divide students into different subsets based on gender and obtain the data of students to be assigned.
[0036] In this embodiment of the invention, before obtaining the student data to be assigned, students are divided into different subsets based on gender. The process includes: standardizing the input student information, which involves unifying the encoding of fields such as ethnicity and major, and standardizing various encoding formats. Simultaneously, the last name and the first letter of the first name are extracted from the student's name for subsequent conflict detection, and special identity labels are added, such as students with accessibility needs, counselors, or dormitory heads. After standardization, the student dataset is divided into different subsets based on gender, such as subsets of different dormitory buildings or floors, to prepare for bed allocation in subsequent steps, such as separate processing for male and female students.
[0037] It should be noted that in order to implement student dormitory allocation, a corresponding data model needs to be defined, including student data, dormitory room data, and strategy parameter configurations, etc. Please refer to [the relevant documentation / reference]. Figure 2 This is a schematic diagram illustrating the data structure and field relationships involved in the present invention, showing the relationship between student data, dormitory room data, and strategy parameters. The diagram can be represented using an entity-relationship diagram (ER diagram) to show the Student and Room tables and their main fields, as well as how the strategy parameters affect the allocation algorithm. For example, lines can be used to represent the correspondence between student records and their respective dormitories, and the impact of strategy parameters on the algorithm's allocation process.
[0038] Examples of fields in each data table are as follows: Table 1 shows the suggested fields for the Student table.
[0039] Table 2 provides suggestions for Room fields.
[0040] Table 3 provides suggestions for the Policy field.
[0041] Step S2: Initialization. Based on the preset strategy parameters, estimate the global and target distribution of student data to be assigned on each floor, and set the random number seed.
[0042] It should be noted that during the initialization process, the distribution of all students by ethnicity, place of origin, etc., is calculated, and the estimated number of students of each category that each dormitory room should contain under ideal equilibrium conditions is estimated and used as a reference for allocation. Setting a random number seed is to ensure the reproducibility of the algorithm's operation. In the initial allocation state, all students are unassigned and all beds are vacant.
[0043] Step S3, heuristic allocation, adopts a multi-dimensional attribute bucket rotation strategy to allocate students to dormitory beds based on the target distribution. By using a preset threshold, the excessive concentration of names and classes within the same dormitory is suppressed, and the initial allocation results are obtained.
[0044] It should be noted that the objectives and principles followed by this invention in dormitory allocation include: Strict constraints: Dormitory buildings, floors, and rooms are strictly divided according to gender; the actual number of occupants in each dormitory room does not exceed the bed capacity, and the designated requirements for special room types such as accessible rooms are met.
[0045] Soft objectives (weighted): While meeting hard constraints, maximize the diversity and fairness of student composition within dormitories. This includes promoting a balanced ethnic distribution and diverse student origins, preventing excessive concentration of students with the same surname in the same room, and ensuring a moderate mix of majors or classes within the dormitory (avoiding all students in a dormitory coming from the same class). These soft objectives can be weighted and balanced as needed.
[0046] Project implementation requirements: The algorithm should be able to run automatically with one click, and the results of each run should be consistent (to achieve reproducibility by setting a fixed random seed), be able to record complete logs to ensure traceability of the implementation process, and be able to provide reasonable explanations for the allocation results.
[0047] In this embodiment of the invention, a multi-dimensional attribute bucket rotation strategy is adopted to allocate students to dormitory beds based on the target distribution, including: In each round of selection, a student is chosen to fill the most scarce attribute and assigned to a dormitory, continuing until the allocation ends, which includes all students being assigned or all beds being filled. This invention, through a multi-dimensional attribute bucket rotation strategy, can maximize the balanced distribution of each dormitory across dimensions such as ethnicity and place of origin.
[0048] Specifically, students are gradually assigned to dormitory rooms according to the principle of prioritizing the scarcest attribute; based on the current allocation of each dormitory, students with the scarcest attribute are dynamically selected to fill the dormitory. The attribute in the "prioritizing the scarcest attribute" principle is included in the strategy and parameters.
[0049] For example, if it is found that the ethnic groups of students already assigned to a dormitory are relatively homogeneous, then students from different ethnic groups will be selected from the unassigned students to be assigned to that dormitory. Or, if the proportion of students from a certain province is high in a dormitory, then students from other provinces will be selected to be placed in that dormitory in the next step, thereby increasing regional diversity.
[0050] Each time students are selected, efforts are made to avoid assigning too many students with the same surname to the same dormitory. For example, if there is already a student with the surname "Wang" in a dormitory, students with different surnames will be selected in this round to gradually suppress potential name conflicts.
[0051] Step S4, Local Search Optimization: Within a preset range, student dormitories in the initial allocation results are swapped and adjusted to improve the global objective function value. Local search optimization is then performed on the allocation results to obtain the final allocation results.
[0052] Please refer to the following: Figure 3 This diagram illustrates the local search swap optimization process according to an embodiment of the present invention, demonstrating how swapping students between two dormitories improves allocation during the local search phase. Arrows in the diagram indicate that a student from dormitory A is swapped with a student from dormitory B; after the swap, the diversity index of both dormitories is improved. This diagram helps to understand how 2-opt / 3-opt swap operations optimize the combination of members within dormitories to improve the global objective function value.
[0053] In this embodiment of the invention, the local search optimization is limited to the dormitory area of the same gender, usually within the same dormitory building, and if necessary, it can be further limited to the same floor, so as not to violate hard constraints or introduce management complexity.
[0054] In this embodiment of the invention, adjusting the student dormitories in the initial allocation results within a preset range includes: Based on a preset local search and exchange strategy, the system iterates through a loop, selecting a preset number of students for dormitory exchange each time. If the exchange improves the global score, the local exchange is accepted; otherwise, it is not accepted. When the number of iterations is met or the global score no longer improves, the local search terminates, and the final allocation result is obtained.
[0055] It should be noted that this invention adopts a 2-opt or 3-opt local search and exchange strategy, that is, each time 2 or 3 students are selected locally and their dormitories are exchanged. If the exchange can improve the overall score, the exchange is accepted.
[0056] In this embodiment of the invention, the local exchange does not involve the movement of students in different buildings or on different floors, and no adjustments are made to the special reserved beds, such as the fixed beds of counselors and dormitory heads.
[0057] In the embodiments of the present invention, please refer to Figure 4 This diagram illustrates the objective function and weight relationships in this invention, showing the contribution of each sub-objective (ethnic diversity, origin diversity, surname conflict penalty, class concentration penalty) to the total score in the global scoring model. The diagram uses curves or pie charts to illustrate different weights, for example. , , , This invention examines the impact of different values on the overall score and how to balance various objectives under weighted summation. It defines a set of weighted multi-objective scoring functions to evaluate the merits of dormitory allocation schemes. Using each dormitory room *r* as the granularity, the global scoring function is defined as follows: in This indicates the ethnic diversity of dormitory r. This indicates the diversity of student origins in dormitory r. This indicates a surname conflict penalty for dormitory room 'r'. This represents the concentrated punishment for dormitory r within a given class. The goal of the global score is to maximize the global score. Value, improve diversity indicators, and reduce conflict penalties. , , , They are respectively , , , The weighting coefficients.
[0058] It should be noted that, Generally, diversity objectives ( , The weight is set at 70%–80% of the total weight, and the conflict penalty target ( , This accounts for 20% to 30% of the total, with further adjustments made based on specific needs. Adjustment. For example, in scenario 1, the following was used. , , ,, Configuration.
[0059] Ethnic diversity: In this embodiment of the invention, the composition of ethnic diversity among students in dormitory r can be measured using the information entropy calculation formula. ,in Dormitory r The Middle g The proportion of students from each ethnic group The number of students from this ethnic group. Room capacity, A higher value indicates a more diverse ethnic composition in the dormitory.
[0060] In alternative implementations, the following methods may also be used: Simpson Index (D=1- Using ) to represent diversity has a similar effect.
[0061] Diversity of student origin: It should be noted that when measuring dormitory... r The degree of diversity of endogenous origin. Its calculation method is similar to that of ethnic diversity, simply replacing the category with the student's province or region. Information entropy or... Simpson The index is used to measure and ensure that each dormitory can accommodate students from different regions as much as possible.
[0062] Recommended parameter k for student origin diversity target: It is recommended to take a value between 2 and the dormitory room capacity. k=2 means that each dormitory has students from at least 2 different provinces (to prevent all students from coming from the same province); for dormitories with larger capacity, k can be appropriately increased according to the actual student origin situation to pursue higher regional diversity.
[0063] Surname conflict penalties: It should be noted that surname conflict penalties reflect dormitory regulations. r The excessive number of students with the same surname in a dormitory can lead to management confusion. When multiple students in the same dormitory share the same surname, name conflict penalties will be imposed. A tiered threshold can be set based on the number and proportion of students with the same surname: for example, a threshold of 50% would be set. When more than half of the students in a dormitory share the same surname, it would be considered a serious surname concentration conflict and subject to a high-weight penalty; if two or more students share the same surname but less than 50%, a general penalty would be imposed. In practice, the degree of conflict can be quantified by calculating the number of pairs of students with the same surname in the room. For example, each pair of students with the same surname would be counted as one conflict; if the first letter of their names is also the same, it would be counted as a conflict with a higher weight. This accumulation would yield the name conflict count for each dormitory. The larger the value, the more serious the conflict between people with the same surname in the dormitory, and therefore the lower the overall score will be.
[0064] Class concentration limits: These are typically set at 50% to 75% of dormitory capacity. For example, in a 4-person dormitory, the limit can be 2 students from the same class (50%); in a 6-person dormitory, the limit can be relaxed to 4 students from the same class (approximately 67%). Specific thresholds can be flexibly adjusted based on school management needs and class composition.
[0065] Class-wide centralized punishment: It should be noted that class-wide centralized punishment P (r) reflects the dormitory r Is there an excessive number of students from the same class in a dormitory? If the proportion of classmates in a dormitory is too high, it reduces the diversity of students within the dormitory and may lead to the formation of cliques, making management difficult. Therefore, this strategy sets an upper limit on class concentration, for example, setting the number of classmates in each dormitory to no more than 50% of the room's capacity. When the actual allocation of classmates in a dormitory exceeds this threshold, the excess will be penalized. The specific calculation can be based on the proportion of students exceeding the threshold, or by using a combination counting method similar to surname conflicts (counting each pair of classmates in the dormitory). . A higher value indicates that there is an over-concentration of classes in the dormitory, resulting in a lower overall score.
[0066] Recommended number of iterations for local search: It is recommended to adjust according to the problem size, generally between 100 and 2000 iterations. When the number of students and beds is small, convergence can be achieved in a few hundred swap iterations; for large-scale allocation problems, the upper limit of iterations can be appropriately increased to obtain a better solution, but too many iterations will increase the computation time, and a trade-off should be made between efficiency and effectiveness.
[0067] Step S5: Based on the final allocation results, generate a dormitory allocation mapping table and an analysis report.
[0068] In this embodiment of the invention, the final output of dormitory allocation results includes a dormitory number / bed number mapping table for each student, as well as explanatory data such as rating information and diversity indicators for each dormitory. Simultaneously, the strategy parameters used in this allocation, the random seed, and the operation log of the entire allocation process are saved and archived for future auditing, traceability, or rerunning to reproduce the same results. The final allocation results can be generated into a report or provided to relevant management personnel for review through a visual interface.
[0069] Example 2: Please refer to Figure 5 This invention provides a one-click student dormitory allocation device. Figure 5 The diagram illustrates the main modular components and data flow of this dormitory allocation invention. The diagram includes a strategy configuration module, data verification module, heuristic allocation module, local optimization module, result auditing / reporting module, and rollback / replay module. The data flow and control relationships between modules are indicated by arrows. The main modules and functions of the device are as follows: Strategy configuration module: Used to set and manage the strategy parameters for dormitory allocation (such as the weights of each target). , , , (and related thresholds, etc.), and provide the configuration to the execution part of the allocation algorithm.
[0070] Data validation module: Before the allocation begins, the imported student and dormitory data are validated for completeness and correctness. This includes checking whether the data format is standardized, whether required information is missing, and verifying basic constraints such as whether the dormitory gender allocation is correct, to ensure that the input data is legal and valid.
[0071] Heuristic Allocation Module: This module performs initial allocation according to predetermined strategy parameters (corresponding to steps S1-S3 above), assigning students to dormitory rooms. It implements a multi-dimensional bucket round-robin heuristic algorithm, placing students in optimal dormitories one bed at a time, initially satisfying various constraints and objective requirements.
[0072] Local search optimization module: Further optimizes and adjusts the initial allocation results (corresponding to step S4 above). This module is responsible for executing the local exchange algorithm, which improves the overall allocation score by exchanging students within the dormitory while ensuring that the hard constraints are not violated.
[0073] The Results Audit and Reporting module performs statistical analysis on the final allocation results, generating evaluation reports and visualizations for various indicators. For example, it generates diversity indicator charts for each dormitory, conflict situation descriptions, etc., and provides them to administrators for review and decision-making. This module is also responsible for compiling algorithm execution logs, supporting post-event auditing.
[0074] Rollback and Replay Module: Used to save and manage key data (including input, parameter configuration, random seed, algorithm log, etc.) during a complete allocation process. When needed, it can roll back and undo specific allocation results, or replay the entire allocation process based on the saved data to reproduce the results at that time, which is convenient for debugging and verification.
[0075] Based on the above embodiments, examples of applicable scenarios include: Scenario 1: Centralized Accommodation and Assignment of New Students This invention addresses a dormitory allocation scenario for a university's new students during a concentrated move-in period. For this scenario, the method of this invention sets the weight parameters for each objective as follows: , , , This invention emphasizes ethnic and regional diversity and sets the upper limit of local search iterations to 500. After running the algorithm, an initial allocation scheme that satisfies all hard constraints is obtained, and various indicators are further improved through local exchange optimization. Results show that, compared with the allocation scheme without optimization, the method of this invention significantly increases the ethnic diversity entropy of dormitories, increases the average number of student provinces per dormitory, and significantly reduces the conflict rate of students with the same surname in the same dormitory. This demonstrates the effectiveness of the algorithm of this invention in improving the fairness and diversity of dormitory allocation.
[0076] Scenario 2: Care Strategies for Ethnic Minority Students
[0077] For universities with a significant proportion of ethnic minority students, this invention provides a special strategy to cater to their accommodation needs. In this embodiment, a soft objective is added to the strategy parameters: each dormitory room must accommodate at least one ethnic minority student but no more than two, ensuring that ethnic minority students do not feel isolated or overcrowded. Simultaneously, during dormitory allocation, ethnic minority students are prioritized for placement on floors near specific service facilities, such as halal restaurants or ethnic activity centers, to facilitate their lives. The algorithm of this invention adjusts the heuristic allocation process accordingly, achieving a more even distribution and better care for ethnic minority students while satisfying general diversity objectives.
[0078] Scenario 3: Handling Special Room Types and Reserved Beds
[0079] In some scenarios, dormitory allocation needs to consider special room types and reserved beds. This embodiment demonstrates the handling strategy for accessible rooms and beds reserved by counselors / dormitory heads. For disabled students with accessibility needs, the algorithm prioritizes matching them to dormitory rooms with accessible facilities during the initial allocation and locks the corresponding beds in those rooms, excluding them from subsequent adjustments and exchanges for general students. This ensures that disabled students receive suitable living conditions. For beds that dormitory counselors or dormitory heads need to reserve, the algorithm treats these beds as pre-fixed, occupying them but not allocating them to ordinary students, and they are not involved in exchange operations during the local optimization phase. Through these measures, the method of this invention can balance the fair allocation of special needs and general students, ensuring the feasibility and rationality of the allocation results.
[0080] Scenario 4: Strategies Differences Among Different Types of Universities
[0081] This embodiment compares the strategy configuration differences of the method of the present invention in different types of universities. For a typical comprehensive urban university, since the vast majority of the student body is Han Chinese, the ethnic diversity is relatively limited. Therefore, the weight of the ethnic diversity target can be appropriately reduced. The weight given to increasing the diversity of student origins The algorithm places greater emphasis on mixing students from different provinces and cities into the same dormitory. At the same time, it retains restrictions on surname conflicts and class concentration to avoid extreme imbalances. For example, if over 95% of the freshmen at a university in a city are Han Chinese, the algorithm primarily focuses on mixing students from different provinces and classes to ensure that each dormitory has students from multiple provinces who are not all classmates.
[0082] Conversely, for a university with a high proportion of ethnic minority students (such as a university with a diverse range of ethnic groups), the strategy assigns a higher weight α to ethnic diversity to ensure that each dormitory room is composed of students from different ethnic groups as much as possible, avoiding a dormitory room being "dominated" by students of the same ethnicity. Furthermore, in conjunction with the strategy described in Example 2, additional distribution constraints can be set for ethnic minority students (e.g., at least one but no more than two students from a particular ethnic minority per dormitory room) to ensure mutual support among ethnic minority students while also encouraging their integration into a broader community. In summary, by adjusting the aforementioned weighting parameters and constraints, the method of this invention can flexibly adapt to the dormitory allocation needs of different universities: emphasizing regional and class diversity in environments with a homogeneous ethnic composition, highlighting ethnic balance in environments with a diverse ethnic composition, while also considering fairness in other dimensions.
[0083] Performance metrics and comparative experiments: To verify the effectiveness of the dormitory allocation method of this invention, several performance indicators were evaluated and compared. The main evaluation indicators include: Diversity indicators: These measure the degree of diversity in student attributes among dormitory assignments. For example, they can calculate the ethnic diversity entropy of each dormitory, the number of provinces of origin covered by each dormitory, and the overall degree of distribution balance (which can be represented by the Gini coefficient, indicating the magnitude of differences in diversity levels among dormitories).
[0084] Management indicators: These measure the impact of allocation outcomes on dormitory management. Examples include the proportion of students sharing the same surname in the same dormitory (surname conflict rate), and, under stricter conditions, the proportion of students sharing the same surname and the same first letter (serious name clustering rate). These indicators reflect the potential degree of management confusion.
[0085] Efficiency metrics: These measure the efficiency and convergence of an algorithm, including the time required for the algorithm to run and the convergence curve of the local search iterations (used to observe the convergence speed and stability of the optimization process).
[0086] Baseline Comparison Scheme: As a control, the method of the present invention is compared with several traditional allocation strategies, such as completely random allocation, allocation based on the order of registration (first come, first served), and simple rule allocation based solely on class. By comparing these baseline schemes, the improvement of the method of the present invention in various objectives can be quantified.
[0087] In a series of simulated tests, the method of this invention was compared and evaluated with the aforementioned baseline scheme. The test scenario was: 500 new students moved into dormitories, representing 5 ethnic groups and coming from 20 different provinces; several dormitory buildings were used, with a total of 100 four-person dorm rooms. Compared with baseline methods such as random allocation, the method of this invention has significant advantages in both diversity and management indicators. For example, the method of this invention increases the average ethnic diversity entropy value per dormitory by about 30%, increases the average number of provinces of origin per dormitory from about 2.2 in the baseline scheme to 3.8, and reduces the conflict rate of students with the same surname in the same dormitory from about 30% to less than 10%. At the same time, even with the addition of local optimization steps, the algorithm's running time is still only a few seconds, which fully meets the requirements of practical applications. The following table provides comparison examples of some indicators between the method of this invention and the random allocation scheme: Table 4 shows the comparison results between the random allocation scheme and the method of the present invention.
[0088] By comparison, it can be found that the method of the present invention, while maintaining operational efficiency, significantly improves the diversity and fairness of dormitory allocation and reduces management difficulty.
[0089] Deployment and Implementation
[0090] The dormitory allocation algorithm of this invention can be integrated into the dormitory management system of universities as a backend service, and provided to administrators through a standard interface. This invention can be deployed in the form of "backend service + REST API": administrators submit student lists, dormitory room lists, and policy configurations (e.g., via JSON files) as input to this invention; after running the algorithm, this invention outputs the dormitory allocation mapping results, as well as corresponding dormitory allocation reports and logs.
[0091] To facilitate user understanding and utilization of the results, this invention also provides visualization functions. For example, it generates a heat map of dormitory floors based on the allocation results to visually display the distribution of diversity indicators for each floor; it also provides a statistical dashboard to display a summary view of key indicators such as overall ethnic diversity entropy, student origin distribution, and conflict rate. Because this invention saves complete parameter snapshots and random seeds, administrators can replay a round of allocation results through the rollback and replay module if needed, thereby facilitating comparison of different strategies or review and verification of allocation schemes.
[0092] Compliance, privacy, and fairness: Minimizing data usage and de-identification: This invention only collects and uses necessary student information directly related to dormitory allocation (such as the student table fields mentioned above), and does not use sensitive information unrelated to allocation. During the algorithm solving stage, student identities are de-identified, for example, by using internal IDs instead of names, to protect personal privacy.
[0093] Access Control and Data Encryption: This dormitory allocation system implements strict access control for both student and outcome data, allowing only authorized personnel access. Sensitive information in the database is stored encrypted, and data transmission uses secure protocols such as TLS to prevent data leakage.
[0094] Fairness Assessment and Auditing: This invention generates a fairness assessment report along with the allocation results, checking for any adverse biases against certain groups (e.g., allocation differences based on ethnicity or region). Furthermore, this invention fully records all strategy parameters and exchange operations performed during the allocation process, ensuring that every decision is traceable. Through log retention and auditing mechanisms, it can be verified that the algorithm did not introduce any discriminatory bias during execution, guaranteeing the fairness and impartiality of the allocation process.
[0095] Replaceable and expandable solutions: The method of the present invention can also be modified and extended in various ways to adapt to different needs or further improve performance, for example: Mathematical optimization approach: Optionally, a 0-1 integer linear programming (ILP) model can be used to globally optimize the dormitory allocation problem. Solving the ILP model can yield the globally optimal allocation scheme, but due to its high computational complexity, it is usually only suitable for situations with a small number of students.
[0096] Intelligent Search Algorithms: In addition to the heuristic + local search mentioned above, the allocation scheme of this invention can also be implemented by combining other intelligent optimization algorithms. For example, meta-algorithms such as simulated annealing, genetic algorithms, or tabu search can be used to find better allocation schemes globally. With sufficient computational resources, these algorithms have the potential to further improve the objective function score.
[0097] Optimization Objective Expansion: The framework of this invention is highly flexible, allowing for the addition of new optimization objectives or constraints as needed. For example, factors such as students' similarity in daily routines, distribution of clubs / specialties, scholarships, or course schedules can be incorporated to make the allocation more personalized and humane. These new objectives can be integrated into the existing objective function by adjusting weights or adding new scoring items.
[0098] Dynamic scheduling scenarios: The method of this invention is not only applicable to the initial allocation of new students, but can also be extended to dynamic dormitory adjustment scenarios. For example, when students need to withdraw or change dormitories during the semester, an incremental algorithm can be run on the basis of the existing allocation to re-optimize and adjust local dormitories, achieving a smooth transition in dynamic allocation.
[0099] Recommended key parameters and their ranges: Some key parameters in this invention can be adjusted according to different situations. The recommended value ranges are as follows: Weighting coefficients α, β, γ, and δ: The four weights should be between 0 and 1, and satisfy α + β + γ + δ = 1. Based on experience, the diversity objective (α, β) weights can generally be set to 70%–80% of the total weights, and the conflict penalty objective (γ, δ) weights to 20%–30%, with further adjustments made according to specific needs. For example, in Example 1, a configuration of α = 0.45, β = 0.35, γ = 0.15, and δ = 0.05 was used.
[0100] The target value for diversity of student origin, k, is recommended to be an integer between 2 and the dormitory room capacity. k=2 means that each dormitory room has students from at least 2 different provinces (to prevent all students from coming from the same province); for dormitories with larger capacities, k can be appropriately increased according to the actual student origin situation to pursue higher regional diversity.
[0101] Class concentration limits: These are typically set at 50% to 75% of dormitory capacity. For example, in a 4-person dormitory, the limit can be set at no more than 2 students from the same class (50%); in a 6-person dormitory, the limit can be relaxed to 4 students from the same class (approximately 67%). Specific thresholds can be flexibly adjusted based on school management needs and class composition.
[0102] Local search iteration count: It is recommended to adjust according to the problem size, generally between 100 and 2000 iterations. When the number of students and beds is small, convergence can be achieved in a few hundred swap iterations; for large-scale allocation problems, the iteration limit can be appropriately increased to obtain a better solution, but too many iterations will increase the computation time, and a trade-off should be made between efficiency and effectiveness.
[0103] Exceptions and fault tolerance: In practical applications, this invention needs to consider various abnormal situations and provide fault tolerance mechanisms: Data Missing or Encoding Errors: If the imported student / dormitory data contains missing information or illegal encoding, such as unrecognizable ethnic codes, this invention will adopt a preset error-tolerance strategy. For example, students who cannot be classified can be temporarily assigned to a temporary group, or the user can be prompted to supplement and improve the data before proceeding with the assignment. Simultaneously, for critical erroneous data such as unknown gender, this invention will suspend the assignment and provide an error message to avoid generating irregular assignment results.
[0104] Insufficient Special Room Resources: When there is a shortage of requested special dormitory rooms, such as accessible rooms, this invention will still complete the allocation of regular students, but will mark the unmet special needs in the results and provide a minimum change suggestion. For example, it may prompt the administrator to add accessible beds on specific floors or adjust the dormitory arrangements for relevant students to meet all needs.
[0105] Constraint Conflict Handling: If certain constraints set in the strategy parameters conflict, preventing the finding of a feasible solution—for example, requiring each dormitory to contain at least two different ethnic groups while also requiring all students to be grouped together by class—this invention will automatically relax lower-priority soft constraints according to agreed-upon priorities until a feasible allocation scheme is found. When a conflict occurs, this invention will also provide an explanation of the conflict situation, helping users understand which constraints contradict each other and which constraint relaxation was adopted to continue the allocation process.
[0106] Obviously, the embodiments described above are merely some embodiments of the present invention, not all embodiments. The accompanying drawings show preferred embodiments of the present invention, but do not limit the patent scope of the present invention. The present invention can be implemented in many different forms; rather, these embodiments are provided to provide a more thorough and complete understanding of the disclosure of the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the patent protection scope of this invention.
Claims
1. A method for one-click allocation of student dormitories, characterized in that, include: Students are divided into different subsets based on gender to obtain data on students to be assigned. Based on the preset strategy parameters, estimate the global and target distribution of student data to be assigned on each floor; A multi-dimensional attribute bucket rotation strategy is adopted to allocate students to dormitory beds based on the target distribution. The initial allocation results are obtained by suppressing the excessive concentration of names and classes in the same dormitory through a preset threshold. Within a preset range, student dormitories in the initial allocation results are exchanged and adjusted to improve the global objective function value. The allocation results are then optimized through local search to obtain the final allocation results. Based on the final allocation results, a dormitory allocation mapping table and analysis report are generated.
2. The one-click student dormitory allocation method according to claim 1, characterized in that, Students are divided into different subsets based on gender. Before obtaining the data of students to be assigned, the following steps are included: The input student information is standardized. The standardization process includes unifying and standardizing the various encoding formats of different fields to obtain standardized encoded data. Extract students' last names and first names from the standardized coded data and label them with special identity tags.
3. The one-click student dormitory allocation method according to claim 1, characterized in that, Based on preset strategy parameters, estimate the global and target distribution of student data to be assigned, including: Based on the distribution of students by ethnicity and place of origin, we initialize the estimated number of students of each type in each dormitory under ideal equilibrium conditions, which is used as a reference for allocation. When the allocation reference was obtained, all students were unassigned and all beds were vacant.
4. The one-click student dormitory allocation method according to claim 1, characterized in that, Students are assigned to dormitory beds based on target distribution, including: allocation based on hard constraints and soft objectives; among which hard constraints include: dividing dormitory buildings, floors and rooms according to gender, ensuring that the actual number of people occupying each dormitory room does not exceed the bed capacity, and meeting the specified requirements for special room types; The soft objectives include: while meeting the hard constraints, improving the diversity and fairness of the student composition in dormitories, including promoting a balanced distribution of ethnic groups and a diverse range of student origins, curbing the excessive concentration of students with the same surname in the same dormitory, and meeting the upper limit threshold for students in the same class.
5. The one-click student dormitory allocation method according to claim 1, characterized in that, A multi-dimensional attribute bucket rotation strategy is adopted to allocate students to dormitory beds based on the target distribution, which also includes: A multi-dimensional attribute bucket rotation strategy is adopted. In each round of selection, a student who can fill the current scarcest attribute is selected for allocation until the allocation ends. The allocation ends when all students have been allocated or the beds are full.
6. The one-click student dormitory allocation method according to claim 1, characterized in that, Within a preset range, student dormitories in the initial allocation results will be exchanged and adjusted, including: Based on a preset local search and exchange strategy, the system iterates through a loop, selecting a preset number of students for dormitory exchange each time. If the exchange improves the global score, the local exchange is accepted; otherwise, it is not accepted. When the number of iterations is met or the global score no longer improves, the local search terminates, and the final allocation result is obtained.
7. The one-click student dormitory allocation method according to claim 6, characterized in that, The global scoring formula is: in Dormitory r ethnic diversity Dormitory r The diversity of student origins Dormitory r Surname conflict penalties Dormitory r Class-wide concentrated punishment; the goal of global scoring is to maximize the overall... Value, improve diversity indicators, and reduce conflict penalties; , , , They are respectively , , , The weighting coefficients.
8. A one-click student dormitory allocation device, used to implement the method of claims 1-7, characterized in that, include: The strategy configuration module is used to set and manage the strategy parameters for dormitory allocation and to provide the configuration to the execution part of the allocation algorithm. The data validation module is used to verify the integrity and correctness of imported student and dormitory data before the allocation begins, ensuring that the input data is legal and valid. The heuristic allocation module is used to perform initial allocation according to predetermined strategy parameters, assigning students to dormitory rooms and obtaining the initial allocation results; The local search optimization module is used to further optimize and adjust the initial allocation results. It is responsible for executing the local exchange algorithm, which improves the overall allocation score and obtains the final allocation result by exchanging students in the dormitory while ensuring that the hard constraints are not violated. The results audit and reporting module is used to perform statistical analysis on the final allocation results and generate evaluation reports and visualizations for various indicators. The rollback and replay module is used to save and manage key data in a complete allocation process. It can roll back and undo specific allocation results as needed, or replay the entire allocation process based on the saved data to reproduce the results at that time.
9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by the processor, this instruction implements the steps of the method as described in any one of claims 1-7.