42 project Lem_in
Lem_in is a program whose role is to move N ants through a graph from vStart to vEnd in the least amount of steps. The program reads the graph details and number of ants from the standard input.
Following conditions apply :
- the graph is non-oriented
- graph details and number of ants are given at launch
- constraints : the vertices and edges have a one ant capacity
- step : moving all possible ants simultaneously without breaking the constraints
We used Edmond's Karp max flow algorithm. https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm
- gcc
- visualizer : python3
make
./lemin < map.lem
./lemin < map.lem | python3 viewer/main.py
In the order listed below
- Number of ants : integer
- Vertices definition :
name x_coordinates y_coordinates
- mandatory start vertex command :
##start
above vertex definition line - mandatory end vertex command :
##end
above vertex definition line
- mandatory start vertex command :
- Edges definition :
name_a-name_b
- comments : #
- commands : ##
10 # PHASE 1 : ants number
v_1 10 10 # PHASE 2 : vertices declaration
v_2 15 10
v_3 20 20
v_4 10 5
##end # end room definition
v_5 11 7
v_6 4 1
##start # start room definition
name 1 8
v_1-v_2 # PHASE 3 : edges definition
v_2-v_3
v_3-v_4
name-v_1
v_4-v_5
Play
: starts the programReset
: resets the program-
: zoom outExit
: exits the program