Method for care unit layout based on rule constraints and two-stage genetic algorithm
By adopting a care unit layout method based on rule constraints and a two-stage genetic algorithm, the automatic plan layout of care units in elderly care facilities is realized, which solves the problem of low efficiency of existing design software in the design of elderly care facilities. The generated scheme meets the needs of existing building renovation and improves design efficiency and scheme quality.
Patent Information
- Application Number
- CN202611402861.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-10
- Publication Date
- 2026-11-24
AI Technical Summary
Existing architectural design software lacks intelligent analysis and automatic layout capabilities in the design of care units for elderly care facilities. The design cycle is long and the output efficiency of the scheme is low. Existing generation algorithms are difficult to combine with the characteristics of elderly care facilities, especially in the renovation of existing buildings, where the generation of results requires a lot of manual intervention.
A care unit layout method based on rule constraints and a two-stage genetic algorithm is adopted. By constructing a rule base and a functional relationship model, the automatic generation, evaluation and optimization of care unit planar schemes are realized, including the acquisition of planar boundary parameters, functional room coding, objective function construction, constraint violation system and genetic algorithm search.
It improves the design efficiency and quality of elderly care facilities, reduces the uncertainty of human judgment, generates solutions that are more in line with the spatial characteristics of existing buildings, provides multiple comparable alternatives, and has good traceability.
Smart Images

Figure CN123158756A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent building design technology, specifically to a care unit layout method based on rule constraints and a two-stage genetic algorithm. Background Technology
[0002] As the basic organizational unit of elderly care facilities, the layout of care units directly affects nursing efficiency, space utilization, and the quality of life for the elderly. Currently, the design of care units mainly relies on building codes, designer experience, and 2D computer-aided design software. The design process typically includes safety evacuation, functional zoning, traffic organization, and the design of nursing stations and service radii. While commonly used architectural design software such as AutoCAD, Revit, and SketchUp can improve drawing efficiency, they are essentially manual drawing tools and lack the intelligent analysis and automatic layout capabilities specific to the layout patterns of care units in elderly care facilities. Designers still need to repeatedly adjust room locations, traffic flow, and nursing service radii based on experience and client needs, resulting in long design cycles and low output efficiency.
[0003] In recent years, parametric design and generative design have been increasingly applied to the field of architectural design, using platforms such as Grasshopper and Dynamo to generate rule-driven building forms. Existing generative algorithms are mainly geared towards building types with clear usage guidelines, such as office buildings, residences, or hospitals. However, for care units in elderly care facilities, there is a lack of corresponding design rules, making it difficult to combine the workflow characteristics of different operators and fully consider the needs of care workflows, differences in the behavioral abilities of the elderly, the radius of care services, and room organization. Especially in the current context of community-based elderly care, most elderly care facilities are converted from existing buildings, and existing generative algorithms struggle to fit the spatial characteristics of existing buildings within the community, often requiring significant manual intervention in the generated results. Summary of the Invention
[0004] The purpose of this invention is to provide a care unit layout method based on rule constraints and a two-stage genetic algorithm. By constructing a rule base, a functional relationship model, and a two-stage genetic algorithm, the method enables the automatic generation, evaluation, and optimization of care unit plan schemes, thereby improving the design efficiency and scheme quality of elderly care facilities.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: A care unit layout method based on rule constraints and a two-stage genetic algorithm is used for automatic plan layout of care units in elderly care facilities. The method includes the following steps: S1: Obtain the planar boundary parameters of the care unit to be laid out, the number and size data of various functional rooms, and the layout principles. S2: Abstract each of the functional rooms into a set of rectangular rooms and encode them using a genetic algorithm; S3: Constructing the objective function for care efficiency and evacuation efficiency objective function And construct a weighted overall efficiency objective function; S4: Establish a constraint violation quantity system, and use the weighted sum of all constraint violation quantities as the total violation quantity; S5: Execution phase A, using the total violation as the fitness, search for feasible solutions that satisfy all constraints and store them in the feasible solution archive; In execution phase B, seed solutions are selected from the feasible solution archive, and a local search is performed with the comprehensive efficiency objective function as the fitness. Solutions that do not meet the constraints are penalized. S6: Output the optimal layout scheme and related evaluation data.
[0006] Further, the genetic algorithm encoding in step S2 is as follows: the center coordinates and rotation variables of the first type of room are encoded, the center coordinates and length and width dimensions of the second type of room are encoded, and the third type of room is attached to the outer boundary with boundary encoding and boundary position encoding.
[0007] Furthermore, in step S3, the objective function for care efficiency... The objective function for evacuation efficiency is represented by the weighted Manhattan distance between rooms with behavioral relationships. The overall efficiency objective function f is characterized by the sum of the management service distance from each room to the nursing station and the evacuation distance to the nearest transportation hub: f = α · / ref + (1 α) · / ref Where α is the care efficiency weight, ref is a reference value for care efficiency. Reference value for evacuation efficiency.
[0008] Furthermore, the constraint violation quantities mentioned in step S4 include boundary constraints, overlapping constraints, edge-fitting rules for public living rooms, area and aspect ratio of public living rooms, room clear zone, evacuation distance, spatial relationship between nursing stations and public living rooms, single-sided clear zone of non-residential rooms, and enclosed blank space. The room clear zone is a continuous clear zone with a set width reserved on the inner side after the room is attached to the outer boundary. The single-sided clear zone of non-residential rooms is a clear zone with a set width reserved on at least one side of the nursing station, public living room, and logistics service room. The enclosed blank space is an unreachable or fragmented remaining space in the plane identified by grid connectivity detection.
[0009] Furthermore, in step S5, an initial population is generated before the execution of stage A. The initial population is generated by a combination of structured initialization and random initialization, prioritizing the generation of initial solutions with features such as adjacent rooms, adjacent activity centers, and nursing stations close to the activity center. Genetic iteration is performed using the total violation amount V as the fitness. When V ≤ a preset threshold, the solution is determined to be a feasible solution and stored in the feasible solution file. When the number of feasible solution files reaches the preset target number and no improvement occurs within several consecutive generations, stage A is terminated early.
[0010] Furthermore, the schemes in the initial population are repaired through repair functions, including repairing the area of the common living room, the aspect ratio of the common living room, the arrangement of rooms along the boundary, the spatial relationship between the nursing station and the common living room, the overlapping and separation of rooms, the clear zone, and the evacuation distance.
[0011] Furthermore, prior to step S5, upper and lower bounds for decision variables are established: the center coordinates of the nursing station and logistics room are within the plane boundary, and the rotation variable is 0 or 1; the center coordinates of the activity center are within the boundary, and the length and width dimensions are set with reasonable upper and lower limits; each room is limited to the outer boundary through boundary coding and location coding.
[0012] Furthermore, in stage B of step S5, several schemes with the optimal comprehensive efficiency objective value are selected from the feasible solution file as seeds, and a new initial population is generated around the seeds; the mutation probability of stage B is set to be lower than the mutation probability of stage A, and the crossover probability is set to be higher than the crossover probability of stage A; the comprehensive objective function f is calculated only for schemes that meet the constraints, and a penalty value is applied to schemes that do not meet the constraints.
[0013] Furthermore, during the iteration of phase B, multiple feasible solutions with differences are saved through a candidate solution archive maintenance mechanism: the normalized decision vector distance between the new solution and the existing archive solutions is calculated. If the distance is less than a preset minimum difference threshold, it is determined to be a similar solution, and only the one with better overall fitness is retained; if the distance is greater than or equal to the threshold, the new solution is added to the archive as a new candidate solution. The candidate solution archive is sorted according to overall fitness and the maximum capacity is a preset value.
[0014] Furthermore, repeat steps S1 to S6 multiple times for independent execution. Each time, save the planar diagram, the phase A violation convergence diagram, the phase B fitness convergence diagram, the text report, and the data file. After all runs are completed, output the summary of multiple run results, the optimal run number, the optimal overall efficiency target value, and the corresponding sub-target values and constraint values.
[0015] The beneficial effects of this invention are: (1) Parametric Representation of Rules. In existing design processes, factors such as care procedures, operation models, elderly people's behavioral abilities, and service radii usually rely on human experience for judgment, resulting in relatively vague rule representation. This invention transforms factors such as the number of rooms, room dimensions, functional relationship strength, activity center area and aspect ratio, room lighting, corridor or clear zone width, and distance from the room to the traffic core into algorithm parameters and constraints, enabling the care unit design rules to be recognized, calculated, and verified by the program, thus reducing the uncertainty of human judgment.
[0016] (2) Adaptation to existing buildings. This invention can directly incorporate the boundary conditions and spatial constraints of existing buildings into the layout generation model. By setting conditions such as planar boundaries, fixed traffic cores, room sizes, edge-fitting rules, and upper limits of evacuation distances as constraints, the generated scheme is always controlled by the spatial conditions of the existing buildings during the algorithm optimization process, making the generated results more in line with the actual design requirements when existing buildings are transformed into elderly care facilities.
[0017] (3) Comprehensive performance evaluation and automatic optimization. This invention divides the optimization process into two stages: Stage A and Stage B. Stage A uses the total violation as the fitness and prioritizes searching for feasible solutions that meet conditions such as boundary, non-overlap, lighting, clearance, area, aspect ratio, and evacuation distance. Stage B further calculates care efficiency and evacuation efficiency targets based on feasible solutions and optimizes them according to comprehensive weights. By separating feasibility search from comprehensive target optimization, invalid searches are reduced, the efficiency of generating feasible solutions is improved, and the final solution takes into account both nursing service efficiency and safe evacuation efficiency.
[0018] (4) Multiple Solution Outputs and Traceability. This invention controls repeated solutions by normalizing the decision vector distance and sorts candidate solutions according to the comprehensive fitness, avoiding the results from concentrating on a single local solution and providing designers with multiple comparable alternative solutions. At the same time, through multiple independent runs, each run saves the plan view, convergence diagram, text report and data file, and outputs a summary of the results of multiple runs after all runs are completed, making the optimization process and result evaluation have good traceability. Attached Figure Description
[0019] Figure 1 This is a flowchart of the core steps of the care unit layout method of the present invention; Figure 2 This is a better layout diagram after multiple runs of the present invention in a specific scenario instance; Figure 3 This is the violation quantity and convergence graph of the operation stage A in a specific scenario instance of the present invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention are within the scope of protection of the present invention.
[0021] Embodiments of the present invention: This invention presents a care unit layout method based on rule constraints and a two-stage genetic algorithm. It abstracts each functional room into a set of rectangular rooms and encodes the center coordinates, orientation, and boundary positions of the rooms into genetic algorithm chromosomes. It transforms spatial design rules such as the strength of nursing behavior connections and evacuation path distances into objective functions and constraint violations. Through a genetic algorithm that includes feasibility search and comprehensive efficiency optimization functions, it obtains a layout scheme that satisfies the design rules and has better overall efficiency.
[0022] like Figures 1 to 3 As shown, the care unit layout method of this invention based on rule constraints and a two-stage genetic algorithm specifically includes: Step S1: Determine key parameters and room data The research object of this invention can be abstracted as a rectangular planar boundary with length A and width B, within which several functional rooms are arranged, the total number of which is denoted as N. Functional rooms include nursing stations, public living rooms (also serving as dining rooms), logistics service rooms, evacuation stairwells, and elderly residents' rooms, etc., wherein the evacuation stairwells can be set in fixed or variable locations according to existing building conditions. Based on relevant building codes, parameters such as the width of the corridor or clear space in the rooms, the clear space width on one side of non-residential rooms, the minimum area of the public living room, the maximum length-to-width ratio of the public living room, and the upper limit of the center distance from the room to the nearest evacuation stairwell entrance are set, and the basic principles of layout are clearly defined. The above parameters can be adjusted according to the specific scale of the existing building, the operator's functional configuration, local code requirements, and actual design conditions to enhance the applicability of the method.
[0023]
[0024] Step S2: Encoding decision variables The solution to be optimized is represented as a decision vector X: X = [xi, yi, zi, ai, bi, er, pr, … ]
[0025] Nursing stations and support rooms are coded using center coordinates and rotational variables, while public living rooms are coded using center coordinates and length and width variables. Bedrooms are automatically attached to the outer boundary using a "boundary code + boundary position code" method. Evacuation stairwells can be considered as fixed rooms based on the existing building structure and are not included in the variable decision variables. The variable dimension is the total number of variables after expanding all optimizable parameters.
[0026] Step S3: Determine the objective function (1) Objective function for care efficiency: Care efficiency objective function It is represented by the weighted Manhattan distance between rooms with behavioral relationships.
[0027]
[0028]
[0029] Room connectivity strength (W) expresses the frequency or functional association between care, activities, logistics, and living quarters. A smaller weighted distance indicates a shorter care service path and higher care efficiency. Connectivity strength is calculated by summing the interactions (number of round trips) between different rooms throughout the day; the strength increases by 1 for each interaction.
[0030] (2) Evacuation efficiency objective function : Evacuation efficiency targets consider the distance a resident can travel from their residence to the nearest traffic hub in an emergency, while preserving the administrative service distance from the nursing station to the residence. Each residence's evacuation item consists of the distance from the nursing station to that residence and the distance from that residence to the nearest traffic hub.
[0031]
[0032]
[0033] (3) Overall efficiency objective function: Due to care efficiency With evacuation efficiency Since the units and numerical scales are different, the program first estimates the reference value. ref and Then, normalize and weight the result. The overall objective function is: f = α · / ref + (1 α) · / ref
[0034] Step S4: Determining Constraints and Establishing Functions To enable the algorithm to automatically select feasible solutions, the program transforms the design rules into quantifiable violation quantities (detail) and constructs the total violation quantity (totalViolation).
[0035] V = wb·Vboundary + wo·Voverlap + wa·VactivityA + ws·Vstrip + we·Vegress + wn·VnurseActivity + wc·VroomSideClear + wv·VenclosedVoid + …
[0036] Step S5: Solve using genetic algorithm Step S5.1: Input the planar boundary, number of rooms, room size, fixed traffic core location, care connection strength matrix W, clearance zone width, activity center area and proportional threshold, maximum evacuation distance, comprehensive weight, and genetic algorithm parameters.
[0037] Step S5.2: Construct upper and lower bounds for decision variables The center coordinates of the nursing station and logistics rooms are within the plane boundary, and the rotation variable is 0 or 1; the center coordinates of the activity center are within the boundary, and the length and width dimensions are set with reasonable upper and lower limits; each room is limited to the outer boundary by boundary coding and location coding.
[0038] Step S5.3: Generate the initial population and decode it into a planar scheme. The program uses a combination of structured and random initialization to generate initial schemes with features such as adjacent rooms, adjacent activity centers, and nursing stations close to the activity center. The repairSolution function is used to repair the activity center area, proportion, room order, relationship between nursing stations and the activity center, overlap and separation, clearance zone, and evacuation distance.
[0039] Step S5.4: Phase A, conduct a feasibility study. Under the constraints of building boundaries, non-overlapping rooms, area and aspect ratio of public living rooms, lighting and headroom in elderly rooms, and evacuation distance, feasible floor plan layouts are searched. The population size, maximum number of iterations, elite retention count, crossover probability, and mutation probability at this stage can all be set by the user according to the optimization problem size and computational accuracy requirements. The population size controls the number of solutions participating in the search simultaneously in each generation; a larger population size allows for a wider search range but also increases computation time. The maximum number of iterations limits the algorithm's search depth; more iterations are more conducive to obtaining stable feasible solutions but increase runtime. The elite retention count retains the best-performing individuals in the current generation, preventing the loss of superior solutions during genetic operations. The crossover probability controls the degree of information exchange between different solutions; a higher crossover probability is beneficial for combining the advantages of different layouts. The mutation probability enhances the ability to handle random perturbations and prevents the algorithm from getting trapped in local searches.
[0040] During implementation, Phase A can be configured with parameters such as population size, maximum iterations, elite retention count, crossover probability, and mutation probability. The fitness function for Phase A is set as the total violation value V, which is the weighted sum of the degree of violation of each constraint as the evaluation criterion. When If the proposed solution is deemed to basically satisfy all constraints, it is added to the feasible solution archive. If the feasible solution archive reaches the preset target number and no significant improvement is observed within several consecutive generations, it indicates that the feasible solution search has stabilized, and phase A can be terminated early to improve the algorithm's efficiency.
[0041] Step S5.5: Perform comprehensive efficiency optimization in stage B. Phase B, building upon the feasible solutions obtained in Phase A, further optimizes feasible planar solutions with a comprehensive objective of balancing care and evacuation efficiency. The population size, maximum number of iterations, elite retention count, crossover probability, and mutation probability in this phase can also be set according to actual needs. Compared to Phase A, Phase B emphasizes more refined local searches within the feasible solution space, thus allowing for a slight reduction in mutation probability to maintain solution stability; simultaneously, a higher crossover probability enables the recombination of advantageous layout features from different feasible solutions.
[0042] During implementation, Phase B selects several seed solutions from the feasible solution archive and generates a new initial population around these seed solutions. Phase B allows setting parameters such as population size, maximum iterations, elite retention count, crossover probability, and mutation probability. Phase B only calculates the comprehensive objective function f for solutions that meet the constraints, where f is a weighted combination of care efficiency and evacuation efficiency objectives; if a solution does not meet the constraints, its fitness is set to... This is achieved by using a larger penalty value to reduce the probability of the selected and retained solution, thereby ensuring that the final output solution not only meets the spatial layout rules but also has better overall efficiency.
[0043] Step S5.6: Candidate Solution File Maintenance To avoid the algorithm retaining only a single solution and to enhance the diversity of output results, the program sets up a candidate solution archive to save and filter feasible solutions. The maximum capacity, minimum difference distance, and sorting rules of the candidate solution archive can all be set according to actual needs. The maximum capacity controls the number of candidate solutions ultimately retained; the minimum difference distance determines whether two candidate solutions are too similar, preventing a large number of duplicate layouts from occupying archive space; and the sorting rules prioritize candidate solutions based on their overall fitness.
[0044] During implementation, the candidate solution archive is maintained using the `tryAddToArchive` function. This function first determines whether a new solution meets the feasibility requirements, and then calculates its normalized decision vector distance with existing solutions in the archive. If the new solution is too close to an existing solution, they are considered similar layouts, and only the solution with the better overall fitness is retained. If the new solution has sufficient differences from existing solutions, it is added to the archive as a new candidate solution. The program can retain a maximum of 40 solutions in the candidate solution archive, sorted from best to worst overall fitness, thus providing a basis for subsequent solution comparison, result display, and output of the optimal solution.
[0045] Step S6: Run multiple times and output results In this embodiment, runCount=10 is set. Each run saves the planar graph, the phase A violation convergence graph, the phase B fitness convergence graph, the optimal seed fitness graph, a text report, and an Excel spreadsheet. After all runs are completed, the output includes a summary of the 10 results, the optimal run number, the optimal obj, and the corresponding... , Various constraint values and MAT data files.
[0046] Application examples of the above methods: In this case, the plan to be optimized is a rectangular study boundary with length A and width B, where A=40 and B=24 (units are meters). A total of N=18 room or space units are set within the plan, including 1 nursing station, 1 activity center, 1 support room, 2 fixed circulation cores, and 13 living rooms. In practical design, this type of care unit needs to simultaneously meet requirements such as rooms not exceeding boundaries or overlapping, direct natural lighting in living rooms, reserved headroom, controlled area and aspect ratio of the activity center, controlled distance between rooms and circulation cores, and spatial connection between the nursing station and the activity center.
[0047] Step S1: Determine key parameters and room data (1) Basic parameter settings: The overall target weight α = 0.60, meaning the care efficiency weight is 0.60 and the evacuation efficiency weight is 0.40; the width of the living room corridor or clear space stripW = 1.9, and the single-side clear space width of non-living rooms roomSideClearW = 1.9; the minimum area of the activity center minActArea = 120, and the maximum aspect ratio maxActRatio = 2.0; the upper limit of the Manhattan distance from any room to the nearest traffic core maxCenterToExit = 25; the grid step size for detecting enclosed void spaces voidGrid = 1.5, and the minimum enclosed void area threshold minEnclosedVoidArea = 2.0. These parameters are used to define the basic design conditions and constraint evaluation criteria for the planar design.
[0048] (2) Room dimensions and fixed space settings: The nursing station measures 8×6, and the support room measures 8×6. The two traffic cores are fixed rooms, each 3×5. The center coordinates of traffic core 1 are (7.3, 15.7), and the center coordinates of traffic core 2 are (32.7, 15.7). The 13 living quarters are all 6×4 and are attached to the top, bottom, left, and right boundaries of the rectangular plane using boundary coding. The activity center, as a variable-size room, has its center coordinates and dimensions determined by an algorithm, but must meet minimum area, maximum aspect ratio, and edge-attached layout rules.
[0049] (3) Connection strength matrix settings: To reflect the care service connections between rooms with different functions, a room connection strength matrix W is established. The connection strength between the nursing station and each living room is 34, between the nursing station and the activity center is 6, and between the nursing station and the support rooms is 3; the connection strength between the activity center and each living room is 8, between the activity center and the support rooms is 2, and between the support rooms and each living room is 4. A higher connection strength indicates a stronger service frequency or functional association between the two types of spaces, and a higher distance penalty in the care efficiency objective.
[0050] Step S2: Construction of decision variables The nursing station and logistics rooms are variable-layout rooms, each coded using a central x-coordinate, a central y-coordinate, and a rotation variable; the activity center is coded using a central x-coordinate, a central y-coordinate, length, and width; the 13 living rooms are coded using boundary codes and boundary position codes respectively. Therefore, the total decision variable dimension D = 3 × 2 + 4 + 2 × 13 = 36. The decision vector can be represented as: X = [x1, y1, z1, x3, y3, z3, x2, y2, a2, b2, e6, p6, ..., e18, p18], where x and y represent the central coordinates, z represents the room's length, width, and orientation selection, a and b represent the activity center's length and width, e represents the living room's attachment to the boundary, and p represents the living room's position along the boundary.
[0051] Step S3: Solve using genetic algorithm Step S3.1: The algorithm first generates the center coordinates, dimensions, and orientation of each room based on the decision vector; Step S3.2: Adjust schemes that do not meet the rules using repair functions, including activity center area repair, activity center aspect ratio repair, activity center edge alignment repair, room boundary ordering repair, nursing station and activity center spatial relationship repair, room overlap and separation, non-room unilateral clearance repair, and room to traffic core distance adjustment. Decoding and repair reduce the number of invalid schemes and improve the efficiency of subsequent genetic search.
[0052] Step S3.3: Phase A Feasibility Study Phase A uses the total violation V as the fitness, and its goal is to prioritize searching for feasible layouts that satisfy all spatial rules. The population size in Phase A is set to 160, the maximum number of iterations is 1400, the elite retention rate is 14, the crossover probability is 0.88, and the mutation probability is 0.16. When the total violation of a certain scheme... If the proposed solution is deemed feasible, it is added to the feasible solution archive. If the number of feasible solution archives reaches a preset number and remains stable for several consecutive generations, then phase A ends prematurely.
[0053] Step S3.4: Stage B Overall Efficiency Optimization After obtaining feasible solution files in Phase A, Phase B selects several seed solutions from the files and generates a new search population around the seed solutions to continue optimizing the combined objective of care efficiency and evacuation efficiency. The population size in Phase B is set to 100, the maximum number of iterations is 600 generations, the elite retention rate is 10, the crossover probability is 0.90, and the mutation probability is 0.10. Phase B only calculates the comprehensive objective function f for solutions that satisfy the constraints; if a solution does not satisfy the constraints, its fitness is set to... This is to reduce the probability that the plan will be retained.
[0054] Step S3.5: Candidate Solution File Maintenance The program maintains a candidate solution archive using the `tryAddToArchive` function, saving feasible and differentiated layout schemes. This function uses normalized decision vector distance to determine whether a new solution is too similar to existing solutions. If similar, the solution with better overall fitness is retained; if the differences are sufficient, it is added to the archive. The candidate solution archive can hold a maximum of 40 solutions, sorted by overall fitness.
[0055] Step S4: Run multiple times and output results Set runCount=10 to run 10 independent optimization runs consecutively. Each run will save the planar graph, the phase A violation convergence graph, the phase B fitness convergence graph, the optimal seed fitness graph, a text report, and an Excel results file.
[0056] The layout method of this invention can transform the floor plan design of elderly care units from an experience-based approach into a technical process that is coded, computable, and iteratively optimized. Its output includes not only the optimal floor plan result, but also the objective function value, constraint violation amount, and convergence process, which facilitates the judgment of whether the scheme meets the rules and whether it has high care efficiency and evacuation efficiency. It can also be used for comparative analysis under different corridor widths, weight ratios, or number of rooms.
[0057] It should be noted that, unless otherwise specified, the embodiments and features described in this invention can be combined with each other.
[0058] 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 embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A care unit layout method based on rule constraints and a two-stage genetic algorithm, used for automatic planar layout of care units in elderly care facilities, characterized in that, Includes the following steps: S1: Obtain the planar boundary parameters of the care unit to be laid out, the quantity and size data of various functional rooms, and the layout principles; S2: Abstract each of the functional rooms into a set of rectangular rooms and encode them using a genetic algorithm; S3: Constructing the objective function for care efficiency and evacuation efficiency objective function And construct a weighted overall efficiency objective function; S4: Establish a constraint violation quantity system, and use the weighted sum of all constraint violation quantities as the total violation quantity; S5: Execution phase A, using the total violation as the fitness, search for feasible solutions that satisfy all constraints and store them in the feasible solution archive; In execution phase B, seed solutions are selected from the feasible solution archive, and a local search is performed with the comprehensive efficiency objective function as the fitness. Solutions that do not meet the constraints are penalized. S6: Output the optimal layout scheme and related evaluation data.
2. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 1, characterized in that: The genetic algorithm encoding in step S2 is as follows: the center coordinates and rotation variables of the first type of room are encoded, the center coordinates and length and width dimensions of the second type of room are encoded, and the third type of room is attached to the outer boundary with boundary encoding and boundary position encoding.
3. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 1, characterized in that: In step S3, the objective function for care efficiency is... The objective function for evacuation efficiency is represented by the weighted Manhattan distance between rooms with behavioral relationships. The overall efficiency objective function f is characterized by the sum of the management service distance from each room to the nursing station and the evacuation distance to the nearest transportation hub: f = a · / ref + (1 a) / ref Where α is the care efficiency weight, ref is a reference value for care efficiency. Reference value for evacuation efficiency.
4. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 1, characterized in that: The constraint violation quantities mentioned in step S4 include boundary constraints, overlapping constraints, edge-fitting rules for public living rooms, area and aspect ratio of public living rooms, room clear zone, evacuation distance, spatial relationship between nursing stations and public living rooms, single-sided clear zone of non-residential rooms, and enclosed blank space. The room clear zone is a continuous clear zone with a set width reserved on the inner side after the room is attached to the outer boundary. The single-sided clear zone of non-residential rooms is a clear zone with a set width reserved on at least one side of the nursing station, public living room, and logistics service room. The enclosed blank space is an unreachable or fragmented remaining space in the plane identified by grid connectivity detection.
5. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 1, characterized in that: In step S5, an initial population is generated before the execution of stage A. The initial population is generated by a combination of structured initialization and random initialization. Initial solutions with features such as adjacent rooms, adjacent activity centers, and nursing stations close to the activity center are given priority. Genetic iteration is performed with the total violation amount V as the fitness. When V ≤ the preset threshold, the solution is determined to be a feasible solution and stored in the feasible solution file. Phase A terminates prematurely when the number of feasible solution files reaches the preset target and no improvement occurs within several consecutive generations.
6. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 5, characterized in that: The initial population is repaired using a repair function, which includes repairing the area of the common living room, the aspect ratio of the common living room, the arrangement of rooms along the boundary, the spatial relationship between the nursing station and the common living room, the overlapping and separation of rooms, the clear zone, and the evacuation distance.
7. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 1, characterized in that: Before step S5, the upper and lower bounds of the decision variables are constructed: the center coordinates of the nursing station and the logistics room are within the plane boundary, and the rotation variable is 0 or 1; the center coordinates of the activity center are within the boundary, and the length and width dimensions are set with reasonable upper and lower limits; each room is limited to the outer boundary through boundary coding and location coding.
8. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 5, characterized in that: In stage B of step S5, several schemes with the optimal comprehensive efficiency objective value are selected from the feasible solution file as seeds, and a new initial population is generated around the seeds; the mutation probability of stage B is set to be lower than that of stage A, and the crossover probability is set to be higher than that of stage A; the comprehensive objective function f is calculated only for schemes that meet the constraints, and a penalty value is applied to schemes that do not meet the constraints.
9. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 8, characterized in that: During the iteration of Phase B, multiple feasible solutions with differences are saved through a candidate solution archive maintenance mechanism: the normalized decision vector distance between the new solution and the existing archive solutions is calculated. If the distance is less than the preset minimum difference threshold, it is determined to be a similar solution, and only the one with better overall fitness is retained. If the distance is greater than or equal to the threshold, the new solution is added to the archive as a new candidate solution. The candidate solution archive is sorted according to overall fitness and the maximum capacity is a preset value.
10. The care unit layout method based on rule constraints and a two-stage genetic algorithm according to claim 1, characterized in that: Repeat steps S1 to S6 to run the program independently multiple times. Each run saves the planar diagram, the phase A violation convergence diagram, the phase B fitness convergence diagram, the text report, and the data file. After all runs are completed, output the summary of the results of multiple runs, the optimal run number, the optimal overall efficiency target value, and the corresponding sub-target values and constraint values.
