Skip to content

Works with stationary agents#2

Merged
svenkreiss merged 5 commits into
svenkreiss:masterfrom
vita-epfl:master
Feb 11, 2020
Merged

Works with stationary agents#2
svenkreiss merged 5 commits into
svenkreiss:masterfrom
vita-epfl:master

Conversation

@theDebugger811
Copy link
Copy Markdown
Contributor

Two Changes:

  1. Add arguments to Simulator initialiser for hyper parameter tuning
  2. Fixed 'nan' error when agents are almost stationary

Copy link
Copy Markdown
Owner

@svenkreiss svenkreiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Parth. Had some comments :)

Comment thread socialforce/simulator.py Outdated

# potentials
self.V = PedPedPotential(self.delta_t)
self.V = PedPedPotential(self.delta_t, v0, sigma)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this self.V = ped_ped or PedPedPotential(self.delta_t).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep (v0, sigma) so that one can provide them as arguments to the simulator initializer for hyper parameter tuning. Is there any other way to make this happen?
If I remove (v0, sigma), one cannot assign different values to these hyper parameters.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can provide ped_ped=PedPedPotential(v0, sigma) and also ped_ped=MyNewFunkyPedPedPotential( parameter1, parameter2, parameter3).

Comment thread socialforce/simulator.py Outdated
tau in seconds: either float or numpy array of shape[n_ped].
"""
def __init__(self, initial_state, ped_space=None, delta_t=0.4, tau=0.5):
def __init__(self, initial_state, ped_space=None, delta_t=0.4, tau=0.5,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add ped_ped=None, field_of_view=None

Comment thread socialforce/simulator.py
self.U = ped_space

# field of view
self.w = FieldOfView()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here self.w = field_of_view or FieldOfView()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add or FieldOfView() so that default behavior is restored?
Similarly for ped_ped above.

Comment thread socialforce/stateutils.py Outdated
destination_vectors = state[:, 4:6] - state[:, 0:2]
norm_factors = np.linalg.norm(destination_vectors, axis=-1)
return destination_vectors / np.expand_dims(norm_factors, -1)
desired_directions = destination_vectors / np.expand_dims(norm_factors, -1)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually fails some code checks (cannot name variable like the function). I like your name, but maybe just name it directions?

@theDebugger811
Copy link
Copy Markdown
Contributor Author

I have done the proposed edits.
However, the check still seems to fail.

Copy link
Copy Markdown
Owner

@svenkreiss svenkreiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. One more comment (with that also the tests should be fixed). But if not, please check the logs of the tests to fix them. Just click on the link and it'll take you to the right test in Travis.

Comment thread socialforce/simulator.py
self.U = ped_space

# field of view
self.w = FieldOfView()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add or FieldOfView() so that default behavior is restored?
Similarly for ped_ped above.

@theDebugger811
Copy link
Copy Markdown
Contributor Author

Thanks! The checks have been cleared. The current error in Travis file seems to be related to this issue "pylint-dev/pylint#2694" I don't think it is an issue from our code's side.

@svenkreiss
Copy link
Copy Markdown
Owner

svenkreiss commented Feb 9, 2020 via email

@svenkreiss
Copy link
Copy Markdown
Owner

Thanks!

@svenkreiss svenkreiss merged commit 579543a into svenkreiss:master Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants