Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

randomBiasState #70

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Jason27chan
Copy link

Fixes #64
Created a function randomBiasState that returns a point based on a goal state and goal bias using logit function

@Jason27chan Jason27chan changed the title Fixes #64 randomBiasState Mar 1, 2017
@jgkamat jgkamat requested a review from joshhting March 1, 2017 04:12
Copy link
Contributor

@jgkamat jgkamat left a comment

Choose a reason for hiding this comment

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

I have the small comment above, I'm going to let @joshhting do the full review, but it looks good to me overall! Nice job commenting everything! 😄

I also think this is a nice opportunity to make some pretty graphs about the random distribution, (which we could publish in our TDP next year maybe?) Up to you though!

*/
POINT_CLASS randomBiasState(const POINT_CLASS& goalState, float goalBias) const {
// Generates random value based on goalBias
float logitX = logit(goalBias, drand48() * .8 + .1);
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to use the c++ rand function here
see this: http://en.cppreference.com/w/cpp/numeric/random/rand

You can get a double from it by dividing it with RAND_MAX. I'm not sure if this random value has special significance though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any advantage in doing that over drand48 though?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to use the c++ libraries when possible (because they fit in better both in style and in function to the rest of c++).

Copy link
Contributor

@joshhting joshhting left a comment

Choose a reason for hiding this comment

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

I know I said the distribution was fine before, but now that I think about it I think the effect is too pronounced. For a nonzero goal bias, it pretty much defines a small rectangle within the search space with practically visible borders that it searches within, and the nodes are never able to extend to anywhere outside that region. I think the effect should look more gradual than it does right now, so that for small goal biases, the tree is still spread out throughout the whole field. The problem with the current distribution is that when you place an obstacle very near the goal state, it is never able to escape for most goal biases because 100% of the extend() calls extend into the obstacle and fail. I think the best way of solving this is relaxing our bounds from [.1, .9) to something like [.05, .95). Play around with these values when you've got time and see if you can observe a less concentrated distribution.

@joshhting
Copy link
Contributor

Also, feel free to push this to a RoboJackets modify-random-pool branch so that people who pull your code don't have to add a new remote for your own fork

@Jason27chan
Copy link
Author

Jason27chan commented Mar 5, 2017

Just to be clear, what we have currently is the following diagrams
screenshot from 2017-03-05 19-21-59
screenshot from 2017-03-05 half goal bias
screenshot from 2017-03-05 90 goal bias

This is the current problem case

problem case

Copy link
Contributor

@jgkamat jgkamat left a comment

Choose a reason for hiding this comment

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

Is randomBiasState called anywhere, or is it waiting for an implmementation somewhere? Did you remove it in a later commit (was it being called somewhere before)?

POINT_CLASS randomBiasState(const POINT_CLASS& goalState, float goalBias) const {
// Generates random value based on goalBias
float logitX = logit(goalBias / 3 + .67, (float) rand() / RAND_MAX);
float logitY = logit(goalBias / 3 + .67, (float) rand() / RAND_MAX);
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this 0.67 value guess and check? Where did it come from?

@joshhting
Copy link
Contributor

Is this still going to happen? Regardless of whether we implement this as the default feature or not, it'd be nice to have it as an option that we could set to compare performance. Otherwise this pull request should be closed.

@joshhting joshhting closed this May 23, 2017
@joshhting joshhting reopened this May 23, 2017
@jgkamat
Copy link
Contributor

jgkamat commented May 23, 2017

I would definetly like to merge this (as a seperate option), so that we can use it when tuning things later (which we need to do for performance....)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants