modules

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package modules implements a module interface and several built-in ACT-R modules.

Index

Constants

View Source
const BuiltIn = "built-in"

Variables

This section is empty.

Functions

func IsValidState added in v0.12.0

func IsValidState(state string) bool

IsValidState checks if 'state' is a valid module state.

func ModuleNames added in v0.12.0

func ModuleNames() (names []string)

ModuleNames returns a slice of all the module names

func ValidStatesStr added in v0.12.0

func ValidStatesStr() string

ValidStatesStr returns a list of valid module states. Used for error output.

Types

type DeclarativeMemory

type DeclarativeMemory struct {
	Module

	RetrievalTimeParams
	FinstParams

	// "decay": sets the "base-level learning" decay parameter
	// 	ccm (DMBaseLevel submodule 'decay'): 0.5
	// 	pyactr (decay) : 0.5
	// 	vanilla (:bll): nil (recommend 0.5 if used)
	Decay *float64

	// "max_spread_strength": turns on the spreading activation calculation & sets the maximum associative strength
	// (there are no defaults since setting it activates the capability)
	//	ccm (DMSpreading submodule)
	//	pyactr (strength_of_association)
	//	vanilla (:mas)
	MaxSpreadStrength *float64

	// "instantaneous_noise": turns on the activation noise calculation & sets instantaneous noise
	// (there are no defaults since setting it activates the capability)
	// 	ccm (DMNoise submodule 'noise')
	// 	pyactr (instantaneous_noise)
	// 	vanilla (:ans)
	InstantaneousNoise *float64

	// "mismatch_penalty": turns on partial matching and sets the penalty in the activation equation to this
	// (there are no defaults since setting it activates the capability)
	// 	ccm (Partial class)
	// 	pyactr (partial_matching & mismatch_penalty)
	// 	vanilla (:mp)
	MismatchPenalty *float64
}

DeclarativeMemory is a module which provides declarative memory.

func NewDeclarativeMemory

func NewDeclarativeMemory() *DeclarativeMemory

NewDeclarativeMemory creates and returns a new DeclarativeMemory module

func (DeclarativeMemory) BufferName added in v0.9.0

func (d DeclarativeMemory) BufferName() string

We only have one buffer, so this is a convenience function to get its name.

func (DeclarativeMemory) IsUsingBaseLevelLearning added in v0.12.0

func (d DeclarativeMemory) IsUsingBaseLevelLearning() bool

IsUsingBaseLevelLearning returns whether base-level learning is active or not.

func (DeclarativeMemory) IsUsingSpreadingActivation added in v0.12.0

func (d DeclarativeMemory) IsUsingSpreadingActivation() bool

IsUsingSpreadingActivation returns whether spreading activation is active or not.

func (*DeclarativeMemory) SetParam

func (d *DeclarativeMemory) SetParam(param *keyvalue.KeyValue) (err error)

SetParam is called to set our module's parameter from the parameter in the code ("param")

type ExtraBuffers added in v0.9.0

type ExtraBuffers struct {
	Module
}

ExtraBuffers module is used to declare one or more extra goal-style buffers in the model.

func NewExtraBuffers added in v0.9.0

func NewExtraBuffers() *ExtraBuffers

NewExtraBuffers creates and returns a new ExtraBuffers module

func (*ExtraBuffers) SetParam added in v0.9.0

func (eb *ExtraBuffers) SetParam(param *keyvalue.KeyValue) (err error)

SetParam is called to set our module's parameter from the parameter in the code ("param")

type FinstParams

type FinstParams struct {

	// "finst_size": how many chunks are retained in memory
	//	ccm (finst_size): 4
	// 	pyactr (DecMemBuffer.finst): 0 (sic)
	// 	vanilla (:declarative-num-finsts): 4
	FinstSize *int

	// "finst_time": how long the finst lasts in memory
	// 	ccm (finst_time): 3.0
	// 	pyactr: (unsupported? Always ∞ I guess?)
	// 	vanilla (:declarative-finst-span): 3.0
	FinstTime *float64
}

type Goal

type Goal struct {
	Module
}

Goal is a module which provides the ACT-R "goal" buffer.

func NewGoal

func NewGoal() *Goal

NewGoal creates and returns a new Goal module

func (Goal) Buffer added in v0.12.0

func (g Goal) Buffer() buffer.Interface

type Imaginal

type Imaginal struct {
	Module

	// "delay": how long it takes a request to the buffer to complete (seconds)
	// 	ccm (ImaginalModule.delay): 0.2
	// 	pyactr (Goal.delay): 0.2
	// 	vanilla (:imaginal-delay): 0.2
	Delay *float64
}

Imaginal is a module which provides the ACT-R "imaginal" buffer.

func NewImaginal

func NewImaginal() *Imaginal

NewImaginal creates and returns a new Imaginal module

func (*Imaginal) SetParam

func (i *Imaginal) SetParam(param *keyvalue.KeyValue) (err error)

SetParam is called to set our module's parameter from the parameter in the code ("param")

type Interface added in v0.12.0

type Interface interface {
	ModuleName() string
	ModuleVersion() string
	ModuleDescription() string

	HasBuffers() bool
	Buffers() buffer.List

	Parameters() param.ParametersInterface
	SetParam(param *keyvalue.KeyValue) error

	AllowsMultipleInit() bool
}

Interface provides an interface for the ACT-R concept of a "module".

func AllModules added in v0.12.0

func AllModules() (modules []Interface)

AllModules returns a slice of all the modules

func FindModule added in v0.12.0

func FindModule(name string) Interface

FindModule finds a module by name or returns nil if not found

type Module added in v0.9.0

type Module struct {
	Name        string
	Version     string
	Description string

	BufferList buffer.List // The buffers this module provides (may be empty)

	MultipleInit bool

	param.ParametersInterface
}

Module is an ACT-R module

func (Module) AllowsMultipleInit added in v0.12.0

func (m Module) AllowsMultipleInit() bool

AllowsMultipleInit returns whether this module allows more than one initialization. e.g. goal would only allow one, whereas declarative memory would allow multiple.

func (Module) Buffers added in v0.9.0

func (m Module) Buffers() buffer.List

func (Module) HasBuffers added in v0.12.0

func (m Module) HasBuffers() bool

func (Module) ModuleDescription added in v0.12.0

func (m Module) ModuleDescription() string

func (Module) ModuleName added in v0.9.0

func (m Module) ModuleName() string

func (Module) ModuleVersion added in v0.12.0

func (m Module) ModuleVersion() string

func (Module) Parameters added in v0.12.0

func (m Module) Parameters() param.ParametersInterface

func (Module) SetParam added in v0.12.0

func (m Module) SetParam(kv *keyvalue.KeyValue) error

type Procedural

type Procedural struct {
	Module

	// "default_action_time": time that it takes to fire a production (seconds)
	// 	ccm (production_time): 0.05
	// 	pyactr (rule_firing): 0.05
	// 	vanilla (:dat): 0.05
	DefaultActionTime *float64
}

func NewProcedural

func NewProcedural() *Procedural

NewProcedural creates and returns a new Procedural module

func (*Procedural) SetParam

func (p *Procedural) SetParam(param *keyvalue.KeyValue) (err error)

SetParam is called to set our module's parameter from the parameter in the code ("param")

type RetrievalTimeParams

type RetrievalTimeParams struct {

	// "latency_factor": latency factor (F)
	// 	ccm (latency): 0.05
	// 	pyactr (latency_factor): 0.1
	// 	vanilla (:lf): 1.0
	LatencyFactor *float64

	// "latency_exponent": latency exponent (f)
	// 	ccm: (unsupported? Based on the formulae above and the code, it seems to be fixed at 1.0.)
	// 	pyactr (latency_exponent): 1.0
	// 	vanilla (:le): 1.0
	LatencyExponent *float64

	// "retrieval_threshold": retrieval threshold (τ)
	// 	ccm (threshold): 0.0
	// 	pyactr (retrieval_threshold): 0.0
	// 	vanilla (:rt): 0.0
	RetrievalThreshold *float64
}

Jump to

Keyboard shortcuts

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