Public washroom intelligent layout generation method and system based on generative algorithm
By combining generative algorithms and reinforcement learning, a multi-objective optimal layout for public restrooms is generated, which solves the optimization problem of conflicting objectives such as space utilization, circulation efficiency, privacy and congestion in public restrooms in existing technologies, and improves the robustness and compliance of irregular spaces.
Patent Information
- Application Number
- CN202511674014.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-02-24
AI Technical Summary
Existing technologies struggle to optimize conflicting objectives such as space utilization, circulation efficiency, privacy and congestion, maintenance accessibility, cost and ventilation in the highly defined, complex spaces of public restrooms, which are subject to strict regulations, engineering constraints, and electromechanical limitations. Furthermore, they lack robust adaptability to irregularly shaped or restricted spaces.
A generative algorithm-based approach is adopted to generate a Top-K feasible layout draft through a conditional generative model. Then, a multi-objective iterative approach is performed using a lightweight evaluator-driven RL policy. The policy is fine-tuned by combining a Markov decision process of reinforcement learning and a constrained PPO algorithm to generate an optimized and compliant layout scheme.
It enables iterative trade-offs among multiple objectives in public restroom spaces, generating Pareto-friendly solution sets and significantly improving the robustness and compliance of irregular or constrained spaces.
Smart Images

Figure CN121562015A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent layout technology in building and mechatronics, specifically to a method and system for generating intelligent layouts of public restrooms based on generative algorithms. Background Technology
[0002] For public restrooms, a specific space with strong clauses, engineering requirements, and electromechanical constraints, existing tools either tend to "generate rather than implement," making it difficult to provide clause-level compliance and manufacturability verification, or tend to "verify rather than optimize," failing to provide an explainable optimal trade-off between conflicting goals such as space utilization, circulation efficiency, privacy and congestion, maintenance accessibility, cost and ventilation. Furthermore, they lack robust adaptability to irregular / constrained spaces such as curved or triangular areas, lowered slabs / manholes, and multiple entrances. Summary of the Invention
[0003] To address the aforementioned issues, this application provides a method and system for generating intelligent layouts of public restrooms based on generative algorithms. The method uses a conditional generation model to generate a Top-K feasible initial layout under rule masking, and then uses a lightweight evaluator to drive a multi-objective iteration of the RL strategy to form an automatic verification and repair mechanism that ensures consistency between clauses, geometry, and physics.
[0004] To achieve the objectives of this application, the following technical solution is provided: Firstly, this application provides a method for generating intelligent layouts of public restrooms based on generative algorithms, including: Acquire multimodal data of the public restroom space for which the layout to be generated is to be obtained; the multimodal data includes CAD files, BIM models, point cloud files, and functional requirement data; The multimodal data is parsed to generate parsing results, and a multi-relationship graph of the public restroom space is constructed based on the parsing results; the multi-relationship graph includes a set of nodes, a set of edges, and a set of relationship types for the public restroom space; Based on the constraints of the multi-relationship graph, a preliminary draft of the Top-K nested feasible layout is generated using the latent space diffusion model. Using the initial draft of the Top-K feasible layout as the initial state, a Markov decision process based on reinforcement learning is constructed, and the strategy is fine-tuned through the constrained PPO algorithm to obtain an optimized compliant layout scheme. The optimized compliance layout scheme is subject to clause-level review and topology consistency check.
[0005] A further improvement of this invention lies in the step of parsing the multimodal data to generate parsing results and constructing a multi-relationship diagram of the public restroom space based on the parsing results, including: parsing the CAD file and the BIM model using AutoCAD API and Revit API, extracting information on walls, door openings, pipe shafts, lowered slab areas, and drainage points, and generating a no-entry mask and access grid based on building design specifications; dividing the access grid into connected domains using the walls and door openings as connection points to obtain multiple connected domains, with different connected domains corresponding to different functional areas; marking the corresponding functional area data for each functional area; extracting initial constraint rules based on the functional requirement data; the functional requirement data includes building design specifications, engineering restrictions, and user requirements; the initial constraint rules include geometric constraints, engineering constraints, and functional constraints; and based on the walls, door openings, pipe shafts, lowered slab areas... The system defines structural nodes, region nodes, and component nodes based on drainage point information, functional requirement data, and functional area data, resulting in a node set. Based on the node set, the no-entry mask and access grid, and the initial constraint rules, it generates an edge set and a relationship type set. The edge set includes adjacent edges representing the geometrical adjacency between each component node and each region node, reachable edges representing connectivity on the access grid, line edges representing the visibility relationship between the line-of-sight cone and the occlusion angle, pipeline edges representing the connection feasibility between each component node and the drainage point and ventilation point, and sweep edges representing the potential interference relationship between the door opening / closing trajectory and neighboring objects.
[0006] A further improvement of the present invention is that, after parsing the multimodal data to generate the parsing results and constructing the multi-relationship graph of the public restroom space based on the parsing results, the invention further includes: numerically representing the multi-relationship graph to form a node feature matrix and a multi-relationship adjacency matrix.
[0007] A further improvement of this invention lies in that, based on the constraints of the multi-relationship graph, the generation of a preliminary draft of a Top-K close-fitting feasible layout using a latent space diffusion model includes: integrating the node feature matrix, the multi-relationship adjacency matrix, the forbidden mask, clause-level constraint indicators, user preferences, and target parameter encodings corresponding to functional requirements into a condition vector; generating candidate layouts by combining rule penalty terms with the forward noise addition and reverse noise reduction process of the latent space diffusion model; and outputting a preliminary draft of a Top-K close-fitting feasible layout after initial screening by hard constraints and adsorption by the construction mesh; wherein, the forward noise addition process is as follows: ; in, Let be the conditional probability distribution of the forward noise-adding process, representing a given clean sample. At that time, the first Step-by-step noisy random vector Distribution; Represents the initial clean sample; Representing the The noisy latent vector at each diffusion time step; This is the noise accumulation factor. The value is set to 1000 steps, gradually changing the initial layout vector. Adding noise to form the noise latent vector ; For unit array; The reverse noise addition process is as follows: ; in, Given a reverse transition distribution and the current noise state... and condition vector Model parameters Approximate generation of the previous step The probability distribution; These are the learnable parameters for the denoising network; It is the first and A random vector with each diffusion time step; the dimension is consistent with the training data representation. For diffusion time step index, ; For conditional vectors, The mean is Covariance is The multivariate Gaussian distribution; To predict the mean; For covariance, In order to be in Lowercase symbols are used to indicate values that have been obtained. ; The formula for the training target during the denoising process is as follows: ; in, The total loss function consists of two parts: a denoised MSE term and a rule penalty term. It calculates the expected value of a random variable. This refers to the real noise injected into the forward noise addition; For the network in time step condition The predicted value for noise; This is the rule penalty weight, used to balance the importance of MSE (Mean Squared Error) and rule constraints; Summation of the rule penalty terms; These are the penalties for hard and soft violations.
[0008] A further improvement of this invention lies in that the step of encoding and integrating the target parameters corresponding to the node feature matrix, the multi-relationship adjacency matrix, the forbidden mask, the clause-level constraint index, user preferences, and functional requirement data into a condition vector includes: encoding the node feature matrix and the multi-relationship adjacency matrix into a graph structure feature vector through a GIN network (Graph Isomorphism Network); encoding the forbidden mask into a mask vector through a CNN (Convolutional Neural Network); simultaneously incorporating the clause-level constraint index as a hard constraint rule into the feature vector; encoding the user preferences into a style vector through a text encoder; using the graph structure feature vector as a basis, injecting the target parameters and the style vector as cross-attention keys into the latent space diffusion model through a Cross-Attention mechanism; and injecting the mask vector into the feature layers of U-Net at various scales through a ControlNet-like branch, thus integrating them to form the condition vector. .
[0009] A further improvement of this invention is that the value of K is 8-16; the process of generating candidate layouts through the forward denoising and reverse denoising process of the latent space diffusion model, combined with the rule penalty term, and after initial screening by hard constraints and adsorption of construction mesh, outputs a preliminary draft of Top-K close-fitting feasible layouts, including: sampling using the DDIM (Denoising Diffusion Implicit Models) sampling algorithm to generate 50 sets of candidate layouts; through initial screening by hard constraints, layouts with components located in restricted areas and pipeline connection distances >3000mm are eliminated, retaining 20 sets of candidate layouts, and then adsorbing construction mesh and aligning the door direction with the partition gap so that the door opening direction avoids the components, to obtain a preliminary draft of Top-K close-fitting feasible layouts; wherein, the construction mesh is adsorbed to 5-10cm.
[0010] A further improvement of this invention lies in the following: Using the initial draft of the Top-K close-proximity feasible layout as the initial state, a Markov decision process based on reinforcement learning is constructed, and the policy is fine-tuned using the Constrained Proximal Policy Optimization (PPO) algorithm to obtain an optimized compliant layout scheme. This includes: using the initial draft of the Top-K close-proximity feasible layout as the initial state, extracting global features, object features, and indicator features to construct a state tensor; generating an action mask based on the forbidden mask, boundary, and geometric / pipeline feasibility to shield invalid actions, thus obtaining the masked constrained actions; wherein, the action set includes component translation; rotation; size switching; model replacement; door leaf flipping and repositioning; partition connection or interruption; region rearrangement or exchange; proposing continuous parameters of the masked constrained actions, and passing the continuous parameters through a 5cm... Snap is applied to the construction mesh, an action is executed, and the updated pipeline edges, sweep edges, and reachable edges are determined, resulting in an optimized new layout. A fast evaluator is used to perform a hybrid evaluation on the optimized new layout, obtaining a new index vector and violation markers for reward calculation. The reward function is: ; in, For the reward function; For space utilization, For compliance, For congestion coefficient, For privacy index, For maintenance accessibility, For cost, Strict penalties will be imposed for serious violations; ; ; The optimized compliance layout scheme is obtained by fine-tuning the strategy in 20-50 steps using the constrained PPO algorithm; wherein the objective function of the constrained PPO algorithm is: ; in, For strategy ratio, strategy ratio , For policy networks, For state tensors, Actions constrained by a mask; This is the advantage estimate. Estimated by GAE; The function will scale the strategy. Limited to Within the range.
[0011] A further improvement of this invention is that, taking the initial draft of the Top-K nested feasible layout as the initial state, extracting global features, object features, and indicator features to construct a state tensor includes: The passage grid is encoded using FPN (Feature Pyramid Network) to obtain the global features; the multi-relationship graph is encoded using the GraphSAGE algorithm (graph sampling and aggregation algorithm), and the encoded result is compressed to 512 dimensions through a fully connected layer, and then a mean-pool operation is performed on the nodes to obtain the object features; the current layout of each near-feasible layout draft is quickly evaluated to obtain space utilization, compliance, congestion coefficient, privacy index, maintenance accessibility, and cost, and the space utilization, compliance, congestion coefficient, privacy index, maintenance accessibility, and cost are normalized. The interval is used to obtain the indicator characteristics.
[0012] A further improvement of the present invention is that the method further includes: when a violation is detected during the clause-level review process, the violation is processed in a graded manner; wherein the graded order is as follows: minimum interference local rearrangement, equivalent SKU replacement, channel widening or path rerouting; when a vulnerable point is detected in the cut point or cut edge of the topology graph, a corresponding modification suggestion is generated.
[0013] Secondly, this application provides a public restroom intelligent layout generation system based on generative algorithms, used to implement the above-mentioned public restroom intelligent layout generation method based on generative algorithms, including: The data acquisition module is used to acquire multimodal data of the public restroom space whose layout needs to be generated; the multimodal data includes CAD files, BIM models, point cloud files, and functional requirement data; The graph structure construction module is used to parse the multimodal data to generate parsing results, and to construct a multi-relationship graph of the public restroom space based on the parsing results; the multi-relationship graph includes a set of nodes, a set of edges, and a set of relationship types for the public restroom space; The initial draft generation module is used to generate a Top-K nested feasible layout initial draft based on the constraints of the multi-relationship graph and using a latent space diffusion model; The compliance optimization module takes the initial draft of the Top-K feasible layout as the initial state, constructs a Markov decision process based on reinforcement learning, and fine-tunes the strategy through the constrained PPO algorithm to obtain the optimized compliance layout scheme. The compliance early warning module performs clause-level review and topology consistency check on the optimized compliance layout scheme.
[0014] Compared with the prior art, the present invention has the following beneficial effects: The intelligent layout generation method and system for public restrooms based on generative algorithms proposed in this application can generate diverse and near-feasible layouts through a two-stage link of "generation + RL" and rule masking sampling. Then, under the guidance of a lightweight evaluator, reinforcement learning is used to fine-tune the layout for multiple objectives, realize cross-objective iterative trade-offs, and output Pareto-friendly solution sets. In this way, by unifying and balancing objectives such as utilization, compliance, privacy, congestion, accessibility, cost, and ventilation, the robustness of irregular or constrained spaces is significantly improved. Attached Figure Description
[0015] The accompanying drawings are provided to further understand this application and form part of the specification. They are used together with the embodiments of this application to explain this application and do not constitute a limitation thereof. Figure 1 This is an optional schematic diagram of a method for generating intelligent layouts of public restrooms based on generative algorithms, provided in an embodiment of this application. Figure 2 This is an optional schematic diagram of a method for generating intelligent layouts of public restrooms based on generative algorithms, provided in an embodiment of this application. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0017] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature; in the description of this application, unless otherwise stated, "multiple" means two or more.
[0018] In recent years, despite the rapid evolution of "AI + design," mainstream capabilities have largely focused on overall planning / floor-level layout and visualization. However, in subspaces like public restrooms, which are extremely sensitive to electromechanical and contractual details, a gap remains between "concept and implementation." Existing technologies typically address the geometric / relational feasibility and diversity issues of common floor plans / graphical layouts using general planar generation technologies such as Graph2Plan, House-GAN, and LayoutDM. While general generative layout models excel in room segmentation, graphic arrangement, and topological diversity, they lack contractual coding and manufacturability verification for terms such as clearance, slope, drainage, door sweep, and accessibility. Existing parametric / rule-driven layout tools or plugins, while capable of quickly assembling locally compliant templates, struggle to achieve global optimization under multi-objective conflicts and exhibit weak generalization to irregular boundaries. Furthermore, while industrial platform tools like Autodesk Forma / Spacemaker emphasize early-stage urban and architectural analysis and generative calculations, they do not provide dedicated rule bases or automated construction-level outputs for public restrooms.
[0019] Therefore, for public restrooms, a specific space with strong clauses, engineering requirements, and electromechanical constraints, existing tools either tend to "generate rather than implement," making it difficult to provide clause-level compliance and manufacturability verification, or tend to "verify rather than optimize," failing to provide an explainable optimal trade-off between conflicting goals such as space utilization, circulation efficiency, privacy and congestion, maintenance accessibility, cost and ventilation. Furthermore, they lack robust adaptability to irregular / constrained spaces such as curved or triangular areas, lowered slabs / manholes, and multiple entrances.
[0020] To address the aforementioned technical problems, the present invention proposes the following technical solutions and corresponding embodiments.
[0021] The following is combined with Figures 1-2 The illustrated embodiments describe the technical solution of the present invention: Example 1 The method for generating intelligent layouts of public restrooms based on generative algorithms in this application embodiment refers to... Figure 1 As shown, the process includes the following steps S101 to S105: Step S101: Obtain multimodal data of the public restroom space to be laid out; the multimodal data includes CAD files, BIM models, point cloud files and functional requirement data.
[0022] In this embodiment, the CAD file includes the two-dimensional coordinates of the walls, doorways, manholes, and lowered slab areas of the public restroom space; the BIM model is used to extract the three-dimensional locations of the drainage and ventilation points of the space; the point cloud file is used to extract the partition walls, ground, and lowered slab steps through area growth; and the functional requirements data include the accessibility ratio, toilet stall target, budget level, etc.
[0023] Step S102: Parse the multimodal data to generate parsing results, and construct a multi-relationship graph of the public restroom space based on the parsing results; the multi-relationship graph includes a set of nodes, a set of edges, and a set of relationship types for the public restroom space.
[0024] In this embodiment, multimodal input parsing and functional requirement data understanding of CAD files, BIM models, and point cloud files are first performed to extract basic information for graph structure construction.
[0025] In this embodiment, a multi-relationship diagram is constructed based on CAD files, BIM models, and point cloud files. ,in, For a set of nodes, For the set of edges, For a set of relation types, each node Having feature vectors This diagram reflects both the real geometric / engineering constraints and provides a structural foundation for subsequent conditional encoding of generative models and state representation of RL.
[0026] The node set includes component nodes, structural nodes, and zone nodes. Component nodes include: toilets, urinals, washbasins, partitions, doors, vanities, rest areas, etc., with features including geometric dimensions, orientation, elevation, minimum clearance buffer, cost level, and replaceable SKUs. Structural nodes include: load-bearing walls, non-load-bearing walls, columns, doorways, structural drop slabs, pipe shafts, drainage points, and ventilation points, with features including location, thickness / elevation difference, slope, and no-entry mask markings. Zone nodes include: dry / wet zones, accessible cubicles, passageways, entrances, and evacuation exits, with features including target toilet / washbasin ratio, accessibility parameters, and passage weights. The set of relationship types (edges and relationships) includes: adjacency edges, which are geometrically adjacent to each of the component nodes and each of the region nodes; reachable edges, which are connected on the traversable graph (obtained by channel width and turning radius constraints); line-of-sight edges, which are used to assess privacy based on the visibility relationship between the line-of-sight cone and the occlusion angle; pipeline edges, which are the connection feasibility between each of the component nodes and the drainage point and ventilation point; and sweep edges, which characterize the potential interference relationship between the door opening and closing trajectory and the neighboring objects.
[0027] In this embodiment, the construction of a multi-relationship graph structure for the public restroom space based on the parsing results includes: extracting structural nodes, generating a no-entry mask and an access grid, then identifying functional areas and initial constraints, generating the node set, the edge set, and the relationship type set; and constructing a node feature matrix based on the node set, constructing an adjacency matrix based on the relationship type set, and providing a degree matrix. The unified graph uses a layered overlay representation.
[0028] Step S103: Based on the constraints of the multi-relationship graph, a preliminary draft of the Top-K nested feasible layout is generated using the latent space diffusion model.
[0029] In this embodiment, the geometric and semantic information within the public restroom space is transformed into a low-dimensional latent vector representation using a perceptually aligned autoencoder; an initial noise latent vector is sampled from a standard Gaussian distribution as the starting point of the diffusion process; candidate layouts are generated through the forward noise addition and reverse noise reduction process of the latent space diffusion model, combined with rule penalty terms; after initial screening by hard constraints and adsorption by the construction grid, a preliminary draft of the Top-K close-fitting feasible layout is output.
[0030] In this embodiment of the application, in order to meet the conditions such as "structural boundary, no-entry zone, doorway, well, drop plate, target ratio, accessibility, budget and user preference", a latent space diffusion model is used to generate a Top-K (8–16) near-feasible draft.
[0031] Specifically, the node feature matrix, multi-relationship adjacency matrix, forbidden mask, clause-level constraint index, user preferences, and target parameters corresponding to functional requirements are encoded and integrated into a condition vector. Through the forward denoising and reverse denoising process of the latent space diffusion model, candidate layouts are generated by combining rule penalty terms. After initial screening with hard constraints and mesh adsorption, a Top-K feasible layout draft is output. The forward denoising process is as follows: ; in, Let be the conditional probability distribution of the forward noise-adding process, representing a given clean sample. At that time, the first Step-by-step noisy random vector Distribution; Represents the initial clean sample; Representing the The noisy latent vector at each diffusion time step; This is the noise accumulation factor. The value is set to 1000 steps, gradually changing the initial layout vector. Adding noise to form the noise latent vector ; For unit array; The reverse noise addition process is as follows: ; in, Given a reverse transition distribution and the current noise state... and condition vector Model parameters Approximate generation of the previous step The probability distribution; These are the learnable parameters for the denoising network; It is the first and A random vector with each diffusion time step; the dimension is consistent with the training data representation. For diffusion time step index, ; For conditional vectors, The mean is Covariance is The multivariate Gaussian distribution; To predict the mean; For covariance, In order to be in Lowercase symbols are used to indicate values that have been obtained. ; The formula for the training target during the denoising process is as follows: ; in, The total loss function consists of two parts: a denoised MSE term and a rule penalty term. It calculates the expected value of a random variable. This refers to the real noise injected into the forward noise addition; For the network in time step condition The predicted value for noise; This is the rule penalty weight, used to balance the importance of MSE and rule constraints; Summation of the rule penalty terms; These are the penalties for hard and soft violations.
[0032] In this embodiment, the node feature matrix and the multi-relationship adjacency matrix are encoded into graph structure feature vectors through a GIN network; the forbidden mask is encoded into a mask vector through a CNN; the clause-level constraint index is incorporated into the feature vector as a hard constraint rule, and the user preference is encoded into a style vector through a text encoder; the graph structure feature vector is used as the basis, and the target parameter and the style vector are injected into the latent space diffusion model as cross-attention keys through a Cross-Attention mechanism; and the mask vector is injected into the feature layers of U-Net at various scales through a ControlNet-like branch, integrating them to form the condition vector. During the sampling process, the DDIM sampling algorithm (30 steps) and CFG=3-5 were used to generate 50 candidate layouts. Through hard constraint screening, layouts with components located in restricted areas and pipeline connection distances greater than 3000mm were eliminated, leaving 20 layouts. Then, construction grid snapping (snap to 5cm or 10cm grid) was performed, and the door direction was aligned with the partition gap so that the door opening direction avoided the components. Finally, 12 near-feasible layout drafts (K=12) were selected. Each draft met the requirements of no hard violations, soft violation penalty values less than the preset threshold, and budget satisfaction.
[0033] Step S104: Using the initial draft of the Top-K feasible layout as the initial state, construct a Markov decision process based on reinforcement learning, and fine-tune the strategy through the constrained PPO algorithm to obtain an optimized compliant layout scheme.
[0034] In this embodiment, a 20-50 step strategy fine-tuning is performed based on the generated initial draft to optimize "utilization, traffic flow, privacy, accessibility, and cost" while prioritizing compliance. Specifically, reinforcement learning (PPO or Constrained Reinforcement Learning) is used to perform multi-objective fine-tuning under the guidance of a lightweight evaluator (geometry / compliance, pedestrian flow proxy, privacy visibility field, maintenance accessibility, cost, and ventilation proxy), outputting a Pareto-friendly solution set, and finally completing the door / equipment interference simulation, A* maintenance accessibility, and clause-indexed compliance report.
[0035] In this embodiment, using the initial draft of the Top-K feasible layout as the initial state, global features, object features, and index features are extracted to construct a state tensor. An action mask is generated based on the forbidden mask, boundary, and geometric / pipeline feasibility to shield invalid actions, resulting in masked constrained actions. The action set includes component translation, rotation, size switching, model replacement, door repositioning, partition connection or interruption, and region rearrangement or exchange. Continuous parameters of the masked constrained actions are proposed and snapped to the construction mesh using a 5cm snap. Actions are executed to determine the updated pipeline edges, sweep edges, and reachable edges, resulting in an optimized new layout. A fast evaluator is then used to perform a hybrid evaluation of the optimized new layout, obtaining a new index vector and violation markers for reward calculation. The reward function is: ; in, For the reward function; For space utilization, For compliance, For congestion coefficient, For privacy index, For maintenance accessibility, For cost, Strict penalties will be imposed for serious violations; ; ; Finally, the optimized compliance layout scheme is obtained by fine-tuning the strategy in 20-50 steps using the constrained PPO algorithm; wherein, the objective function of the constrained PPO algorithm is: ; in, For strategy ratio, strategy ratio , For policy networks, For state tensors, Actions constrained by a mask; This is the advantage estimate. Estimated by GAE; The function will scale the strategy. Limited to Within the range.
[0036] Step S105: Perform clause-level review and topology consistency check on the optimized compliance layout scheme.
[0037] In this embodiment, if an out-of-threshold violation is detected (insufficient clearance, door sweeping conflict, slope exceeding limits, excessive congestion peak, excessively high probability of direct privacy view, etc.), the system will highlight the problem location and clause number on the visualization interface; trigger an automatic repair strategy (partial rearrangement, component replacement, or channel widening, etc.); if automatic repair is not possible, an alert will be issued (via interface, and / or email, and / or SMS) and operation suggestions and alternative SKUs (Stock Keeping Units). After successful resolution, this embodiment exports LOD300 BIM (IFC / Revit), Navisworks clash report, BOM / quotation, and compliance / pedestrian / privacy report; front-end drag-and-drop fine-tuning is performed and recalculated in real time, and high-scoring edited sample increments are distilled back into the generator / strategy, continuously reducing the rate of manual modification and improving the quality of the next generation.
[0038] The intelligent layout generation method for public restrooms based on generative algorithms proposed in this application can generate diverse and near-feasible solutions through a two-stage link of "generation + RL" and rule masking sampling. Then, under the guidance of a lightweight evaluator, reinforcement learning is used to fine-tune multiple objectives, realize cross-objective iterative trade-offs, and output Pareto-friendly solution sets. In this way, by unifying and balancing objectives such as utilization, compliance, privacy, congestion, accessibility, cost, and ventilation, the robustness of irregular or constrained spaces is significantly improved.
[0039] Example 2 Based on the above embodiments, this embodiment also provides a method for generating intelligent layouts of public restrooms based on generative algorithms. The method of this embodiment includes the following steps S201 to S204, including the following contents: Step S201: Constructing a graph structure based on public restroom space.
[0040] In this embodiment, the CAD file, BIM model, point cloud file, and functional requirements of the public restroom space to be laid out are obtained. The CAD file includes the two-dimensional coordinates of load-bearing walls, non-load-bearing walls, doorways, pipe shafts, and lowered slab areas of the public restroom space. The BIM model includes the three-dimensional positions of drainage and ventilation points. The point cloud is used to extract partition walls, the ground, and lowered slab steps through region growing. In this embodiment, candidate air vents are identified based on normal and height clustering, and then aligned with the CAD / BIM using ICP, thereby generating a no-entry mask, access grid, and a 5cm construction snap grid. Combined with the three-dimensional positions of drainage and ventilation points, the maximum horizontal connection distance from components to pipelines is verified to be 2.5m. As a feasible implementation, the functional requirements can be a ratio of men's toilet stalls:women's toilet stalls:accessible toilet stalls = 3:5:1, and the number of handwashing stations ≥ 4.
[0041] In this embodiment, CAD and BIM files are parsed using the AutoCAD API and Revit API to extract information on load-bearing walls, non-load-bearing walls, door openings, pipe shafts, drop slab areas, and drainage points, thereby generating a no-entry mask and a passage grid.
[0042] In this embodiment of the application, a node set is constructed. Edge set and set of relation types As a feasible implementation, component nodes include toilets, urinals, washbasins, partitions, doors, etc., with features including geometric dimensions, orientation, elevation, minimum clear distance buffer, cost level, and replaceable SKUs; structural nodes include load-bearing walls, non-load-bearing walls, columns, doorways, structural drop slabs, pipe shafts, drainage points, and ventilation points, with features including location, thickness / elevation difference, slope, and no-entry mask markings; area nodes include wet and dry areas, accessible cubicles, passageways, and entrances / evacuation exits, with features including target toilet / washbasin ratio, accessibility parameters, and passage weights. As a feasible implementation, edge relationships include adjacent edges (… ), marking the geometric adjacency of component nodes and region nodes; reachable edges ( ), marking the connectivity on the passable graph (obtained by channel width and turning radius constraints); line-of-sight edges ( ), marked based on the visibility relationship between the line-of-sight cone and the occlusion angle, for privacy assessment; pipeline edge ( ), marking the feasibility of connecting the component to the drainage / ventilation point; swept edge ( This involves marking the potential interference relationships between the door's opening and closing trajectory and neighboring objects. Based on these analytical results, a multi-relationship graph is then constructed. ,in , For a set of nodes, For the set of edges, For a set of relation types, each node Having feature vectors .
[0043] In this embodiment of the application, based on the above-mentioned multi-relationship graph Extract constraint indicators (constraint rules) and generate node feature matrices. (Its dimension is the number of nodes × feature dimension), multi-relationship adjacency matrix and clause-level constraint indicators; among which, The adjacency matrix includes five types: adjacency, reachability, line-of-sight, pipeline connection, and door sweep. Each matrix dimension is the number of nodes multiplied by the number of nodes. Adjacency is marked as 1, and non-adjacency as 0. In this embodiment, feature terms of the feature matrix are defined based on structural nodes, region nodes, and component nodes. Feature values are filled for each of these nodes, and the edge set and the relation type set are constrained by the initial constraint rules. After arranging the feature values of all nodes to form an initial matrix, normalization is performed to obtain the standardized node feature matrix.
[0044] In this embodiment of the application, after the user uploads CAD, BIM, point cloud and requirements, the system parses and generates condition vectors and graph structures in real time.
[0045] Step S202: Initial layout generation based on the latent space diffusion model.
[0046] In this embodiment, based on the constraints of the graph structure formed in step S201, a preliminary draft of a Top-K nested feasible layout is generated using a latent space diffusion model. Specifically, this includes the following steps S2021 to S2023: Step S2021, Conditional Coding.
[0047] In this embodiment of the application, the node feature matrix output in step S201 is... and multi-relational adjacency matrix The feature vectors are encoded into graph structures using a GIN network (Graph Isomorphic Network); the forbidden mask is encoded into a mask vector using a CNN (Convolutional Neural Network); and the clause-level constraint indicators (as hard constraint rules), the target parameters corresponding to functional requirements (target number of toilets, accessibility ratio), and user preferences (encoded into style vectors by the text encoder) are integrated to form a condition vector. In this context, user preferences are encoded into style vectors via a text encoder; exemplarily, conditional vectors... This includes boundary encoding, target number of toilets, accessibility ratio, budget, and user preferences. Therefore, a cross-attention mechanism is used to integrate the conditional vectors. As a cross-attention key-value injection latent space diffusion model, the mask vector is injected into the feature layers of U-Net at various scales through a ControlNet-like branch.
[0048] Step S2022: Diffusion sampling.
[0049] In this embodiment, candidate layouts are generated through the forward noise addition and reverse denoising process of the latent space diffusion model, combined with rule penalty terms. After initial screening with hard constraints and adsorption of the construction mesh, a Top-K feasible layout draft is output, where K ranges from 8 to 16. In this embodiment, rule penalty terms are used to constrain hard and soft violations of the layout. Hard violations include components located in restricted areas and pipelines that cannot be connected, while soft violations include budget overruns and substandard toilet stall ratios.
[0050] The forward noise addition process specifically involves sampling the initial noise latent vector from a standard Gaussian distribution as the starting point of the diffusion process, followed by forward noise addition according to the following formula (1): Formula (1) in, The conditional probability distribution for the forward noise addition (diffusion) process represents a given clean sample. At that time, the first Step-by-step noisy random vector Distribution; Represents the initial "clean" sample / layout vector (input without noise); Representing the The "noisy" latent vector (random variable) for each diffusion time step; The mean of a Gaussian distribution ; The representative mean is Covariance is The multivariate Gaussian distribution; This is the noise accumulation factor. The value is set to 1000 steps, gradually changing the initial layout vector. Adding noise to form the noise latent vector ; For identity matrix (dimension and (Same), ensuring that the covariance is isotropic noise.
[0051] Using a pre-trained time-conditionalized U-Net denoiser, inverse denoising is performed according to the following formula (2), from =1000 steps of progressive noise reduction =0 steps, each step is based on the condition vector With the current noise latent vector Predicted denoised mean and variance Generate denoised latent vectors During the denoising process, the following formula (3) is used to train the objective (simplified noise prediction + rule penalty) and constrain violations: Formula (2) Formula (3) In formula 2, For the reverse (denoised) transition distribution, given the current noise state. and conditions Model parameters Approximate generation of the previous step The probability distribution; These are the learnable parameters for a denoising network (typically a U-Net); It is the first and A random vector (latent variable) for each diffusion time step; the dimension is consistent with the training data representation; For diffusion time step index, (such as training) (The reasoning can be done in fewer steps). For condition vectors / condition sets, The mean is Covariance is The multivariate Gaussian distribution; To predict the mean; For covariance, In order to be in Lowercase symbols are used to indicate values that have been obtained. , It is a unit array.
[0052] In formula 3, The total loss function consists of two parts: a denoised MSE term and a rule penalty term. It calculates the expected value of a random variable. The actual noise (label) injected into the forward noise addition; For the network in time step condition The predicted value for noise; This is the rule penalty weight, used to balance the importance of MSE and rule constraints; Summation of the penalty items in the rules / clauses; For clause-based hard and soft violations (such as minimum clearance, door sweep, and slope exceeding limits), the location of the violation is determined by a mask.
[0053] For example, Set it to 0.8. A penalty of 10 is imposed for components located in restricted areas, and a penalty of 2 is imposed for budget overruns of 10%.
[0054] In this embodiment, the DDIM sampling algorithm (30 steps) with CFG=3-5 is used to generate 50 candidate layouts. Through initial screening with hard constraints, layouts with components located in restricted areas or pipeline connection distances >3000mm are eliminated, retaining 20 layouts. Then, construction mesh snapping (snap to a 5cm or 10cm mesh) and aligning the door direction with the partition gap ensure that the door opening direction avoids components. Finally, 12 near-feasible initial layout drafts (K=12) are selected, each meeting the requirements of no hard violations, soft violation penalties less than a preset threshold, and budget fulfillment. The sampling and post-processing process involves DDIM 30 steps with CFG=3–5; connected component → instance geometry fitting → construction mesh snapping (5 / 10cm) → aligning the door direction with the partition gap → initial screening with hard constraints to eliminate veto solutions.
[0055] Step S203: Layout optimization based on reinforcement learning.
[0056] In this embodiment of the application, the 12 near-feasible layout drafts obtained in step S202 are used. As an initial state, a Markov Decision Process (MDP) based on reinforcement learning is constructed, and online fine-tuning is performed in 20-50 steps using a constrained PPO algorithm. This automatically executes mixed actions such as translation / rotation / size / model replacement / door flipping-relocation / connectivity disruption / region rearrangement-exchange, and optimizes multiple metrics under hard / soft constraints to ensure that each initial draft yields an optimal trajectory and one / multiple candidate optimization schemes. Simultaneously output action sequences and key metrics (space utilization). Compliance Congestion coefficient Privacy Index Accessibility for maintenance ,cost The list of violations, along with the list of violations, leads to an optimized compliance layout plan.
[0057] Specifically, step S203 is achieved through the following steps S2031 to S2036: S2031, Environment initialization and parallel deployment; In this application embodiment, for each near-feasible layout draft , for each Establish a simulation environment instance; reuse / rotate 12 initial drafts in a 64-parallel environment to accelerate sampling, and obtain the environment set. With the initial state set .
[0058] S2032, State Construction; In this embodiment, during the global feature extraction stage, an FPN (Feature Pyramid Network) is used to encode the passage grid, thereby obtaining global features. The multi-scale feature fusion structure based on FPN can capture global information in the passage grid at different resolutions, such as spatial connectivity and the distribution of main passage paths. Object feature extraction relies on the GraphSAGE algorithm for multi-relationship graphs. Encode the data, compress the encoded result to 512 dimensions using a fully connected layer, and then perform a mean-pooling operation on the nodes to obtain the feature objects. Here, the GraphSAGE algorithm can extract multi-relationship graphs. The uniqueness of each layout element and the relationship characteristics between them are considered. Indicator feature extraction involves quickly evaluating the current layout of each initial draft to obtain space utilization. Compliance Congestion coefficient Privacy Index Accessibility for maintenance ,cost Key indicators, and normalize these indicators to Intervals allow for the normalization of indicators of different types and magnitudes to a single scale for comparison and analysis.
[0059] Based on the extraction of global features, object features, and index features, the state tensor is finally constructed. By comprehensively integrating information from various aspects such as spatial structure, object attributes, and performance indicators, the policy network can provide rich and accurate state descriptions for subsequent decision-making processes.
[0060] S2033, Determination of motion space and motion mask; In the embodiments of this application, the action set It includes seven types of hybrid actions, each adjusting a different aspect of the layout. For example, the seven types of hybrid actions include component translation. Rotation Size setting switching; Model number replacement (SKU); Door leaf flipping / repositioning; Partition connection / interruption; Area rearrangement / exchange.
[0061] To ensure the effectiveness and feasibility of the aforementioned hybrid actions in practical applications, an action mask is generated based on the no-entry mask, boundary and geometry, and pipeline feasibility. This mask blocks invalid actions (such as components crossing boundaries into no-entry areas, unreasonable position adjustments across walls, exceeding the 2.5m horizontal distance limit for pipelines, etc.) and generates actions constrained by the mask. (Including discrete selection and continuous parameters); Among them, the no-entry mask clearly marks the area in the layout where components are not allowed to enter, and the boundary conditions limit the scope of the layout. No action can cause the components to exceed this scope. The geometric and pipeline feasibility considers the geometric relationship between components and the rationality of pipeline connections to ensure that there are no problems such as component overlap or pipeline inability to connect after the action is executed.
[0062] S2034, State Transition and Geometric Repair (T); In this embodiment of the application, when the policy network is based on the state tensor Select and output actions Then, state transition and geometric repair operations are performed. First, the action is proposed. The continuous parameters in the grid serve as the foundational data for changing the layout, representing specific instructions for adjusting the positions of components within the layout. These continuous parameters are then snapped to the construction mesh using a 5cm snap. This snapping operation ensures that component position adjustments strictly adhere to the mesh's precision standards, avoiding arbitrariness and deviations. Furthermore, during the execution of actions, collisions between components must be avoided, and the adjusted layout must meet the minimum displacement correction requirements, prioritizing minimal interference and preserving feasible solutions. Finally, the relationships between pipeline edges, swept edges, and reachable edges in the layout are updated, ultimately outputting the new layout. And the updated .
[0063] S2035, Fast Evaluator and Metric Recalculation; In this embodiment, a rapid evaluation method combining distance field, visibility ray, and shortest path assessments is used to consider the layout from multiple dimensions. Regarding clearance, slope, and drainage connection distance, relevant indicators are strictly controlled to ensure that clearance meets design requirements, slope meets drainage needs, and drainage connection distance is controlled within a reasonable range of ≤2.5m. Simultaneously, attention is paid to door sweeping to avoid spatial conflicts. Regarding accessibility, the ease of movement within the space is measured by determining whether the layout is strongly connected and calculating the shortest path to key nodes. Congestion coefficient... The calculation is based on the 95th percentile pedestrian density; privacy index The assessment is measured by the line-of-sight at the entrance of public restrooms and the probability of direct eye contact. A line-of-sight of ≥200 and a probability of direct eye contact ≤0.15 are required to meet the standard, thus protecting user privacy. The assessment indicators also include space utilization. Maintenance and repair services are available. Cost.
[0064] Therefore, based on the above comprehensive and detailed evaluation, the fast evaluator outputs a new metric vector and violation markers (hard / soft) to reflect the performance and compliance of the layout from different perspectives. This provides direct data support for reward calculation, helps the model determine the direction for improvement of the current layout, and thus promotes continuous layout optimization. In this embodiment of the application, the reward function is designed considering multiple key indicators, aiming to comprehensively measure the quality of the layout and guide the optimization direction. Its expression is as follows: Formula (4): Formula (4) in, For the reward function; For space utilization, For compliance, For congestion coefficient, For privacy index, For maintenance accessibility, For cost, Strict penalties will be imposed for serious violations; ; .
[0065] In this embodiment of the application, after evaluating the new layout and obtaining various indicators and violation flags, sample collection begins; the state tensor is then... ,action ,award and the next state Collect them to form sample data and the sample data Place it in the batch buffer for temporary storage.
[0066] S2036, Constrained Proximal Policy Optimization (CPPO) policy update; In this embodiment, the advantage is first calculated using GAE (Generalized Advantage Estimation), which is combined with multi-step TD residuals and a discount factor is introduced. Weight parameters An exponentially weighted average of the TD errors for different time steps is used to balance the bias and variance of the advantage estimate. In a single round of layout optimization, each time step is traversed from back to front, the TD residual is calculated, and then the GAE advantage is calculated using a recursive formula to obtain the advantage estimate. .
[0067] In this embodiment of the application, the target is minimized through PPO-Clip. The objective function is given by formula (5): Formula (5); in, For strategy ratio, strategy ratio Advantage estimate Estimated by GAE; The function will scale the strategy. Limited to Within the interval, for example, It's a hyperparameter.
[0068] In layout optimization, both hard and soft violations can affect the quality and feasibility of the layout, therefore, these violations need to be constrained. In this embodiment, cost constraints are used. (Hard violation / soft violation metric) is adaptively updated via Lagrange multipliers (step size) As training progresses, the Lagrange multipliers will adaptively adjust based on violations to ensure that the layout is optimized while satisfying all constraints.
[0069] It should be noted that in terms of training configuration, 64 parallel environments are used, which can train multiple layout samples simultaneously, greatly improving training efficiency; the batch size is set to 64×2048; the learning rate is set to 3e-4; and the hidden layer is set to [1024,512,256].
[0070] In this way, the PPO updater is constantly constrained to update the policy network. and value network The updated policy network can more accurately select actions that are beneficial to optimizing the layout based on the current layout state, while the value network can more accurately evaluate the value of the layout state, providing better guidance for the policy network's decision-making.
[0071] In this embodiment of the application, when the layout optimization operation has been performed for 20-50 steps, or the mean gain of the advantage over the last 10 iterations is < ,or Furthermore, if there are no hard violations that trigger the termination decision, that is, during the layout optimization process, once any one of the above three conditions is met, the system will terminate the optimization operation and output 1-3 highest-scoring candidates for each draft. These candidate solutions are the optimal layout schemes obtained through continuous exploration and adjustment throughout the optimization process. They perform well in multiple key indicators such as space utilization, compliance, congestion coefficient, privacy index, maintenance accessibility, and cost. Simultaneously, the system outputs 1–3 top-scoring candidates. The corresponding action sequences and indicator reports are provided. The action sequences record in detail every optimization operation from the initial layout to the final candidate scheme, including the specific parameters and execution order of actions such as component translation, rotation, size setting switching, model replacement, door leaf flipping / relocation, partition connection / interruption, and area rearrangement / exchange. This provides detailed operation records for subsequent scheme review and adjustment. The indicator reports are used to intuitively reflect the performance and quality of each candidate scheme, so as to facilitate decision-makers to compare and evaluate different schemes.
[0072] In this embodiment, the policy network serves as the decision-making core, outputting actions. The data is directly transmitted to the geometry repairer; based on the received action instructions, the geometry repairer performs precise adjustments to the layout, including position movement, collision detection and repair, and then outputs a new layout. This further conveys the new layout. The relationship updater refreshes the pipeline edges, sweep edges, and reachable edges in the layout, resulting in the updated layout. The fast evaluator calculates various metrics and violation information based on the updated relational data. Simultaneously, the reward calculator calculates the reward value based on the results provided by the fast evaluator. This process, using the fast evaluator to obtain the trajectory data needed for advantage estimation, executes the constrained PPO policy update until the entire optimization process meets the termination condition, resulting in 1–3 top-scoring candidates for each initial draft. The corresponding action sequences and indicator reports.
[0073] As a feasible implementation method, candidate layout #4 generated by S202 (exhibiting "door sweep conflict + local bottleneck"); Taking "persons / ㎡" as an example: During the initial state construction process, FPN is used to encode the passage grid to obtain global features. GraphSAGE→FC→mean-pool yields 512 dimensions. The fast evaluator provides initial metrics.
[0074] In the first step, the policy network Based on the current state, the "door flip" action is selected. Upon receiving the instruction, the geometry repairer performs a 5cm snap operation, precisely snapping the action parameters to the construction grid while simultaneously handling collision avoidance to eliminate door-sweeping conflicts. This results in a more rational layout in terms of space utilization, significantly increasing the reward. The sixth action is to move the toilet seat 15cm. The strategy network proposes... After adjusting the translation parameters, the geometry repairer first performs a snap operation, then performs minimum displacement correction; after this adjustment, the shortest path is improved, and the congestion coefficient is reduced. The value decreased to 2.6. Step 12 selected partition connectivity: merging two partitions to form a smooth passage; the shortest path redundancy of the critical node increased from 1 to 2. Step 18 was to replace the washbasin model: by replacing the original washbasin model with a narrow-body model, the clearance met the requirements. By step 20, the layout met the termination conditions, and at this point, the optimized result was satisfactory: door sweep conflicts were cleared to zero. The number of people / m² decreased from 3.1 to 2.3. The performance improved from 0.82 to 0.96 without any hard violations. Ultimately, the optimized solution was adopted. This includes compliance alerts based on corresponding action sequences and indicator reports. It should be noted that in this embodiment, the Snap grid is set to 5cm; the maximum horizontal pipeline distance is limited to 2.5m; the parallel environment is set to 64; the fine-tuning steps are set to 20–50; the reward weight is set to (0.35, 0.35, 0.12, 0.06, 0.06, 0.06); the hard violation weight λ=1.0; and the congestion / privacy caliber is set to... People / m², Direct View Probability (Entrance line of sight ≥200).
[0075] In this embodiment, when a cascading hard violation occurs, i.e. a series of hard violations are related to each other and cause excessive repair costs, the system will trigger a minimum interference rollback mechanism to undo the most recent step or replace it with an equivalent SKU; or when a cascading hard violation occurs and causes excessive repair costs, the system will switch to a candidate "suboptimal action" to avoid cascading problems caused by a single action and ensure that layout optimization can continue.
[0076] If a localized area cannot be automatically repaired, the system will mark the hotspot and the clause number for subsequent repair or manual intervention to achieve optimal design.
[0077] Step S204, Compliance Early Warning Closed Loop.
[0078] In this embodiment of the application, the optimized compliance layout scheme generated in step S203 is... Perform clause-level review and topology consistency checks; if any violations exceed the threshold, trigger automatic repair or highlight warnings, and generate compliance reports and change logs. Specifically, the optimized compliance layout scheme... This includes the 12 sets of initial draft optimization results output in step S203.
[0079] In this embodiment of the application, step S204 is implemented through the following steps S2041 to S2045: Step S2041, Clause-level review; In this application embodiment, the following terms are applied for review: 1) Clearance / Turnaround: Traverse all components in the layout and check the minimum clearance and unobstructed turning space for each component according to the clause library; 2) Door sweep: Simulate the opening and closing trajectories of the door and check whether the trajectory conflicts with the wall, components or passage. That is, it must not conflict with the wall, components or passage in the opening / closing states. 3) Slope and drainage direction: The ground slope is correct and the minimum slope meets the standard; 4) Pipeline availability: The horizontal connection distance from the toilet / washbasin, etc., to the drainage / ventilation point is ≤2.5m and meets the positive slope requirement; 5) Budget / Cost: Costs (including relocation and new components) shall not exceed the target upper limit; 6) Congestion / Privacy: Congestion 95th percentile density ρ95≤2.5 people / m²; Direct line of sight probability of entrance visibility ray statistics≤0.15 (ray count≥200).
[0080] Based on the above, items that do not meet the terms are recorded as hard violations or soft violations and entered into the database with a number.
[0081] Step S2042: Topology consistency check; In this embodiment of the application, this step uses a multi-relationship graph. Based on this, four types of topology graphs are constructed and their consistency is verified to ensure the functional connectivity and structural stability of the layout. Specifically, the four types of topology graphs include accessibility graphs, door-leaf two-state equivalent access, pipeline connectivity graphs, and visibility graphs, including: 1) In the reachability map During the construction and verification process, doorways, passageway turning points, and key components are used as nodes, and legal passage paths are used as edges. Verification requirements: strong connectivity within the scene; or a reachable path between the target area and an exit or evacuation exit; and a set of key nodes. Entrance / Evacuation Exit / Accessible Compartment / Maintenance Access The shortest path between the main functional area and the main functional area exists with a redundancy of ≥2 (two candidate paths without intersection); after identifying the channel bottleneck, the following is given based on the pedestrian flow simulation. Assessment and rectification recommendations.
[0082] 2) Door leaf two-state equivalence verification: Construct the door leaf under two discrete states: "door open" and "door closed". , Calculate the passage capacity under both states, requiring that the passage capacity does not drop below the clause threshold; if the passage capacity drops to the clause threshold when the door is closed, locate the conflicting door and add it to the automatic repair queue.
[0083] 3) Pipeline connection diagram Construction and verification: Using sanitary fixtures, drainage points, and ventilation points as nodes and pipe connection relationships as edges, each fixture must be connected to a legal sink, and the path must not have reverse slope / reverse flow; at the same time, the horizontal length and drop of each connecting path must be checked, and violations will be counted as hard violations; 4) Visibility map The source node is a viewpoint such as the entrance or corridor, and the target node is a sensitive component such as the toilet or urinal. The edge weight is the visibility. The visible edge ratio from the source node to the target node is required to be ≤0.15. If it is >0.15, it is recorded as a soft violation.
[0084] In this embodiment of the application, when vulnerable points are detected in the cut vertices and cut edges of the topology graph, modification suggestions are provided. Here, a vulnerable point can be a failure that causes a functional area to... If a connection is broken, or passage is interrupted after a certain passage is removed, suggestions will be given for widening the passage, adding a doorway, or modifying the flow of traffic.
[0085] Step S2043: Implementation of automatic repair and early warning mechanism; In this embodiment, violations are graded and processed according to the principle of minimizing interference. Violations are eliminated primarily through lightweight adjustments, and an alert is triggered when they cannot be repaired. This embodiment processes detected violations in the following order: a) Minimum interference local rearrangement: Under the 5cm snap constraint, the vicinity is shifted or slightly rotated to prioritize eliminating door sweep, clearance, and bottleneck issues; b) Equivalent SKU replacement: Oversized components are replaced with narrower, shorter models; c) Channel widening / path rerouting: The connectivity of partitions or area boundaries are adjusted to ensure... Strong connectivity and redundancy ≥ 2. When local convergence is not possible, the system highlights the violation hotspot on the visualization interface, marks the corresponding clause number, provides alternative solutions and cost impacts, and prompts for manual confirmation. The layout is updated immediately after each fix. Multiple Relationship Diagram The clause-level review and topology consistency check are retried to confirm that the violation has been eliminated; if it still does not meet the requirements, the next strategy is initiated or manual confirmation is prompted.
[0086] In this embodiment, after compliance verification is completed, a "Compliance and Topology Consistency Report" is output, which includes: a list of items that passed / failed (distinguishing between hard and soft violations), topology connectivity / redundancy and visibility statistics, an automatic repair change log, warning items that still require manual confirmation, and a comparison of alternative solutions and costs; simultaneously, an IFC / Revit model with LOD300 accuracy, a Navisworks collision report, a BOM / quotation list, a pedestrian flow simulation report, and a privacy assessment report are exported. In this embodiment, the "Compliance and Topology Consistency Report" can be fed back to the front-end interactive module for secondary fine-tuning and used as training data for subsequent distillation.
[0087] Therefore, in this embodiment, the system operates in a closed-loop manner of "generation—optimization—verification—export—reflow—relearning," enabling the generation and verification of solutions to be completed within minutes, while allowing designers to maintain control. Speed is ensured through a lightweight evaluator and parallel environment, while human-machine collaboration and log reflow continuously reduce the rate of manual modifications and the risk of rework. Specifically, under a single-machine GPU configuration (≥24 GB VRAM), the performance is 50–120. For common case types, "12 sets of candidate generation + RL optimization + verification and export" can be completed in minutes.
[0088] The intelligent layout generation method for public restrooms based on generative algorithms provided in this application is guided by a two-stage technical approach: generation followed by reinforcement learning optimization. A conditional generation model generates diverse "nearly feasible" candidates under rule masking. A lightweight evaluator (geometric / compliance, pedestrian flow proxy, privacy visibility, maintenance accessibility, cost and ventilation proxy) drives a multi-objective iteration of the RL strategy, forming an automatic verification and repair mechanism that ensures consistency between terms, geometry, and physics. Furthermore, it integrates Dynamo→IFC→Revit (LOD 300), Navisworks collision detection, SKU binding to BOM / quotation, and human-machine collaborative feedback, ultimately achieving verifiable engineering indicators and fundamentally alleviating the three-way dilemma of "efficiency—compliance—implementation."
[0089] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the public restroom intelligent layout generation method based on a generative algorithm according to any embodiment of this application. Specifically, a system or device equipped with a storage medium can be provided, on which software program code implementing the functions of any of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device can read and execute the program code stored in the storage medium.
[0090] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), it performs the functions defined above in the system of this application.
[0091] It should be noted that the computer-readable storage medium shown in this invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. For example, a computer-readable storage medium can be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable storage medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0093] The units described in the embodiments of the present invention can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0094] It should be noted that although several modules or units of the device for performing actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed systems, modules, and methods can be implemented in other ways. For example, the module embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between modules or units, and may be electrical, mechanical, or other forms.
[0096] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. This application is not limited to the exact structures described above and illustrated in the accompanying drawings, and it should not be considered that the specific implementation of this application is limited to these descriptions. For those skilled in the art, various changes and modifications made without departing from the concept of this application should be considered to fall within the protection scope of this application.
Claims
1. A method for generating intelligent layouts of public restrooms based on generative algorithms, characterized in that, include: Acquire multimodal data of the public restroom space for which the layout to be generated is to be obtained; the multimodal data includes CAD files, BIM models, point cloud files, and functional requirement data; The multimodal data is parsed to generate parsing results, and a multi-relationship graph of the public restroom space is constructed based on the parsing results; the multi-relationship graph includes a set of nodes, a set of edges, and a set of relationship types for the public restroom space; Based on the constraints of the multi-relationship graph, a preliminary draft of the Top-K nested feasible layout is generated using the latent space diffusion model. Using the initial draft of the Top-K feasible layout as the initial state, a Markov decision process based on reinforcement learning is constructed, and the strategy is fine-tuned through the constrained PPO algorithm to obtain an optimized compliant layout scheme. The optimized compliance layout scheme is subject to clause-level review and topology consistency check.
2. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 1, characterized in that, The process of parsing the multimodal data to generate parsing results and constructing a multi-relationship graph of the public restroom space based on the parsing results includes: The AutoCAD API and Revit API are used to parse the CAD file and the BIM model, extract information on walls, door openings, pipe shafts, drop slab areas, and drainage points, and generate no-entry masks and access grids in combination with building design codes; Using the walls and doorways as connection points, the passage grid is divided into connected domains to obtain multiple connected domains, with different connected domains corresponding to different functional areas; each functional area is marked with its corresponding functional area data. Initial constraint rules are extracted based on the aforementioned functional requirement data; the functional requirement data includes building design codes, engineering constraints, and user requirements; the initial constraint rules include geometric constraints, engineering constraints, and functional constraints. Based on the information of the wall, doorway, pipe well, drop slab area, drainage point, functional requirement data, and functional area data, structural nodes, area nodes, and component nodes are defined to obtain a node set; Based on the node set, the forbidden mask and the access grid, and the initial constraint rules, the edge set and the relationship type set are generated. The edge set includes adjacent edges representing the geometrical adjacency of each component node and each region node, reachable edges representing connectivity on the access grid, line edges representing the visibility relationship between the line of sight cone and the occlusion angle, pipeline edges representing the connection feasibility of each component node and the drainage point and ventilation point, and sweep edges representing the potential interference relationship between the door opening and closing trajectory and neighboring objects.
3. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 2, characterized in that, After parsing the multimodal data to generate the parsing results and constructing a multi-relationship graph of the public restroom space based on the parsing results, the method further includes: The multi-relationship graph is numerically represented to form a node feature matrix and a multi-relationship adjacency matrix.
4. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 3, characterized in that, Based on the constraints of the multi-relationship graph, a preliminary draft of the Top-K nested feasible layout is generated using a latent space diffusion model, including: The node feature matrix, the multi-relationship adjacency matrix, the forbidden mask, the clause-level constraint index, and the target parameters corresponding to user preferences and functional requirements are encoded and integrated into a condition vector; Through the forward denoising and reverse denoising process of the latent space diffusion model, candidate layouts are generated by combining rule penalty terms. After initial screening with hard constraints and mesh snapping, a preliminary draft of the Top-K feasible layout is output. The forward denoising process is as follows: ; in, Let be the conditional probability distribution of the forward noise-adding process, representing a given clean sample. At that time, the first Step-by-step noisy random vector Distribution; Represents the initial clean sample; Representing the The noisy latent vector at each diffusion time step; This is the noise accumulation factor. The value is set to 1000 steps, gradually changing the initial layout vector. Adding noise to form the noise latent vector ; For unit array; The reverse noise addition process is as follows: ; in, Given a reverse transition distribution and the current noise state... and condition vector Model parameters Approximate generation of the previous step The probability distribution; These are the learnable parameters for the denoising network; It is the first and A random vector with each diffusion time step; the dimension is consistent with the training data representation. For diffusion time step index, ; For conditional vectors, The mean is Covariance is The multivariate Gaussian distribution; To predict the mean; For covariance, In order to be in Lowercase symbols are used to indicate values that have been obtained. ; The formula for the training target during the denoising process is as follows: ; in, The total loss function consists of two parts: a denoised MSE term and a rule penalty term. It calculates the expected value of a random variable. This refers to the real noise injected into the forward noise addition; For the network in time step condition The predicted value for noise; This is the rule penalty weight, used to balance the importance of MSE and rule constraints; Summation of the rule penalty terms; These are the penalties for hard and soft violations.
5. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 4, characterized in that, The process of encoding and integrating the node feature matrix, the multi-relationship adjacency matrix, the forbidden mask, the clause-level constraint indicators, user preferences, and functional requirement data into a condition vector includes: The node feature matrix and the multi-relationship adjacency matrix are encoded into graph structure feature vectors using a GIN network; The forbidden mask is encoded into a mask vector using a CNN; the clause-level constraint index is incorporated into the feature vector as a hard constraint rule; and the user preference is encoded into a style vector using a text encoder. Using the graph structure feature vector as a foundation, the target parameters and the style vector are injected into the latent space diffusion model as cross-attention keys through a Cross-Attention mechanism; and the mask vector is injected into the feature layers of U-Net at various scales through a ControlNet-like branch, integrating them to form the conditional vector. .
6. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 4, characterized in that, The value of K is 8-16; the process of forward noise addition and reverse noise reduction through the latent space diffusion model, combined with the rule penalty term to generate candidate layouts, after initial screening by hard constraints and adsorption by the construction mesh, outputs a preliminary draft of Top-K feasible layouts, including: The DDIM sampling algorithm was used to generate 50 candidate layouts. Through initial screening using hard constraints, layouts with components located in restricted areas or with pipeline connection distances greater than 3000mm were eliminated, leaving 20 candidate layouts. Then, construction grids were applied and the door direction was aligned with the partition gaps to ensure that the door opening direction avoided the components, resulting in a preliminary draft of a Top-K fit-in feasible layout. The construction grid was applied to a depth of 5-10cm.
7. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 5 or 6, characterized in that, The process begins with the initial draft of the Top-K feasible layouts, constructing a Markov decision process using reinforcement learning, and fine-tuning the strategy through a constrained PPO algorithm to obtain an optimized compliant layout scheme, including: Using the initial draft of the Top-K feasible layout as the initial state, global features, object features, and index features are extracted to construct a state tensor; Based on the forbidden mask, boundary and geometry / pipeline feasibility, an action mask is generated to shield invalid actions and obtain the actions constrained by the mask; wherein, the action set includes component translation; rotation; size setting switching; model replacement; door leaf flipping and repositioning; partition connection or interruption; area rearrangement or exchange; The continuous parameters of the mask-constrained actions are proposed and snapped to the construction grid using a 5cm snap. The actions are executed, and the updated pipeline edges, sweep edges, and reachable edges are determined to obtain an optimized new layout. A fast evaluator is used to perform a hybrid evaluation on the optimized new layout, resulting in a new index vector and violation markers for reward calculation; the reward function is: ; in, For the reward function; For space utilization, For compliance, For congestion coefficient, For privacy index, For maintenance accessibility, For cost, Strict penalties will be imposed for serious violations; ; ; The optimized compliance layout scheme is obtained by fine-tuning the strategy in 20-50 steps using the constrained PPO algorithm; wherein the objective function of the constrained PPO algorithm is: ; in, For strategy ratio, strategy ratio , For policy networks, For state tensors, Actions constrained by a mask; This is the advantage estimate. Estimated by GAE; The function will scale the strategy. Limited to Within the range.
8. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 7, characterized in that, The process of extracting global features, object features, and indicator features from the initial draft of the Top-K feasible layout as the initial state, and constructing a state tensor, includes: The access grid is encoded using FPN to obtain the global features; the multi-relationship graph is encoded using the GraphSAGE algorithm, and the encoded result is compressed to 512 dimensions through a fully connected layer, followed by a mean-pool operation on the nodes to obtain the object features; the current layout of each near-feasible initial layout is quickly evaluated to obtain space utilization, compliance, congestion coefficient, privacy index, maintenance accessibility, and cost, and the space utilization, compliance, congestion coefficient, privacy index, maintenance accessibility, and cost are normalized to... The interval is used to obtain the indicator characteristics.
9. The method for generating intelligent layouts of public restrooms based on generative algorithms according to claim 8, characterized in that, The method further includes: If a violation is detected during the clause-level review process, the violation will be handled in a tiered manner; the tiering order is as follows: minimum interference local rearrangement, equivalent SKU replacement, channel widening or path rerouting; When vulnerable points are detected in the cut vertices and cut edges of the topology graph, corresponding modification suggestions are generated.
10. A public restroom intelligent layout generation system based on generative algorithms, used to implement the public restroom intelligent layout generation method based on generative algorithms as described in any one of claims 1-9, characterized in that, include: The data acquisition module is used to acquire multimodal data of the public restroom space whose layout needs to be generated; the multimodal data includes CAD files, BIM models, point cloud files, and functional requirement data; The graph structure construction module is used to parse the multimodal data to generate parsing results, and to construct a multi-relationship graph of the public restroom space based on the parsing results; the multi-relationship graph includes a set of nodes, a set of edges, and a set of relationship types for the public restroom space; The initial draft generation module is used to generate a Top-K nested feasible layout initial draft based on the constraints of the multi-relationship graph and using a latent space diffusion model; The compliance optimization module takes the initial draft of the Top-K feasible layout as the initial state, constructs a Markov decision process based on reinforcement learning, and fine-tunes the strategy through the constrained PPO algorithm to obtain the optimized compliance layout scheme. The compliance early warning module performs clause-level review and topology consistency check on the optimized compliance layout scheme.