Skip to content

Amaan895469/Location-Optimizer-Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📍 Location Optimizer Frontend

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.

🧩 Features

  • 📌 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

🚀 Live Demo

Frontend: https://or-frontend-amber.vercel.app
Backend: https://operations-research-project.onrender.com


🛠️ Local Development

1. Clone this repo

git clone https://github.com/your-username/location-optimizer-frontend.git
cd location-optimizer-frontend

2. Install Dependencies

npm install

3. Configure Environment Variables

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).

4. Run the Development Server

npm run dev

Visit http://localhost:5173 to view it in the browser.

🧾 Project Structure

├── 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

📦 Deployment

This project is deployed using Vercel. To deploy:

  1. Push this repo to GitHub
  2. Import the repo in Vercel
  3. In project settings → Environment Variables, add:
VITE_API_URL=https://operations-research-project.onrender.com
  1. Deploy!

🧠 Backend Info

The backend is a Flask app deployed on Render, which exposes:

  • POST /solve/ga – Start a Genetic Algorithm job
  • GET /check-status/<job_id> – Poll job status
  • POST /solve/p-median-coords – Solve the P-Median problem

📂 The backend is maintained in a separate repository.

About

React App for facility location optimizer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published