agent

package
v0.0.0-...-5c0e551 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(name string, creator NewAgentCreator) error

Add is used to register a new agent type. This is most likely called by an init function in the Agent's go file. The function returns an error if an agent with that name already exists.

func Create

func Create(name string, debug logger.Debug) (rlglue.Agent, error)

func NewDqn

func NewDqn(logger logger.Debug) (rlglue.Agent, error)

func NewESarsa

func NewESarsa(logger logger.Debug) (rlglue.Agent, error)

func NewExample

func NewExample(logger logger.Debug) (rlglue.Agent, error)

func NewHandController

func NewHandController(logger logger.Debug) (rlglue.Agent, error)

func NewRandom

func NewRandom(logger logger.Debug) (rlglue.Agent, error)

Types

type Dqn

type Dqn struct {
	logger.Debug
	// contains filtered or unexported fields
}

func (*Dqn) End

func (agent *Dqn) End(state rlglue.State, reward float64)

End informs the agent that a terminal state has been reached, providing the final reward.

func (*Dqn) Feed

func (agent *Dqn) Feed(lastS rlglue.State, lastA int, state rlglue.State, reward float64, gamma float64)

func (*Dqn) Initialize

func (agent *Dqn) Initialize(run uint, expAttr, envAttr rlglue.Attributes) error

func (*Dqn) Policy

func (agent *Dqn) Policy(state rlglue.State) int

Choose action

func (*Dqn) Start

func (agent *Dqn) Start(state rlglue.State) rlglue.Action

Start provides an initial observation to the agent and returns the agent's action.

func (*Dqn) StateNormalization

func (agent *Dqn) StateNormalization(state rlglue.State) rlglue.State

func (*Dqn) Step

func (agent *Dqn) Step(state rlglue.State, reward float64) rlglue.Action

Step provides a new observation and a reward to the agent and returns the agent's next action.

func (*Dqn) Update

func (agent *Dqn) Update()

type ESarsa

type ESarsa struct {
	logger.Debug
	// contains filtered or unexported fields
}

Expected sarsa-lambda with tile coding

func (*ESarsa) ActionValue

func (agent *ESarsa) ActionValue(tileCodedStateActiveFeatures []int, action rlglue.Action) float64

ActionValue returns action value for a tile coded state and action pair

func (*ESarsa) End

func (agent *ESarsa) End(state rlglue.State, reward float64)

End informs the agent that a terminal state has been reached, providing the final reward.

func (*ESarsa) Initialize

func (agent *ESarsa) Initialize(run uint, expAttr, envAttr rlglue.Attributes) error

Initialize configures the agent with the provided parameters and resets any internal state.

func (*ESarsa) PolicyExpectedSarsaLambda

func (agent *ESarsa) PolicyExpectedSarsaLambda(tileCodedStateActiveFeatures []int) (rlglue.Action, []float64)

PolicyExpectedSarsaLambda returns action based on tile coded state

func (*ESarsa) Start

func (agent *ESarsa) Start(state rlglue.State) rlglue.Action

Start provides an initial observation to the agent and returns the agent's action.

func (*ESarsa) Step

func (agent *ESarsa) Step(state rlglue.State, reward float64) rlglue.Action

Step provides a new observation and a reward to the agent and returns the agent's next action.

type Example

type Example struct {
	logger.Debug
	// contains filtered or unexported fields
}

Example just iterates through all actions, starting from a random one.

func (*Example) End

func (agent *Example) End(state rlglue.State, reward float64)

End informs the agent that a terminal state has been reached, providing the final reward.

func (*Example) Initialize

func (agent *Example) Initialize(run uint, expAttr, envAttr rlglue.Attributes) error

Initialize configures the agent with the provided parameters and resets any internal state.

func (*Example) Start

func (agent *Example) Start(state rlglue.State) rlglue.Action

Start provides an initial observation to the agent and returns the agent's action.

func (*Example) Step

func (agent *Example) Step(state rlglue.State, reward float64) rlglue.Action

Step provides a new observation and a reward to the agent and returns the agent's next action.

type HandController

type HandController struct {
	logger.Debug
	// contains filtered or unexported fields
}

func (*HandController) End

func (agent *HandController) End(state rlglue.State, reward float64)

End informs the agent that a terminal state has been reached, providing the final reward.

func (*HandController) Initialize

func (agent *HandController) Initialize(run uint, expAttr, envAttr rlglue.Attributes) error

Initialize configures the agent with the provided parameters and resets any internal state.

func (*HandController) Start

func (agent *HandController) Start(state rlglue.State) rlglue.Action

Start provides an initial observation to the agent and returns the agent's action.

func (*HandController) Step

func (agent *HandController) Step(state rlglue.State, reward float64) rlglue.Action

Step provides a new observation and a reward to the agent and returns the agent's next action.

type NewAgentCreator

type NewAgentCreator func(logger.Debug) (rlglue.Agent, error)

NewAgentCreator is a function that can create an agent.

type Random

type Random struct {
	logger.Debug
	// contains filtered or unexported fields
}

Random takes a random action at each timestep.

func (*Random) End

func (agent *Random) End(state rlglue.State, reward float64)

End informs the agent that a terminal state has been reached, providing the final reward.

func (*Random) Initialize

func (agent *Random) Initialize(run uint, expAttr, envAttr rlglue.Attributes) error

Initialize configures the agent with the provided parameters and resets any internal state.

func (*Random) Start

func (agent *Random) Start(state rlglue.State) rlglue.Action

Start provides an initial observation to the agent and returns the agent's action.

func (*Random) Step

func (agent *Random) Step(state rlglue.State, reward float64) rlglue.Action

Step provides a new observation and a reward to the agent and returns the agent's next action.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL