This repository contains a university course exercise that involves simulating an automatic vacuum cleaner. The exercise includes implementing two separate algorithms and a simulator. The algorithms will be compiled into shared object files (.so), and the simulator will generate an executable to run the simulation.
To build the project, Ensure the script has execution permissions:
chmod +x ./build_all.shRun the following script:
./build_all.shAlternatively, you can build each project manually:
# Build Algorithm A
cd ./206510398_208278945_A
mkdir build
cd build
cmake ..
make
cd ../../
# Build Algorithm B
cd ./206510398_208278945_B
mkdir build
cd build
cmake ..
make
cd ../../
# Build Simulator
cd ./Simulator
mkdir build
cd build
cmake ..
make
cd ../../To execute the simulator, run:
./<path to Simulator>/build/myrobotYou can execute the program from any directory. The output files will be stored in the current working directory (CWD).
-house_path: Directory containing.housefiles. Defaults to CWD if not specified.algo_path: Directory containing.sofiles. Defaults to CWD if not specified.num_threads: Maximum number of threads to use. Defaults to 10 if not specified.summary_only: Generate only the summary CSV file and error files, without generating other output files. Defaults to false. -log: Create a log file for each algorithm-house pair. Defaults to false.
To run a specific simulation with a house and output file:
python3 ./<path to Simulation>/Simulation.py ./<houseName>.house ./<outputName>.txtThe output file format is a text file named -.txt with the following structure:
NumSteps = <NUMBER>
DirtLeft = <NUMBER>
Status = <FINISHED/WORKING/DEAD>
InDock = <TRUE/FALSE>
Score = <NUMBER>
Steps:
<list of characters in one line, no spaces, from: NESWsF>NumSteps: Number of steps takenDirtLeft: Amount of dirt leftStatus: Simulation status (FINISHED/WORKING/DEAD)InDock: Whether the robot is in the docking station at the end (TRUE/FALSE)Score: Computed score based on the simulation