ACTRSimulators.ACTRScheduler
— TypeACTRScheduler <: AbstractScheduler
An ACT-R event scheduler object.
Fields
events
: a priority queue of eventstime
: current time of the systemrunning
: simulation can run if truemodel_trace
: will print out model events if truetask_trace
: will print out task events if truestore
: will store a vector of completed events if truecomplete_events
: an optional vector of completed events
ACTRSimulators.ACTRScheduler
— MethodACTRScheduler(;event=Event, time=0.0, running=true, model_trace=false, task_trace=false, store=false)
Constructor for Scheduler with default keyword values:
Keywords
event
: a function that is executed at the specified timetime
: the time at which the event will be executerunning
: whether the model is runningmodel_trace
: prints model trace if truetask_trace
: prints task trace if truestore
: stores the executed events for replay if set to true
ACTRSimulators.AbstractTask
— TypeAbstractTask
An abstract type for a task. A task requires the following fields:
visible
: shows GUI if truerealtime
: executes model in realtime if truespeed
: speed of realtime model executionscheduler
: a reference to the event scheduler
A task may optionally contain the following fields:
screen
: a vector of visual objects on the screencanvas
: a GUI object componentwindow
: a window for the GUI
Example
The following is an example of the task object for the PVT.
mutable struct PVT{T,W,C,F1,F2} <: AbstractTask
n_trials::Int
trial::Int
lb::Float64
ub::Float64
width::Float64
hight::Float64
scheduler::T
screen::Vector{VisualObject}
canvas::C
window::W
visible::Bool
realtime::Bool
speed::Float64
end
The constructor for PVT
is
function PVT(;
n_trials=10,
trial=1,
lb=2.0,
ub=10.0,
width=600.0,
height=600.0,
scheduler=nothing,
screen=Vector{VisualObject}(),
window=nothing,
canvas=nothing,
visible=false,
realtime=false,
speed=1.0,
)
visible ? ((canvas,window) = setup_window(width)) : nothing
visible ? Gtk.showall(window) : nothing
return PVT(n_trials, trial, lb, ub, width, height, scheduler, screen, canvas, window, visible,
realtime, speed)
end
function setup_window(width)
canvas = @GtkCanvas()
window = GtkWindow(canvas, "PVT", width, width)
Gtk.visible(window, true)
@guarded draw(canvas) do widget
ctx = getgc(canvas)
rectangle(ctx, 0.0, 0.0, width, width)
set_source_rgb(ctx, .8, .8, .8)
fill(ctx)
end
return canvas,window
end
ACTRSimulators.add_to_buffer!
— Methodadd_to_buffer!(mod::Mod, chunk)
Add chunk to buffer.
Arguments
mod
: a modulechunk
: a memory chunk
ACTRSimulators.add_to_visicon!
— Methodadd_to_visicon!(actr, vo; stuff=false)
Adds a visual object to the visicon. If stuff
is set to true, the visual object is added to the visual location buffer.
Arguments
actr
: an ACT-R model objectvo
: visual objectstuff
: buffer stuffing if true
ACTRSimulators.all_match
— Methodall_match(actr, conditions)
Checks whether all conditions of a production rule are satisfied.
Arguments
actr
: an ACT-R model objectconditions
: a tuple of functions representing production rule conditions.
ACTRSimulators.attend!
— Methodattend!(actr, chunk, args...; kwargs...)
Completes an attention shift by adding a chunk
to the visual buffer and setting states to busy = false and empty = false.
Arguments
actr
: an ACT-R model objectchunk
: a memory chunk
ACTRSimulators.attending!
— Methodattending!(actr, chunk, args...; kwargs...)
Sets visual module as busy and registers a new event to attend to a chunk
created by a visual object
Arguments
actr
: an ACT-R model objectchunk
: a memory chunk
ACTRSimulators.clear_buffer!
— Methodclear_buffer!(mod::Mod)
Removes chunk from buffer and sets buffer state to
empty
: truebusy
: falseerror
: false
Arguments
mod::Mod
: a module
ACTRSimulators.clear_visicon!
— Methodclear_visicon!(actr)
Clear all visual objects in visicon
ACTRSimulators.encode!
— Methodencode!(actr, chunk, args...; kwargs...)
Completes the creation of a chunk and adds resulting chunk
to the imaginal buffer. The buffer states are set to busy = false and empty = false.
Arguments
actr
: an ACT-R model objectchunk
: a memory chunk
ACTRSimulators.encoding!
— Methodencoding!(actr, chunk, args...; kwargs...)
Sets imaginal module as busy and registers a new event to create a new chunk
Arguments
actr
: an ACT-R model objectchunk
: a memory chunk
ACTRSimulators.fire!
— Methodfire!(actr)
Selects a production rule and registers conflict resolution and new events for selected production rule
Arguments
actr
: an ACT-R model object
ACTRSimulators.next_event!
— Methodnext_event!(s, actr, task)
Dequeue and process a single event.
Arguments
s
: an event scheduleractr
: an ACT-R model objecttask
: a task that is a subtype ofAbstractTask
ACTRSimulators.pause
— Methodpause(task, event)
Pauses simulation for specified speed
if realtime
in task
is true.
Arguments
task
: a task that is a subtype ofAbstractTask
event
: a task event or an internal event of the model
ACTRSimulators.remove_visual_object!
— Methodremove_visual_object!(actr::AbstractACTR, vo)
Removes object from visicon.
Arguments
actr
: an ACT-R model objectvo
: a visual object
ACTRSimulators.remove_visual_object!
— Methodremove_visual_object!(visicon, vo)
Removes object from visicon.
Arguments
visicon
: a vector of visual objectsvo
: a visual object
ACTRSimulators.respond!
— Methodrespond!(actr, task, key, args...; kwargs...)
Executes a motor response with user defined press_key!
function and sets module state to busy = false.
Arguments
actr
: an ACT-R model objecttask
: a task that is a subtype ofAbstractTask
key
: a string representing a response key
ACTRSimulators.responding!
— Methodresponding!(actr, task, key, args...; kwargs...)
Sets the declarative motor module as busy and registers a new event for executing a key stroke
Arguments
actr
: an ACT-R model objecttask
: a task that is a subtype ofAbstractTask
key
: a string representing a response key
ACTRSimulators.retrieve!
— Methodretrieve!(actr, chunk, args...; kwargs...)
Completes a memory retrieval by adding chunk to declarative memory buffer and setting busy = false and empty = false. Error is set to true if retrieval failure occurs.
Arguments
actr
: an ACT-R model objectrequest...
: a variable list of slot-value pairs
ACTRSimulators.retrieving!
— Methodretrieving!(actr, chunk, args...; kwargs...)
Sets the declarative memory module as busy and Submits a request for a chunk and registers a new event for the retrieval
Arguments
actr
: an ACT-R model objectrequest...
: a variable list of slot-value pairs
ACTRSimulators.start!
— Methodstart!(actr)
A function that initializes the simulation for the model.
Arguments
task
: a task that is a subtype ofAbstractTask
actr
: an ACT-R model object
ACTRSimulators.vo_to_chunk
— Functionvo_to_chunk(vo=VisualObject())
Arguments
Converts visible object to a chunk with color and text slots.
ACTRSimulators.vo_to_chunk
— Methodvo_to_chunk(actr, vo)
Converts visible object to a chunk with color and text slots, and sets time created to current time.
Arguments
actr
: an ACT-R model objectvo
: visual object
ACTRSimulators.why_not
— Methodwhy_not(actr, rule)
Prints each condition of a production rule and whether it matches the state of the architecture.
Arguments
actr
: an ACT-R model objectrule
: a production rule object
ACTRSimulators.why_not
— Methodwhy_not(actr)
Prints each condition of all production rules and whether the condition matche the state of the architecture.
Arguments
actr
: an ACT-R model object
DiscreteEventsLite.run!
— Functionrun!(actr, task::AbstractTask, until=Inf)
Simulate an ACT-R model
Arguments
models
: a dictionary of ACT-R model objectstask
: a task that is a subtype ofAbstractTask
until=Inf
: a specified termination time unless terminated sooner manually