runner

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentSpec

type AgentSpec struct {
	Uuid        uuid.UUID                           `json:"uuid"`
	Actions     map[b.SimTime]uuid.UUID             `json:"actions"`
	Activations map[b.SimTime]map[uuid.UUID]float64 `json:"activations"`
	Deltas      map[uuid.UUID]float64               `json:"deltas"`
	Friends     map[uuid.UUID]float64               `json:"friends"`
}

func NewAgentSpecFromAgent

func NewAgentSpecFromAgent(a *b.Agent) (spec *AgentSpec)

func (*AgentSpec) LinkFriends

func (spec *AgentSpec) LinkFriends(agents map[uuid.UUID]*b.Agent)

func (*AgentSpec) ToAgent

func (spec *AgentSpec) ToAgent(
	behaviours []*b.Behaviour,
	beliefs []*b.Belief,
) *b.Agent

type BehaviourSpec

type BehaviourSpec struct {
	Name string    `json:"name"`
	Uuid uuid.UUID `json:"uuid"`
}

func (*BehaviourSpec) ToBehaviour

func (spec *BehaviourSpec) ToBehaviour() *b.Behaviour

type BeliefSpec

type BeliefSpec struct {
	Name          string                `json:"name"`
	Uuid          uuid.UUID             `json:"uuid"`
	Perceptions   map[uuid.UUID]float64 `json:"perceptions"`
	Relationships map[uuid.UUID]float64 `json:"relationships"`
}

func (*BeliefSpec) LinkBeliefRelationships

func (spec *BeliefSpec) LinkBeliefRelationships(beliefs []*b.Belief)

func (*BeliefSpec) ToBelief

func (spec *BeliefSpec) ToBelief(behaviours []*b.Behaviour) *b.Belief

type Configuration

type Configuration struct {
	// The behaviours in the simulation.
	Behaviours []*b.Behaviour
	// The beliefs in the simulation.
	Beliefs []*b.Belief
	// The agents in the simulation.
	Agents []*b.Agent
	// The PerformanceRelationships in the simulation.
	Prs PerformanceRelationships
	// The start time of the simulation.
	StartTime b.SimTime
	// The end time of the simulation (inclusive).
	EndTime b.SimTime
	// The output file.
	OutputFile *os.File
	// Whether to serialize the full state of agents, or just summary stats.
	FullOutput bool
}

Configuration defines the configuration of the simulation.

type OutputSpec

type OutputSpec struct {
	MeanActivation         map[uuid.UUID]float64 `json:"meanActivation"`
	SDActivation           map[uuid.UUID]float64 `json:"sdActivation"`
	MedianActivation       map[uuid.UUID]float64 `json:"medianActivation"`
	NonzeroActivationCount map[uuid.UUID]uint64  `json:"nonzeroActivationCount"`
	NPerformers            map[uuid.UUID]uint64  `json:"nPerformers"`
}

func NewOutputSpec

func NewOutputSpec() *OutputSpec

type OutputSpecs

type OutputSpecs struct {
	Data map[b.SimTime]OutputSpec `json:"data"`
}

func NewOutputSpecs

func NewOutputSpecs(
	agents []*b.Agent,
	beliefs []*b.Belief,
	startTime b.SimTime,
	endTime b.SimTime,
) *OutputSpecs

type PerformanceRelationshipSpec

type PerformanceRelationshipSpec struct {
	BehaviourUuid uuid.UUID `json:"behaviourUuid"`
	BeliefUuid    uuid.UUID `json:"beliefUuid"`
	Value         float64   `json:"value"`
}

type PerformanceRelationships

type PerformanceRelationships map[*b.Belief]map[*b.Behaviour]float64

PerformanceRelationships defines the relationship which defines how holding a belief affects the probability of performing a behaviour.

The value should be in the range [-1,+1]

func PRSSpecToPerformanceRelationships

func PRSSpecToPerformanceRelationships(
	prss []PerformanceRelationshipSpec,
	beliefs map[uuid.UUID]*b.Belief,
	behaviours map[uuid.UUID]*b.Behaviour,
) PerformanceRelationships

PRSSpecToPerformanceRelationships converts a slice of PerformanceRelationshipSpecs (i.e., what was read from JSON) to PerformanceRelationships.

This takes the Beliefs (using a map from their UUID to the object) and Behaviours (using a map from their UUID to the object).

type Runner

type Runner struct {
	// The configuration.
	Configuration *Configuration
	// The logger.
	Logger *zap.Logger
}

Runner defines the runner of the simulation.

func (*Runner) Run

func (r *Runner) Run()

Run the simulation.

Jump to

Keyboard shortcuts

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