Documentation
¶
Index ¶
- type Interpreter
- type Policy
- type RLStrategy
- func (r *RLStrategy) ActionsCh() *types.Channel[*strategies.Action]
- func (r *RLStrategy) EndCurIteration(ctx *strategies.Context)
- func (r *RLStrategy) Finalize(_ *strategies.Context)
- func (r *RLStrategy) NextIteration(_ *strategies.Context)
- func (r *RLStrategy) Start() error
- func (r *RLStrategy) Step(e *types.Event, ctx *strategies.Context)
- func (r *RLStrategy) Stop() error
- type RLStrategyConfig
- type SimpleInterpreter
- type SimpleInterpreterState
- type SoftMaxPolicy
- type State
- type StateActionMap
- func (s *StateActionMap) AddState(state State)
- func (s *StateActionMap) ExistsValue(state, action string) bool
- func (s *StateActionMap) Get(state, action string) (float64, bool)
- func (s *StateActionMap) GetState(key string) (State, bool)
- func (s *StateActionMap) MaxQ(state string) (float64, bool)
- func (s *StateActionMap) Update(state, action string, val float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interpreter ¶
type Interpreter interface {
RewardFunc(State, *strategies.Action) float64
Interpret(*types.Event, *strategies.Context) State
Actions(State, *strategies.Context) []*strategies.Action
}
type Policy ¶
type Policy interface {
NextAction(*StateActionMap, State, []*strategies.Action) (*strategies.Action, bool)
}
type RLStrategy ¶
type RLStrategy struct {
*types.BaseService
// contains filtered or unexported fields
}
func NewRLStrategy ¶
func NewRLStrategy(config *RLStrategyConfig) (*RLStrategy, error)
func (*RLStrategy) ActionsCh ¶
func (r *RLStrategy) ActionsCh() *types.Channel[*strategies.Action]
func (*RLStrategy) EndCurIteration ¶
func (r *RLStrategy) EndCurIteration(ctx *strategies.Context)
func (*RLStrategy) Finalize ¶
func (r *RLStrategy) Finalize(_ *strategies.Context)
func (*RLStrategy) NextIteration ¶
func (r *RLStrategy) NextIteration(_ *strategies.Context)
func (*RLStrategy) Start ¶
func (r *RLStrategy) Start() error
func (*RLStrategy) Step ¶
func (r *RLStrategy) Step(e *types.Event, ctx *strategies.Context)
func (*RLStrategy) Stop ¶
func (r *RLStrategy) Stop() error
type RLStrategyConfig ¶
type RLStrategyConfig struct {
Alpha float64
Gamma float64
Interpreter Interpreter
Policy Policy
}
type SimpleInterpreter ¶
type SimpleInterpreter struct {
// contains filtered or unexported fields
}
func NewSimpleInterpreter ¶
func NewSimpleInterpreter() *SimpleInterpreter
func (*SimpleInterpreter) Actions ¶
func (s *SimpleInterpreter) Actions(state State, ctx *strategies.Context) []*strategies.Action
func (*SimpleInterpreter) Interpret ¶
func (s *SimpleInterpreter) Interpret(e *types.Event, ctx *strategies.Context) State
func (*SimpleInterpreter) RewardFunc ¶
func (s *SimpleInterpreter) RewardFunc(_ State, _ *strategies.Action) float64
type SimpleInterpreterState ¶
type SimpleInterpreterState struct {
// contains filtered or unexported fields
}
func (*SimpleInterpreterState) Hash ¶
func (s *SimpleInterpreterState) Hash() string
type SoftMaxPolicy ¶
type SoftMaxPolicy struct {
}
func NewSoftMaxPolicy ¶
func NewSoftMaxPolicy() *SoftMaxPolicy
func (*SoftMaxPolicy) NextAction ¶
func (p *SoftMaxPolicy) NextAction(saMap *StateActionMap, state State, actions []*strategies.Action) (*strategies.Action, bool)
type StateActionMap ¶
type StateActionMap struct {
// contains filtered or unexported fields
}
func (*StateActionMap) AddState ¶
func (s *StateActionMap) AddState(state State)
func (*StateActionMap) ExistsValue ¶
func (s *StateActionMap) ExistsValue(state, action string) bool
func (*StateActionMap) Update ¶
func (s *StateActionMap) Update(state, action string, val float64)
Click to show internal directories.
Click to hide internal directories.