This is the React frontend for the Location Optimization Tool, a geospatial decision support app. It allows users to interactively select locations on a map and solve optimization problems using:
- A Genetic Algorithm (GA) for route optimization
- A P-Median model for facility location selection
🧠 The optimization logic is handled by a separate Flask backend, deployed on Render. This frontend communicates with the backend via RESTful API calls.
- 📌 Click on the map to select locations
- 💰 Enter fixed costs per location (used in P-Median)
- 🧬 Configure GA parameters: generations, population size, elite size, mutation rate
- 🚚 Visualize optimized routes from the Genetic Algorithm
- 🏭 Highlight selected facilities using the P-Median model
- 🔁 Job polling for async GA results
- 🌐 OpenStreetMap integration using Leaflet
Frontend: https://or-frontend-amber.vercel.app
Backend: https://operations-research-project.onrender.com
git clone https://github.com/your-username/location-optimizer-frontend.git
cd location-optimizer-frontend
npm install
Create a .env
file in the root directory and add:
VITE_API_URL=http://localhost:5000
Replace the URL with your actual backend URL if it's deployed (e.g., the Render URL).
npm run dev
Visit http://localhost:5173 to view it in the browser.
├── public/
├── src/
│ ├── App.jsx # Main app component with all map logic and UI
│ ├── ...
│ └── ...
├── .env # API URL for connecting to backend
├── index.html
├── package.json
└── vite.config.js
This project is deployed using Vercel. To deploy:
- Push this repo to GitHub
- Import the repo in Vercel
- In project settings → Environment Variables, add:
VITE_API_URL=https://operations-research-project.onrender.com
- Deploy!
The backend is a Flask app deployed on Render, which exposes:
POST /solve/ga
– Start a Genetic Algorithm jobGET /check-status/<job_id>
– Poll job statusPOST /solve/p-median-coords
– Solve the P-Median problem
📂 The backend is maintained in a separate repository.