Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 1.62 KB

README.md

File metadata and controls

29 lines (19 loc) · 1.62 KB

How to customize agent

1. Inherit BaseAgent class.

  • If you want to add a new agent without inheriting the provided agents, you must inherit the base agent.
  • Every agent must includes keward arguments when defined. You should use **kwargs in __init__.

reference: dqn.py, reinforce.py, sac.py, ...

2. Implement abstract methods.

  • Abstract methods(act, learn, process, save, load) should be implemented. Implement these methods by referring to the comments.
  • When implementing a process, it is easy to manage events using time_t, delta_t, event_period, and event_stamp.
    • time_t means the timestamp that the agent interacted with.
    • delta_t means the difference between the new timestamp received when the process is executed and the previous time_t.
    • event_period means the period in which the event should be executed.
    • event_stamp is added to delta_t each time the process is executed, and if it is greater than or equal to event_period, a specific event is fired.

reference: dqn.py, ...

3. If necessary, implement another method.

  • sync_in, sync_out methods are implemented base on self.network. if don't use self.network(e.g. self.actor) in agent class, should override this method.

reference: ddpg.py, sac.py, ...

  • Override set_distributed if you need additional work on the workers initialization.
  • Override interact_callback if you need additional work after interact(agent.act and env.step).

reference: ape_x.py, ...