--- 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 ```bash GET /health ``` ### Full Optimization Pipeline ```bash 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**: ```json { "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 ```bash POST /api/upload-dxf Content-Type: multipart/form-data file: ``` Upload DXF file and extract boundary polygon. ## 💻 Usage Example ```python 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 →](https://github.com/nxc1802/REMB/tree/main/algorithms/frontend) ## 🛠️ 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 - [Full Documentation](https://github.com/nxc1802/REMB) - [API Reference](https://github.com/nxc1802/REMB/blob/main/algorithms/README.md) - [Deployment Guide](https://github.com/nxc1802/REMB/blob/main/algorithms/DEPLOYMENT.md) ## 🏗️ 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](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.