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

Initialize damage to the initial value observed. #40

Open
Santara opened this issue Dec 15, 2019 · 0 comments
Open

Initialize damage to the initial value observed. #40

Santara opened this issue Dec 15, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Santara
Copy link
Contributor

Santara commented Dec 15, 2019

In some tracks and for some cars, the initial value of self.ob.damage is >0. In these cases, the environment detects collision right at the outset of an episode. To prevent this from happening, the initial value of self.damage in

class CollisionPenalty(MadrasReward):
def __init__(self, cfg):
self.damage = 0.0
super(CollisionPenalty, self).__init__(cfg)
def compute_reward(self, game_config, game_state):
del game_config
reward = 0.0
if self.damage < game_state["damage"]:
reward = -self.cfg["scale"]
return reward

and
class Collision(MadrasDone):
def __init__(self):
self.damage = 0.0
self.num_steps = 0
def check_done(self, game_config, game_state):
del game_config
self.num_steps += 1
if self.damage < game_state["damage"]:
logging.info("Done: Episode terminated because agent collided after {} steps.".format(self.num_steps))
self.damage = 0.0
return True
else:
return False
def reset(self):
self.damage = 0.0
self.num_steps = 0

should be set to the initial value of self.ob.damage observed upon reset.

@Santara Santara self-assigned this Dec 15, 2019
@Santara Santara added the bug Something isn't working label Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant