juniorrojas / hookean-springs-pytorch

Hookean springs in PyTorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hookean-springs-pytorch

Hookean springs in PyTorch.

The code in this repository shows how to compute the potential energy of a mass-spring system using differentiable tensor operations. Read more here.

examples

Tested with Python 3.7 and PyTorch 1.6.0.

Set your PYTHONPATH to run the examples.

export PYTHONPATH=.

minimization loop

The state containing vertex positions is x: float(n, 2), where n is the number of vertices. The script prints x after every optimization step.

python examples/example_no_render.py

matplotlib visualization

python examples/example_render.py

citation

This code was released as supplementary material for the paper Deep reinforcement learning for 2D soft body locomotion to illustrate implementation details. To cite this in your research, please use the following BibTeX entry:

@conference{rojas2019-drl-sbl,
  title = {Deep reinforcement learning for 2{D} soft body locomotion},
  author = {Junior Rojas and Stelian Coros and Ladislav Kavan},
  booktitle = {NeurIPS Workshop on Machine Learning for Creativity and Design 3.0},
  year = {2019}
}

About

Hookean springs in PyTorch


Languages

Language:Python 100.0%