agent

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package agent provides the agent implementations and base tooling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(logger *log.Logger) func(*Base)

WithLogger adds a logger to the base.

func WithPort

func WithPort(port string) func(*Base)

WithPort sets the port that the agent serves on.

func WithTracker

func WithTracker(tracker *track.Tracker) func(*Base)

WithTracker sets the tracker being used by the agent

func WithoutServer

func WithoutServer() func(*Base)

WithoutServer will prevent the provisioning of a server for the agent.

func WithoutTracker

func WithoutTracker() func(*Base)

WithoutTracker prevents tracker from being created.

Types

type Base

type Base struct {
	// Name of the agent.
	Name string

	// Port agent is serving on.
	Port string

	// Tracker for the agent.
	Tracker *track.Tracker

	// Logger for the agent.
	Logger *log.Logger
	// contains filtered or unexported fields
}

Base is an agents base functionality.

func NewBase

func NewBase(name string, opts ...Opt) *Base

NewBase returns a new base agent. Any errors will be fatal.

func (*Base) ApplyHandlers

func (b *Base) ApplyHandlers(mux *http.ServeMux) error

ApplyHandlers adds the base handlers.

func (*Base) InfoHandler

func (b *Base) InfoHandler(w http.ResponseWriter, req *http.Request)

InfoHandler returns info about the agent.

func (*Base) MakeEpisodes

func (b *Base) MakeEpisodes(num int) track.Episodes

MakeEpisodes creates a set of episodes for training and stores the number for configuration.

func (*Base) Render

func (b *Base) Render(env *envv1.Env) error

Render the given data to the ui.

func (*Base) Serve

func (b *Base) Serve()

Serve the agent api/ui.

func (*Base) View

func (b *Base) View()

View starts the local agent server and opens a browser to it.

func (*Base) Wait

func (b *Base) Wait()

Wait before exiting with a prompt.

type Opt

type Opt func(*Base)

Opt is an option for the base agent.

Directories

Path Synopsis
Package deepq is an agent implementation of the DeepQ algorithm.
Package deepq is an agent implementation of the DeepQ algorithm.
her
Package her is an agent implementation of the Hindsight Experience Replay algorithm.
Package her is an agent implementation of the Hindsight Experience Replay algorithm.
nes
Package nes is an agent implementation of the Natural Evolution Strategies algorithm.
Package nes is an agent implementation of the Natural Evolution Strategies algorithm.
ppo
Package ppo is an agent implementation of the Proximal Policy Optimization algorithm.
Package ppo is an agent implementation of the Proximal Policy Optimization algorithm.
q
Package q is an agent implementation of the Q learning algorithm.
Package q is an agent implementation of the Q learning algorithm.
Package reinforce is an agent implementation of the REINFORCE algorithm.
Package reinforce is an agent implementation of the REINFORCE algorithm.

Jump to

Keyboard shortcuts

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