Skip to content

faq 109178894

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

Question on ParkingSlotVisualiser

by Florian Zenoni on 2017-05-02 10:01:31


Dear experts,

I am studying the content of the parkinsearch/evaluation folder, and I have a question about ParkingSlotVisualiser.

Line 215 states:

if(this.freeSlots.size() == 0) throw new RuntimeException("all slots already occupied. cannot display another occupied slot");

According to the surrounding code, my understanding is that if there aren't any available parking spots on the processed link, the execution will stop with no possibility of recovering. That is, the agent will NOT explore adjacent links to look for an available parking spot.

Is this correct? If so, is there a place where the actual "searching" takes place?

Thanks a lot

Edit: I realize now that my question is a bit silly, as the logic behind the parking search resides in other subfolders on the parkingsearch contrib.

So, reformulating the question: what are the cases in which that RuntimeException is thrown? Are they exclusively pathological ones?


Comments: 1


Re: Question on ParkingSlotVisualiser

by Tilmann Schlenther on 2017-05-03 12:09:56

Dear Florian,

you are right, this piece of code is only for viaulisation of the parking slot's occupation in time and is not part of the parking search logic of an agent.

Basically, the ParkingSlotVisualiser assigns one ParkingSlotManager to each link that has (previously defined) parking facilities on it. The ParkingSlotManager knows about all it's slots on the link. Initially, at the beginning of the first iteration, all slots are free. Whenever the ParkingSlotVisualiser registers an agent to park, it notifies the corresponding ParkingSlotManager, that deletes one slot of its list of free slots.

The exception you mentioned is thrown, when that list of free parking slots is already empty, but an agent is parking on the manager's link. As, in the simulation, it is checked whether there are vacant parking slots on a link before the agent decides to park there, this case should normally not occur. So, according to my current knowledge, yes all cases in which the RunTimeException is thrown are pathological.

If you want to know how to use the ParkingSlotVisualiser please have a look at the RunParkingSearchExample after pulling the master branch. I just included it in the example.
If you have any further questions, please don't hesitate to ask.

Cheers,

Tilmann

Clone this wiki locally