💡 Inspiration

Generative Urban Design and Building Information Modeling (BIM) traditionally focus entirely on physical geometries, solar values, or generic zoning footprints. They treat building zones as isolated silos, ignoring real-world volatile market factors such as varying occupancy elasticities, financial absorption velocities, and localized rental yield risks.

I was inspired by my own quantitative thesis work as an MScFE candidate at WorldQuant University. I realized that I could treat generative urban spatial distributions exactly like financial stock assets in a portfolio. By applying Harry Markowitz’s Modern Portfolio Theory (MPT), an architect could computationally balance competing spatial elements—minimizing macroeconomic covariance risk while maximizing the urban yield envelope.


🚀 What It Does

BIM MPT Urban Optimizer AI Agent is a complete, full-stack, autonomous architectural financial engineering co-pilot. It allows developers and master-planners to test zoning layouts, execute macro correlation shocks, and dynamically stream the mathematically optimal configuration directly into Autodesk Revit 2027.

The system runs as two connected components: a cloud-hosted React/Express web application (deployed on Google Cloud Run) providing the optimization workspace and AI co-pilot, and a local Autodesk Revit 2027 C# add-in that receives live data from the cloud via a bridge server and materializes the optimized zoning directly into the BIM model.

The platform provides a highly visual, interactive web workspace containing:

  1. Interactive Correlation Matrix Heatmap: Modulate cross-asset dependencies (e.g., how Residential performance correlates to Commercial demand during economic cycles) to re-evaluate the risk boundaries.
  2. Markowitz Efficient Frontier Curve: A visual interface charting the exact boundary hyperbola where no higher architectural yield can be attained for a given volatility risk level.
  3. Generative BIM 3D Isometric Viewer: A parametric grid rendering real-time spatial configurations that can be manipulated instantly.
  4. Quant AI Agent Panel: An integrated conversational terminal running Gemini with explicit tool execution logic.

🏗️ How I Built It & Infrastructure Configurations

As a solo developer, I engineered a specialized, multi-tiered pipeline linking cloud analytics directly with physical 3D CAD modeling:

  • Google Cloud Infrastructure & Architecture & Geopolitical Hurdles:

To ensure low-latency tool control and robust observability, the architectural brain of our agent is fully productized and deployed on Google Cloud Platform:

  • Google Cloud Run (forge-ai): Our Express service loop is fully containerized and managed as a serverless instance in the europe-west2 region. It utilizes dynamic auto-scaling structures (scaling from 0 to 1 instance) to handle incoming portfolio optimization arrays with high compute efficiency.
  • Observability & Analytics Tracking: We leverage continuous Google Cloud monitoring loops to track request counts and latencies, ensuring our state sync loops routinely process linear algebra coordinate sets across the network securely and with minimal delay.

  • Because I am based in Egypt, strict international financial regulations and local banking rules prevented me from activating a standard Google Cloud platform billing account. To bypass this barrier and fully meet the mandatory hackathon rules, I resourcefully used direct integration deployment paths inside Google AI Studio to host the server container natively on Google Cloud Run (Project ID: glossy-ripple-pc9s2, Service: forge-ai). This acts as the public API endpoint handling complex optimization telemetry.

  • The Mathematical Engine: Written in high-performance pure JavaScript (ES6), my core linear algebra solver runs partial-pivoting Gaussian elimination directly in a lightweight browser client with zero interface lag. It evaluates hyperbolic scalars $A$, $B$, $C$, and $D$ to analytically solve the optimization distribution vector $w = g + h\mu_p$.

  • The Front-End Interface: Built with React 19, Vite, Tailwind CSS, and Lucide React. I implemented Recharts to plot continuous frontier hyperbola lines superimposed over live Monte Carlo simulation asset clouds.

  • The AI Co-Pilot Node Server: An Express backend leveraging the official @google/genai library. It maps unstructured natural language prompts into executable parameters utilizing Gemini function calls (runOptimization and checkFeasibility).

  • The BIM Automation Bridge: A dedicated C# .NET 10 Add-In plugin using the Autodesk Revit 2027 SDK API. It runs an internal asynchronous loop via an HTTP listener thread (LiveMptBridgeServerCommand) to avoid freezing the CAD software while instantly materializing 3D DirectShape mass objects over local network connections.


🛑 Challenges Faced & Limits Overcome

  1. International Billing Restrictions: Regional banking regulations in Egypt blocked the activation of traditional cloud billing credentials. I resolved this constraint by utilizing Google AI Studio's direct deployment pipelines to map the backend code cleanly into an active, functional Cloud Run environment.
  2. The "Long-Only" Space Paradox (Negative Space): A significant hurdle emerged when resolving raw unconstrained MPT matrices; the formulas occasionally resulted in negative weight variables. While a financial fund manager can short-sell a stock, "short-selling" physical space has no logical translation in real estate (you cannot build negative square meters of an industrial warehouse). To solve this physical spatial boundary constraint, I introduced an analytical projection solver using a probability simplex projection script (projectToSimplex). This forces the generative agent weights to gracefully conform to continuous non-negative bounds ($\sum w_i = 1.0, w_i \ge 0$) while preserving the maximum possible Sharpe ratio.
  3. The Revit Threading Constraint: The native Autodesk Revit API is strictly single-threaded, meaning external network requests completely freeze the user interface frame rates. I bypassed this by implementing an asynchronous background polling loop connected to a thread-safe IExternalEventHandler pattern (AsyncRevitLayoutHandler.cs), allowing live 3D geometric transformations to stream seamlessly onto the canvas.

📈 Accomplishments That I Am Proud Of

  • Successfully implemented real-time matrix inversion directly in a lightweight browser client with zero interface lag during mouse drag events.
  • Empowered the AI agent to explicitly identify physical model impossibilities (infeasible bounds) and transparently explain to the user why a specific financial layout model requires simplex adjustment before generation.
  • Achieved zero-UI-lock roundtrip polling sync between a React browser dashboard and a native desktop environment element engine (Autodesk Revit).
  • Navigated international financial infrastructure barriers: Resolved Google Cloud billing restrictions due to regional payment limitations by leveraging Google AI Studio for direct Gemini integration, enabling Cloud Run deployment without traditional credit card-based billing infrastructure.
  • Implemented agentic AI via Google AI Studio: Integrated Gemini 3.7 Flash function calling directly into the Express backend, enabling autonomous multi-turn tool execution (runOptimization, checkFeasibility) without requiring managed API infrastructure setup.

🎓 What I Learned

Cross-disciplinary engineering unlocks incredible opportunities. Applying advanced financial mathematics to physical urban master-planning removes a great deal of guesswork, helping designers quantify "diversification benefits" before laying the first structural foundation. I proved that financial portfolio diversification principles can actively prevent high-risk zoning clusters in urban design.


🔮 What's Next for BIM MPT Urban Optimizer AI Agent

  • Multi-Criteria Commodity Integration: Introduce fluctuating global material cost metrics (steel, concrete indices) directly into the volatility model matrices to balance structural risk against physical manufacturing inflation.
  • Database & Scale Cache: Once regional billing access limitations are resolved, I plan to expand this infrastructure by incorporating Google Cloud SQL and Firestore to cache historical architectural market data, allowing the Gemini AI Agent to run predictive risk-return scenarios across entire city layouts.

Built With

Share this project:

Updates

posted an update —

Major Update: Full-Stack Two-Way Telemetry & Real-Time MPT Core Engine Functional!I have officially completed and deployed the core architectural pipeline linking the live React 19 financial engineering dashboard directly with the Autodesk Revit 2027 BIM desktop workspace via a custom native C# .NET 10 background thread listener.

Log in or sign up for Devpost to join the conversation.

Submission history