Giter Site home page Giter Site logo

Reward about macad-gym HOT 2 CLOSED

Yiquan-lol avatar Yiquan-lol commented on June 7, 2024
Reward

from macad-gym.

Comments (2)

praveen-palanisamy avatar praveen-palanisamy commented on June 7, 2024

Hi @Yiquan-lol ,

The Reward class in reward.py has methods for the different types (currently 4) of reward functions that can be configured to be used in a MACAD-Gym environment.

For example, if you are using the following environment (as in the README example):

import gym
import macad_gym
env = gym.make("HomoNcomIndePOIntrxMASS3CTWN3-v0")
# Your agent code here

the HomoNcomIndePOIntrxMASS3CTWN3-v0 environment's config uses the following reward function:


which is defined here:
def compute_reward_corl2017(self):
self.reward = 0.0
cur_dist = self.curr["distance_to_goal"]
prev_dist = self.prev["distance_to_goal"]
# Distance travelled toward the goal in m
self.reward += np.clip(prev_dist - cur_dist, -10.0, 10.0)
# Change in speed (km/h)
self.reward += 0.05 * (
self.curr["forward_speed"] - self.prev["forward_speed"])
# New collision damage
self.reward -= .00002 * (
self.curr["collision_vehicles"] +
self.curr["collision_pedestrians"] + self.curr["collision_other"] -
self.prev["collision_vehicles"] -
self.prev["collision_pedestrians"] - self.prev["collision_other"])
# New sidewalk intersection
self.reward -= 2 * (self.curr["intersection_offroad"] -
self.prev["intersection_offroad"])
# New opposite lane intersection
self.reward -= 2 * (self.curr["intersection_otherlane"] -
self.prev["intersection_otherlane"])
return self.reward

from macad-gym.

praveen-palanisamy avatar praveen-palanisamy commented on June 7, 2024

Converting this to a discussion.

from macad-gym.

Related Issues (20)

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.