REMB / README.md
Cuong2004's picture
Add Hugging Face Spaces configuration
102687c
metadata
title: REMB - Land Redistribution API
emoji: 🏘️
colorFrom: blue
colorTo: green
sdk: docker
app_file: algorithms/backend/main.py
app_port: 7860
pinned: false

REMB - Industrial Estate Master Planning API

AI-powered industrial park land subdivision and redistribution API using advanced optimization algorithms.

πŸš€ Features

  • Multi-stage Optimization: NSGA-II genetic algorithm + OR-Tools constraint programming
  • DXF Import/Export: Upload site boundaries from CAD files
  • Automated Layout: Grid optimization, block subdivision, and infrastructure planning
  • 100% Compliant: Follows Vietnamese industrial planning regulations
  • Export Results: Download results as GeoJSON or DXF

πŸ“š API Documentation

Once the Space is running, visit:

  • Interactive API Docs: /docs
  • Alternative Docs: /redoc
  • Health Check: /health

πŸ”§ API Endpoints

Health Check

GET /health

Full Optimization Pipeline

POST /api/optimize

Runs the complete 3-stage optimization:

  1. Grid Optimization (NSGA-II) - Find optimal grid orientation and spacing
  2. Block Subdivision (OR-Tools) - Subdivide blocks into individual lots
  3. Infrastructure Planning - Generate technical networks and drainage

Request Body:

{
  "config": {
    "spacing_min": 20.0,
    "spacing_max": 30.0,
    "angle_min": 0.0,
    "angle_max": 90.0,
    "min_lot_width": 20.0,
    "max_lot_width": 80.0,
    "target_lot_width": 40.0,
    "population_size": 50,
    "generations": 100
  },
  "land_plots": [{
    "type": "Polygon",
    "coordinates": [[[0, 0], [100, 0], [100, 100], [0, 100], [0, 0]]]
  }]
}

DXF Upload

POST /api/upload-dxf
Content-Type: multipart/form-data

file: <DXF file>

Upload DXF file and extract boundary polygon.

πŸ’» Usage Example

import requests

# API endpoint
url = "https://cuong2004-remb.hf.space/api/optimize"

# Configuration
payload = {
    "config": {
        "spacing_min": 20.0,
        "spacing_max": 30.0,
        "population_size": 50,
        "generations": 100
    },
    "land_plots": [{
        "type": "Polygon",
        "coordinates": [[[0, 0], [100, 0], [100, 100], [0, 100], [0, 0]]]
    }]
}

# Run optimization
response = requests.post(url, json=payload)
result = response.json()

print(f"Total blocks: {result['statistics']['total_blocks']}")
print(f"Total lots: {result['statistics']['total_lots']}")

🎨 Frontend

For a complete user interface with visualization, use the Streamlit frontend: Deploy Frontend to Streamlit Cloud β†’

πŸ› οΈ Technology Stack

  • FastAPI: High-performance Python web framework
  • DEAP: Genetic algorithms (NSGA-II)
  • OR-Tools: Google's constraint programming solver
  • Shapely: Geometric operations and spatial analysis
  • ezdxf: DXF file parsing and generation
  • Docker: Containerized deployment

πŸ“– Documentation

πŸ—οΈ Architecture

Module A - "The Architect" (NSGA-II)

  • Multi-objective genetic algorithm
  • Generate thousands of feasible layouts
  • Optimize: sellable area, green space, road access

Module B - "The Engineer" (OR-Tools)

  • Constraint programming solver
  • Ensure mathematical validity
  • Check non-overlapping, road connectivity

Module C - "The Inspector" (Regulation Checker)

  • Expert system for regulatory compliance
  • 100% adherence to Vietnamese regulations
  • Validate: setbacks, fire safety, FAR, green space

πŸ“Š Performance

  • Planning Time: 3 weeks β†’ 2 hours (99% faster)
  • Compliance: 100% regulatory adherence
  • Optimization Quality: Pareto-optimal solutions

πŸ“ License

MIT License - see LICENSE for details

πŸ‘₯ Team

Made with ❀️ by PiXerse.AI Team


Note: This Space contains the optimization API backend. For the complete user interface, deploy the frontend separately to Streamlit Cloud.