A modern web application for route optimization with interactive map visualization. This application helps optimize vehicle routes by intelligently assigning jobs to vehicles based on proximity and efficiency.
- Interactive Map Visualization: View vehicles, jobs, and optimized routes on an interactive map
- Route Optimization: Advanced algorithm to optimize vehicle routes and job assignments
- Real-time Management: Add, edit, and remove vehicles and jobs dynamically
- Modern UI: Beautiful, responsive interface with smooth animations
- Data Persistence: Save and load optimization data
- Performance Metrics: View optimization results with distance and time calculations
- Backend: Node.js, Express.js, TypeScript
- Frontend: Vanilla JavaScript, HTML5, CSS3
- Mapping: Leaflet.js for interactive maps
- Styling: Modern CSS with gradients and animations
- Icons: Font Awesome
- Node.js (>= 18)
- npm or yarn
- Clone the repository:
git clone https://github.com/Iteam1337/ruttoptimering-lab.git
cd ruttoptimering-lab- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to
http://localhost:3000
npm run build
npm start- Click "Lägg till Fordon" in the sidebar
- Fill in the vehicle description and coordinates
- Set start and end locations for the vehicle
- Click "Lägg till Jobb" in the sidebar
- Enter job description and location coordinates
- The job will appear on the map as a red marker
- Ensure you have at least one vehicle and one job
- Click "Optimera Rutter" in the header
- View the optimized routes on the map and in the results panel
- Load Data: Load existing data from the server
- Save Data: Save current vehicles and jobs to the server
- Vehicle Markers: Blue truck icons for start locations, green flags for end locations
- Job Markers: Red markers for job locations
- Route Visualization: Colored polylines showing optimized routes
- Interactive Popups: Click markers to see detailed information
- Auto-centering: Map automatically fits to show all markers
GET /- Serve the web applicationGET /api/health- Health check endpointGET /api/data- Get current vehicles and jobs dataPOST /api/data- Save vehicles and jobs dataPOST /api/optimize- Optimize routes for given vehicles and jobs
The application uses a nearest-neighbor algorithm with the following features:
- Distance Calculation: Haversine formula for accurate geographic distances
- Proximity Filtering: Jobs within 50km radius of vehicles
- Time Estimation: Rough time calculation based on distance
- Route Efficiency: Minimizes total travel distance and time
- Responsive Design: Works on desktop, tablet, and mobile
- Modern Styling: Gradient backgrounds, smooth animations
- Interactive Elements: Hover effects, loading states
- Modal Dialogs: Clean forms for adding vehicles and jobs
- Notification System: Success, error, and warning messages
The application includes Docker configuration:
docker-compose upruttoptimering-lab/
├── public/ # Frontend files
│ ├── index.html # Main HTML file
│ ├── styles.css # CSS styles
│ └── app.js # Frontend JavaScript
├── k8s/ # Kubernetes configurations
├── server.ts # Express server
├── iteam.json # Sample data
├── package.json # Dependencies and scripts
└── README.md # This file
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the ISC License.
For support and questions, please open an issue on GitHub.
Happy Route Optimizing! 🚗💨