Skip to content

ReplayBuffer

python_motion_planning.local_planner.ddpg.ReplayBuffer

Bases: object

Experience replay buffer to store the transitions.

Parameters:

Name Type Description Default
state_dim int

state dimension

required
action_dim int

action dimension

required
max_size int

maximum replay buffer size

required
device device

device to store the data

required

sample(batch_size)

Sample a batch of transitions from the replay buffer.

Parameters:

Name Type Description Default
batch_size int

batch size

required

Returns:

Name Type Description
batch_s Tensor

batch of states

batch_a Tensor

batch of actions

batch_r Tensor

batch of rewards

batch_s_ Tensor

batch of next states

batch_win Tensor

batch of win or otherwise, True: win (reached the goal), False: otherwise.

store(s, a, r, s_, win)

Store a new transition in the replay buffer.

Parameters:

Name Type Description Default
s Tensor

state

required
a Tensor

action

required
r Tensor

reward

required
s_ Tensor

next state

required
win bool

win or otherwise, True: win (reached the goal), False: otherwise.

required