Coder Social home page Coder Social logo

svenkreiss / socialforce Goto Github PK

View Code? Open in Web Editor NEW
121.0 4.0 42.0 70.24 MB

Differentiable Social Force simulation with universal interaction potentials.

License: MIT License

Python 48.86% Jupyter Notebook 49.71% TeX 1.43%
differentiable-simulations social-force-model

socialforce's People

Contributors

svenkreiss avatar thedebugger811 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

socialforce's Issues

pip install problem

I cloned the source into my computer several days ago, and use cmd to the file directory and run the instruction "pip install 'socialforce[test,plot]'" and "pip install -e '.[test,plot]'", both return error. First command said "ERROR: Could not find a version that satisfies the requirement socialforce[plot,test] (from versions: none);ERROR: No matching distribution found for socialforce[plot,test]", Second command said "Obtaining file:///F:/GA/socialforce
ERROR: Command errored out with exit status 1:
command: 'c:\users\shu\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'F:\GA\socialforce\setup.py'"'"'; file='"'"'F:\GA\socialforce\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Shu\AppData\Local\Temp\pip-pip-egg-info-9y13w3ed'
cwd: F:\GA\socialforce
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "F:\GA\socialforce\setup.py", line 17, in
long_description=open('README.rst').read(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 312: illegal multibyte sequence
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ".by the way, my operation system is windows 10, and my pip version is โ€˜pip 20.1.1โ€™.Thanks

torch issue "one of the variables needed for gradient computation has been modified by an inplace operation"

HI,

great repo - I want to use it at my classes. It seems the best implementation of SF model in python I have seen. Lightweight and well documented.

Yet I have issues running it, basically torch fails on all the *.generate() calls from your code, like in this example:

import socialforce
import torch

ped_ped = socialforce.potentials.PedPedPotential()
parallel = socialforce.scenarios.ParallelOvertake(ped_ped=ped_ped)

_ = torch.manual_seed(42)
scenarios_1 = parallel.generate(1)

it raises:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [2, 2]], which is output 0 of LinalgVectorNormBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

Installation issue

Maybe that is one of causes, my installation failed on this:

!pip install 'socialforce[dev,plot]'

Collecting socialforce[dev,plot]
  Using cached socialforce-0.2.1.tar.gz (15 kB)
  Preparing metadata (setup.py) ... Requirement already satisfied: numpy in [/Users/rafalkucharski/miniforge3/envs/socialforce/lib/python3.11/site-packages](https://file+.vscode-resource.vscode-cdn.net/Users/rafalkucharski/miniforge3/envs/socialforce/lib/python3.11/site-packages) (from socialforce[dev,plot]) (1.24.2)
  Using cached socialforce-0.2.0.tar.gz (16 kB)
  Preparing metadata (setup.py) ... ERROR: Cannot install socialforce[dev,plot]==0.2.0 and socialforce[dev,plot]==0.2.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    socialforce[dev,plot] 0.2.1 depends on torch
    socialforce[dev,plot] 0.2.0 depends on torch

This is my conda list

# packages in environment at /Users/rafalkucharski/miniforge3:
#
# Name                    Version                   Build  Channel
accessible-pygments       0.0.3                    pypi_0    pypi
alabaster                 0.7.13                   pypi_0    pypi
appnope                   0.1.3              pyhd8ed1ab_0    conda-forge
astroid                   2.15.0                   pypi_0    pypi
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
attrs                     22.2.0                   pypi_0    pypi
babel                     2.12.1                   pypi_0    pypi
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.11.2                   pypi_0    pypi
brotlipy                  0.7.0           py310h8e9501a_1005    conda-forge
bzip2                     1.0.8                h3422bc3_4    conda-forge
ca-certificates           2022.12.7            h4653dfc_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h2399d43_3    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
click                     8.1.3                    pypi_0    pypi
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     23.1.0          py310hbe9552e_0    conda-forge
conda-package-handling    2.0.2              pyh38be061_0    conda-forge
conda-package-streaming   0.7.0              pyhd8ed1ab_1    conda-forge
contourpy                 1.0.7                    pypi_0    pypi
coverage                  7.2.1                    pypi_0    pypi
cryptography              39.0.0          py310hfc83b78_0    conda-forge
cycler                    0.11.0                   pypi_0    pypi
debugpy                   1.6.6           py310h0f1eb42_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
dill                      0.3.6                    pypi_0    pypi
docutils                  0.18.1                   pypi_0    pypi
exceptiongroup            1.1.1                    pypi_0    pypi
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
fastjsonschema            2.16.3                   pypi_0    pypi
flameprof                 0.4                      pypi_0    pypi
fonttools                 4.39.0                   pypi_0    pypi
idna                      3.4                pyhd8ed1ab_0    conda-forge
imagesize                 1.4.1                    pypi_0    pypi
importlib-metadata        6.0.0              pyha770c72_0    conda-forge
importlib_metadata        6.0.0                hd8ed1ab_0    conda-forge
iniconfig                 2.0.0                    pypi_0    pypi
ipykernel                 6.15.0             pyh736e0ef_0    conda-forge
ipython                   8.11.0             pyhd1c38e8_0    conda-forge
isort                     5.12.0                   pypi_0    pypi
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2                    pypi_0    pypi
jsonschema                4.17.3                   pypi_0    pypi
jupyter-book              0.15.0                   pypi_0    pypi
jupyter-cache             0.5.0                    pypi_0    pypi
jupyter_client            8.0.3              pyhd8ed1ab_0    conda-forge
jupyter_core              5.2.0           py310hbe9552e_0    conda-forge
kiwisolver                1.4.4                    pypi_0    pypi
latexcodec                2.0.1                    pypi_0    pypi
lazy-object-proxy         1.9.0                    pypi_0    pypi
libcxx                    14.0.6               h2692d47_0    conda-forge



libffi                    3.4.2                h3422bc3_5    conda-forge
libsodium                 1.0.18               h27ca646_1    conda-forge
libsqlite                 3.40.0               h76d750c_0    conda-forge
libzlib                   1.2.13               h03a7124_4    conda-forge
linkify-it-py             2.0.0                    pypi_0    pypi
markdown-it-py            2.2.0                    pypi_0    pypi
markupsafe                2.1.2                    pypi_0    pypi
matplotlib                3.7.1                    pypi_0    pypi
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mccabe                    0.7.0                    pypi_0    pypi
mdit-py-plugins           0.3.5                    pypi_0    pypi
mdurl                     0.1.2                    pypi_0    pypi
myst-nb                   0.17.1                   pypi_0    pypi
myst-parser               0.18.1                   pypi_0    pypi
nbclient                  0.5.13                   pypi_0    pypi
nbformat                  5.7.3                    pypi_0    pypi
nbstripout                0.6.1                    pypi_0    pypi
nbval                     0.10.0                   pypi_0    pypi
ncurses                   6.3                  h07bb92c_1    conda-forge
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
numpy                     1.24.2                   pypi_0    pypi
openssl                   3.0.8                h03a7124_0    conda-forge
packaging                 23.0               pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.4.0                    pypi_0    pypi
pip                       22.3.1             pyhd8ed1ab_0    conda-forge
platformdirs              3.1.1              pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
prompt-toolkit            3.0.38             pyha770c72_0    conda-forge
prompt_toolkit            3.0.38               hd8ed1ab_0    conda-forge
psutil                    5.9.4           py310h8e9501a_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pybtex                    0.24.0                   pypi_0    pypi
pybtex-docutils           1.0.2                    pypi_0    pypi
pycodestyle               2.10.0                   pypi_0    pypi
pycosat                   0.6.4           py310h8e9501a_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydata-sphinx-theme       0.13.1                   pypi_0    pypi
pygments                  2.14.0             pyhd8ed1ab_0    conda-forge
pylint                    2.17.0                   pypi_0    pypi
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9                    pypi_0    pypi
pyrsistent                0.19.3                   pypi_0    pypi
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pytest                    7.2.2                    pypi_0    pypi
python                    3.10.8          h3ba56d0_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pyyaml                    6.0                      pypi_0    pypi
pyzmq                     25.0.0          py310hc407298_0    conda-forge
readline                  8.1.2                h46ed386_0    conda-forge
requests                  2.28.2             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.17.21         py310h8e9501a_2    conda-forge
ruamel.yaml.clib          0.2.7           py310h8e9501a_1    conda-forge
setuptools                66.1.1             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snowballstemmer           2.2.0                    pypi_0    pypi
socialforce               0.2.0                    pypi_0    pypi
soupsieve                 2.4                      pypi_0    pypi
sphinx                    5.0.2                    pypi_0    pypi
sphinx-book-theme         1.0.0                    pypi_0    pypi
sphinx-comments           0.0.3                    pypi_0    pypi
sphinx-copybutton         0.5.1                    pypi_0    pypi
sphinx-design             0.3.0                    pypi_0    pypi
sphinx-external-toc       0.3.1                    pypi_0    pypi
sphinx-jupyterbook-latex  0.5.2                    pypi_0    pypi
sphinx-multitoc-numbering 0.1.3                    pypi_0    pypi
sphinx-thebe              0.2.1                    pypi_0    pypi
sphinx-togglebutton       0.3.2                    pypi_0    pypi
sphinxcontrib-applehelp   1.0.4                    pypi_0    pypi
sphinxcontrib-bibtex      2.5.0                    pypi_0    pypi
sphinxcontrib-devhelp     1.0.2                    pypi_0    pypi
sphinxcontrib-htmlhelp    2.0.1                    pypi_0    pypi
sphinxcontrib-jsmath      1.0.1                    pypi_0    pypi
sphinxcontrib-qthelp      1.0.3                    pypi_0    pypi
sphinxcontrib-serializinghtml 1.1.5                    pypi_0    pypi
sqlalchemy                1.4.46                   pypi_0    pypi
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tabulate                  0.9.0                    pypi_0    pypi
tk                        8.6.12               he1e0b03_0    conda-forge
tomli                     2.0.1                    pypi_0    pypi
tomlkit                   0.11.6                   pypi_0    pypi
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
torch                     1.13.1                   pypi_0    pypi
tornado                   6.2             py310h8e9501a_1    conda-forge
tqdm                      4.64.1             pyhd8ed1ab_0    conda-forge
traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.5.0                hd8ed1ab_0    conda-forge
typing_extensions         4.5.0              pyha770c72_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
uc-micro-py               1.0.1                    pypi_0    pypi
urllib3                   1.26.14            pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
wrapt                     1.15.0                   pypi_0    pypi
xz                        5.2.6                h57fd34a_0    conda-forge
zeromq                    4.3.4                hbdafb3b_1    conda-forge
zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
zstandard                 0.19.0          py310had9512b_1    conda-forge
zstd                      1.5.2                hf913c23_6    conda-forge

Why did you modify the constant delta_t?

Dear Mr. Kreiss,
thank you very much for your great implementation.
I'm a master's student, studying pedestrian simulation.
I read Helbing's thesis "Social force model for pedestrian dynamics" and then this repository recently. I am very much interested in your works.
I have just a short question about.......(Helbing's uses 2s for delta_t, and your repository uses 0.4s??).
it would be very helpful if you could answer the above questions for me.
Thank you very much in advance.
Kind regards,
Kenta Kawakami

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.