Skip to content
Snippets Groups Projects
Commit 004c0af9 authored by Mats Gottenbos's avatar Mats Gottenbos
Browse files

Lowered number of actions

parent 75890fe2
No related branches found
No related tags found
No related merge requests found
......@@ -19,10 +19,7 @@ class MuZeroConfig:
### Game
self.observation_shape = (3, 96, 96) # Dimensions of the game observation, must be 3D (channel, height, width). For a 1D array, please reshape it to (1, 1, length of array)
# Actions discretised in steps of 0.25:
# 9 for steering; [-1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0]
# 5 for gas, 5 for brakes; [0.0, 0.25, 0.5, 0.75, 1.0]
self.action_space = list(range(9 + 5 + 5)) # Fixed list of all possible actions. You should only edit the length
self.action_space = list(range(5)) # Fixed list of all possible actions. You should only edit the length
self.players = list(range(1)) # List of players. You should only edit the length
self.stacked_observations = 5 # Number of previous observations and previous actions to add to the current observation
......@@ -168,7 +165,7 @@ class Game(AbstractGame):
Returns:
An array of integers, subset of the action space.
"""
return list(range(9 + 5 + 5))
return list(range(5))
def reset(self):
"""
......@@ -231,16 +228,13 @@ class Game(AbstractGame):
Array with three elements: steering in range [-1, 1], gas in range [0, 1], braking in range [0, 1]
"""
steering = 0
gas = 0
brakes = 0
possibleActions = [
[0, 0, 0],
[-1, 0, 0],
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
]
if (action_number <= 9):
steering = -1 + action_number * 0.25
elif (action_number <= 14):
gas = (action_number - 10) * 0.25
else:
brakes = (action_number - 15) * 0.25
actionFormatted = [steering, gas, brakes]
actionFormatted = possibleActions[action_number]
return actionFormatted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment