 # Some questions ahout the agents' speed

I want to consult some questions about the speed of agent.

Firstly, I’m not sure about if I understand the speed correctly when it is smaller than 1. Assume that the speed of agent[X] is 0.7, and ‘position_fraction’ is 0. After 2 steps of moving, does agent[X] reach the next cell and the ‘position_fraction’ becomes 0.4?

Secondly, at round 2, the speed is varying. Does it mean that the environment can change the speed and we must check the agents’ speed by function ’step’ every step?

Is somewhere I can know more details about the speed? Thanks.

Hi @sa7show

The case you described would not have worked for both Flatland 2 and Flatland 3.

In Flatland 2 this was a bug where the agent never reaches goes to the next cell as Flatland 2 used to check whether the position fraction is close to 1 with a small tolerance.

Flatland 3 uses a zero indexed speed counter system instead of position fraction, so that the count goes up to `round(1/speed) - 1`. So if speed is set to 0.5 the max count is `round(1/0.5) - 1 = 1`. For 0.7 the max count will be 0 which is same behavior as a speed of 1.

You can check the exact implementation here

Hope this helps!

Actually, I still feel puzzled about the “varying speeds” at round2. Does it mean that the agents’ speeds are changeable every step during their traveling and we must check the agents’ speeds by function ’step’ every step?

Could you please explain the “varying speeds” at round2 in detail? Thanks a lot.

1 Like

I would be interested in the answer as well!

"So rather than varying speeds it’s clearer to say multiple speeds.
There are different trains with different speeds. Their speeds are fixed throughout and never vary. Some trains are slower some are faster. Unlike round 1 where all were of the same speed.

Let me know if this clarifies your question."

Hope it is helpful to you as well.

1 Like

Yes thank you. I had exactly the same confusion as you, probably caused by these sentences

Later versions of Flatland might have varying speeds during episodes. Therefore, we return the agent speeds. Notice that we do not guarantee that the speed will be computed at each step, but if not costly we will return it at each step.

I guess it just seems weird to return the speed at every step if it is constant.

At any rate, we’re lucky that the speed of a given agent doesn’t change randomly, otherwise planning would be nearly impossible! Thanks for clarifying that for everyone

Seems I’d missed answering the question on varying speeds, thanks @sa7show for the answer. Indeed you’re right the speeds for each train are decided at the start of the episode and stays fixed throughout the episode.

1 Like