File size: 4,372 Bytes
102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c b010f1b 102687c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | ---
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: <DXF 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. |