autonomy-and-verification-uol / mapc2020-lfc

MLFC team code for the 2020 Multi-Agent Programming Contest.
0 stars 1 forks source link

Cartography: wrong computation at small grid width and height #15

Closed svenlinker closed 4 years ago

svenlinker commented 4 years ago

If the size of the grid is small in one direction, the cartography is off.

Example x10.json: width is set to 10. I got results between 30 and 34 from the cartographersX Example x20.json width is set to 20. I got 40 as a result of the cartographers (twice) Example x30.json width is set to 30. I got 34, 36 as a result (Sidenote: one of the cartographers apparently got stuck somewhere and missed some turns) Example x40.json width set to 40. I got both 40 and 41 as results. I assume this is the breaking point of the bug (roughly), as this is the first size where I got a correct result as well. (Sidenote: when the cartographersX finished, they were also missing a turn)

These results also hold for Y cartography. cart_distance_bug.zip

rafaelcaue commented 4 years ago

Thanks Sven, I think I fixed it now (will commit in a sec).

The problem was the trigger for identifying when a cycle (this is what I call when the two cartographers meet again) is complete. When they start, they are still in vision, so if we do nothing this would trigger the end of the cycle. My solution was to make sure the agents had at least moved in opposing directions for a number of times. This number was 15, which was a bit too high.

I have lowered this to 5, this guarantees that they are no longer in vision. Of course if the map is 10 this still won't work, as there would be 5+5 distance plus 4 of vision which gives us 14. Anything bigger than 14 should work, and has been working in my tests.