Skip to content

Instantly share code, notes, and snippets.

@alinazhanguwo
Last active August 18, 2021 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alinazhanguwo/0ef4ad31b4675b032c549a892f914cf7 to your computer and use it in GitHub Desktop.
Save alinazhanguwo/0ef4ad31b4675b032c549a892f914cf7 to your computer and use it in GitHub Desktop.
# Encourage lander to use as little fuel as possible
# i.e. 0.85, or 0.32
fuel_conservation = fuel_remaining / total_fuel
if distance_to_goal is decreasing:
if speed < threshold:
if position is on landing pad:
# Land successfully; give a big reward
landing_reward = 100
# Multiply percentage of remaining fuel
reward = landing_reward * fuel_conservation
else:
# Landing outside of landing pad
reward = -10
else:
# Crashed
reward = -100
else:
# Encourage agents to approach the surface instead of
# hanging in the air
distance_reward = 1 - (distance_to_goal / distance_max)**0.5
reward = distance_reward * fuel_conservation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment