Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature requests for Billiards environment #16

Open
1 of 3 tasks
ischurov opened this issue Jan 27, 2018 · 2 comments
Open
1 of 3 tasks

Feature requests for Billiards environment #16

ischurov opened this issue Jan 27, 2018 · 2 comments

Comments

@ischurov
Copy link
Contributor

ischurov commented Jan 27, 2018

  • Add possibility to change the size of environment. Currently, if you change SIZE to be equal 1, you stuck in infinite loop waiting for "good configuration", as the inital coordinates are chosen randomly from some large square that does not depend on SIZE. Also, I believe radius of balls should be scaled with respect to SIZE.
  • Add vnorm option that defines the norm of the initial velocity vectors.
  • Vectorize make_steps and make_frames, i.e. they have to accept parameter num_samples and create an appropriate [num_samples, ...] tensors. Currently, only one series of frames is generated, so to generate e.g. 10000 samples I have to run make_steps or make_frames in a loop, that makes things slow. I believe that proper vectorized implementation can be much faster. I'm personally interested currently in vectorized make_steps (to obtain coordinates of balls), but make_frames also should be vectorized. This also demand vectorization of self.x and self.v.
@duguyue100
Copy link
Contributor

@ischurov, here are some comments on your features:

  1. I believe that the size of the grid is controlled by SIZE, and if the SIZE is too small, then it's impossible to get balls are small enough to be in the environment, you can pass the parameter r to control the radius. Current default r is 1.2 for each ball, but you can configure them as other sizes too.
  2. I've added a self.vnorm for taking the norm of the initial velocity.
  3. I will find another time to vectorize make_steps and make_frames, I think I can vectorize most of the parts.

@ischurov
Copy link
Contributor Author

ischurov commented Feb 1, 2018

@duguyue100 thanks!

  1. Fixing r does not work, I tried it. We have problems on this line
        while not good_config:
            x = 2+np.random.rand(self.n, 2)*8

Here numbers 2 and 8 are hardcoded, but they should depend on r as well, I believe. Otherwise, we are trying to put the ball outside of the allowed region.

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

No branches or pull requests

2 participants