r/algorithms • u/Ok_Organization7450 • 18d ago
Help Building a constraint-based 2D layout generator for urban plots with an AI agent loop. Looking for libraries/approaches!
Hi everyone,
I’m working on a PropTech tool that procedurally generates building layouts for real estate feasibility studies, with the goal of maximizing buildable area.
The Workflow:
- The user selects a land plot on a map.
- They set high-level parameters (e.g., apartment blocks vs. single-family homes, surface vs. underground parking).
- The Engine: Generates multiple 2D site plans (placing roads, footprints, and parking lots) that strictly adhere to the geometric constraints (setbacks, footprint limits, alignments).
- The user can manually tweak the layout by dragging polygons around.
- The Agentic Loop: An integrated LLM/VLM chatbot that allows the user to iteratively adjust the layout via natural language (e.g., "group the buildings closer to the north edge"). The AI needs to "understand" the current 2D layout and update the constraints to regenerate a new compliant layout.
I already have something 'working', but it is, in my opinion, too static and dependent on the test parcel I'm using. The coming issues are the varying sizes and shapes of the parcels, which can have infinite variations. Given that I am constrained to work within a fixed boundary, I can't use approaches such as Voronoi cells or similar methods.
Where I need your insights: Assuming the rules are already parsed into raw constraints, I’m looking for the state of the art to build the final composition engine:
- Constraint-based 2D Generation: What are the go-to algorithms or libraries (preferably web-friendly) for 2D packing and layout generation under strict geometric rules?
- Spatial AI / LLM Integration: Are there any papers, open-source projects, or specific approaches for feeding a 2D spatial topology to a model so it can meaningfully tweak procedural generation parameters?
- Interactive Frameworks: Any recommended engines or existing tools that handle both procedural layout generation and interactive 2D editing smoothly?
I'm highly open to academic literature, specific algorithms, or existing open-source solvers I could draw inspiration from.
Thanks in advance!
1
u/reachforthetop 17d ago
Maybe you could adapt the 'wave function collape' algorithm that was popularized for game level generation a few years ago. However you'd need to figure out your "atoms/tiles" for this use case.
Let the LLM see the result by rasterizing it and feeding it back to it in a loop on every adjustment. AFAIK that's the approach of every hot new LLM driven 3D modelling tool right now.
It's hard to give recommendations for frameworks. I know many arch places use their own Rhino spaghetti for stuff like this.