A C++ application designed to simulate and optimize daily maintenance and cleaning routes across a campus. Utilizing a graph-based location model and a Modified Dijkstra's Algorithm, this system dynamically calculates building priorities based on real-world metrics like importance, visit frequency, and dropping cleanliness levels to generate the most efficient daily cleaning schedule.
- Dynamic Priority Engine: Calculates robust location priority every day using a normalized mathematical weight of the building's Importance, current Cleanliness, Visit Priority, and elapsed time since it was last cleaned.
- Modified Dijkstra's Algorithm: Finds the optimal path between locations by considering not just physical distance, but path difficulty and the priority/need of passing through certain locations.
- Threshold-Based Cleaning: Intelligently skips cleaning locations that are already above a configurable cleanliness threshold limit to save time and cleaning costs.
- Persistent Data Tracking: Automatically saves the simulation state (cleanliness, visits, elapsed days) to a local backup file after every route generation to prevent data loss.
- Realistic Campus Model: Each location supports customized
cleaningCost(based on building size/complexity) andcleaningFrequency(e.g. daily for science labs, weekly for dorms).
The repository provides two structural versions of the system:
refactored_project/: A highly organized, production-ready version that splits the underlying logic into cleanly decoupled, modular components (src/,include/,algorithms/,models/,utils/, etc.).Improved.cpp: A raw, monolithic standalone version of the system. Excellent for quick testing and single-file compilation.
- A standard C++17 compiler (e.g.,
g++,clang++) makeormingw32-make(Optional, for building the refactored project)
1. Refactored Project (Recommended) Navigate into the refactored folder and use your system's build tool:
cd refactored_project
mingw32-make
./refactored_app(Alternatively, compile manually with g++ -std=c++17 -Iinclude src/main.cpp src/algorithms/ModifiedDijkstra.cpp src/core/CampusMap.cpp src/models/Location.cpp src/services/MaintenanceScheduler.cpp src/utils/StorageManager.cpp -o refactored_app.exe)
2. Standalone Version
g++ -std=c++17 Improved.cpp -o ImprovedApp
./ImprovedAppOnce the application executes, you will be greeted with an interactive console menu:
- Find optimal path: Input a start and end location ID to see the best routing path and total pathing cost based on distance and calculated priority.
- View campus status: See the real-time layout of the campus, including the strictly % cleanliness of every building, how many days since it was last cleaned, and its current dynamic priority score.
- Run simulation: Simulate
Xamount of days. Over time, the algorithm degrades the cleanliness of unvisited buildings and automatically routes your cleaning staff to the highest priority locations for each simulated day, accumulating a daily cost for the work done. - Reset to default configuration: Resets your simulation's wear-and-tear back to the pristine
campus_data.txtbaseline. - Exit: Securely exits the program.
All location parameters are fully dynamic! You can customize the campus logic by editing the CSV lines in data/campus_data.txt.
Format Scheme:
ID, Name, Importance(1-10), CleaningFreq(Days), VisitPriority(1-10), CleanlinessStatus(%), LastCleaned(Days), TotalVisits, CleaningCost
Example:
0,Library,9,3,8,100.0,0,0,50.0
(The Library is Highly Important (9), should ideally be cleaned every 3 days, starts at 100% cleanliness, and has a heavy cleaning cost of 50.0 due to its massive size)
Below the locations, the data file defines the connections (edges) between them.
Format Scheme:
From_ID, To_ID, Distance, TravelTime, DifficultyMultiplier
Example:
0,1,3.0,5.0,1.0
(Connecting the Library(0) to Main Building(1), with a short distance of 3.0, a standard travel time of 5.0, and a baseline flat terrain difficulty of 1.0)