state

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(name string, creator NewStateWrapperCreator) error

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

func Create

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

func NewSensorDriftWrapper

func NewSensorDriftWrapper(logger logger.Debug, env rlglue.Environment) (rlglue.Environment, error)

Types

type NewStateWrapperCreator

type NewStateWrapperCreator func(logger.Debug, rlglue.Environment) (rlglue.Environment, error)

NewStateWrapperCreator is a function that can create a state wrapper.

type SensorDriftWrapper

type SensorDriftWrapper struct {
	logger.Debug
	Env rlglue.Environment
	// WrappedEnvAttrs is information loaded from the wrapped environment.
	// The wrapped environment must provide all of the JSON attributes in WrappedEnvAttrs, otherwise Initialize will return an error.
	WrappedEnvAttrs struct {
		// NumAction is the number of actions that can be taken in the environment.
		NumAction int64 `json:"numberOfActions"`
		// StateDim is the dimension of the observation array.
		StateDim int `json:"stateDimension"`
		// StateRange is the range of observations, obtained by (max observation - min observation).
		StateRange []float64 `json:"stateRange"`
	}
	// DriftAttrs is information loaded from the json config file.
	DriftAttrs struct {
		Seed int64 `json:"seed"`
		// DriftScale is the scale of the drift with respect to the state range.
		DriftScale []float64 `json:"driftScale"`
		// SensorLife is the number of time-steps after which the probability of drift will become nearly 1
		SensorLife []float64 `json:"sensorLife"`
		// DriftProb is the probability scale, if it's less than 0, drift occurs with prob=1, if it's between 0 and 1, the max prob is scaled by this value.
		DriftProb []float64 `json:"driftProb"`
	}
	// contains filtered or unexported fields
}

SensorDriftWrapper is used to wrap an environment, adding sensor drift.

func (*SensorDriftWrapper) GetAttributes

func (wrapper *SensorDriftWrapper) GetAttributes() rlglue.Attributes

GetAttributes returns attributes for this environment.

func (*SensorDriftWrapper) Initialize

func (wrapper *SensorDriftWrapper) Initialize(run uint, attr rlglue.Attributes) error

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

func (*SensorDriftWrapper) Start

func (wrapper *SensorDriftWrapper) Start() rlglue.State

Start returns an initial observation.

func (*SensorDriftWrapper) Step

func (wrapper *SensorDriftWrapper) Step(act rlglue.Action) (rlglue.State, float64, bool)

Step takes an action and provides the resulting reward, the new observation, and whether the state is terminal. For this continuous environment, it's only terminal if the action was invalid.

Jump to

Keyboard shortcuts

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