The builder package provides some additional functionality to help building new tasks. Alternatively, you can copy-paste and edit existing task files for your own experiment.
Quick Start
There are two ways to work with GEMS 1.2 and later. The first is a similar process to that used previously in GEMS 1.1, where all tasks/experiments are run within one directory and files/definitions are updated when required. The second uses two new functions to reproduce the same files but within a new directory.
Interactive, single-directory workflow
As GEMS 1.1:
-
(require :gems)
-
set
*default-pathname-defaults*
-
(gems:init-gems …)
-
load and evaluate "interpret-temp.lisp"
-
load and evaluate "timeline-temp.lisp"
-
call
gems:launch
File-based, multiple-directory workflow
To begin a new task, start SBCL and run the following:
* (require :asdf) * (require :gems) * (gems:new-task "taskname")
This creates a new directory called "taskname" and populate it with some initial files:
-
operators
is a directory containing the different operators -
protocol.txt
is a file containing a template for the experiment protocol
Edit the file "protocol.txt" and the contents of "operators" (e.g. copy in a file of input-output operators) to fit your specific task requirements.
Use build-experiment
to create a file for your current simulation experiment.
* (gems:build-experiment "experiment.lisp" :task-directory "taskname")
This creates a file called "experiment.lisp" with definitions for the operators, functions to call the gp code, and some templates to complete.
Edit the file "experiment.lisp" to complete the run-experiment
and
evaluate-fitness
functions. Complete the run-simulation
function, or
replace it, as required.
To run your experiment, all you need is this file: load the file
and call (run-simulation)
.
You can create multiple simulations in one task directory.
Model Architecture
(defstruct model
"Defines the state of a model and its interactions with the environment"
clock ; core model
current
stm
(attFocus 'centre) ;; focus of attention; default is centre
salient ;; salient is what is salient in the visual field.
response
inputs ;; buffers for inputs
_screenLeft
_screenCentre
_screenRight
( _inputName "_")
( _type 'stimulus)
)
Operators
These operators are described based on their filename. Each operator falls into one of a fixed range of timing groups: input (100ms), output (140ms), cognitive (70ms), STM (50ms) and syntax (0ms).
Name | Function | Group (time) |
---|---|---|
if |
interpret 1st expression. if 'model-current' is true (not 0) then interpret 2nd expression, otherwise interpret 3rd expression |
syntax (0ms) |
nil |
set 'model-current' to 0 |
syntax (0ms) |
prog2 |
interpret expressions sequentially |
syntax (0 ms) |
Name | Function | Group (time) |
---|---|---|
dotimes-2 |
repeats the given expression twice |
syntax (0ms) |
dotimes-3 |
repeats the given expression thrice |
syntax (0ms) |
dotimes-5 |
repeats the given expression five times |
syntax (0ms) |
while-50 |
repeats the given expression until clock advances 50ms |
syntax (0ms) |
while-200 |
repeats the given expression until clock advances 100ms |
syntax (0ms) |
while-100 |
repeats the given expression until clock advances 200ms |
syntax (0ms) |
Name | Function | Group (time) |
---|---|---|
attend |
set 'model-current' to value of 'model-salient' |
cognitive (70ms) |
move-att-center |
set 'model-attFocus' to "centre" |
cognitive (70ms) |
move-att-left |
set 'model-attFocus' to "left" |
cognitive (70ms) |
move-att-right |
set 'model-attFocus' to "right" |
cognitive (70ms) |
compare-current-stm-1 |
when 'model-current' = first of 'model-stm' then set 'model-response' to first item in 'model-attFocus' |
cognitive (70ms) |
Name | Function | Group (time) |
---|---|---|
prog3 |
interpret expressions sequentially |
syntax (0 ms) |
prog4 |
interpret expressions sequentially |
syntax (0 ms) |
Name | Function | Group (time) |
---|---|---|
put-stm |
add 'model-current' to beginning of STM (push out oldest item if full) |
stm (50 ms) |
Name | Function | Group (time) |
---|---|---|
wait-25 |
advances the model clock by 25ms |
25ms |
wait-50 |
advances the model clock by 50ms |
50ms |
wait-100 |
advances the model clock by 100ms |
100ms |
wait-200 |
advances the model clock by 200ms |
200ms |
wait-1000 |
advances the model clock by 1000ms |
1000ms |
wait-1500 |
advances the model clock by 1500ms |
1500ms |
Protocol
Used with "detect-main". "detect-main" is a function which determines the current left/right/centre inputs for the model based on the current experiment timeline.
The timeline is created from the protocol file, which has three components:
- start-answer-time
-
a number, giving the time from which the model is permitted to answer
- end-answer-time
-
a number, giving the time from which the model is no longer permitted to answer
- stimuli-events
-
list of time:events
Example for simple-reaction-time: the model can answer between times 100ms and 1000ms, and the stimulus is visible in the centre from time 100ms to 1000ms.
100 ;; *start-answer-time* 1000 ;; *end-answer-time* ( 0 "blank" 100 "stim1" "centre" 1000 "end" )
Example for dmts: the model can answer between times 1500ms and 3500ms. The target (stim1) is visible in the centre from the start to time 1000ms, then no inputs are visible, and then from 1500 to 3500ms the left/right inputs hold stim2 and stim3 respectively.
1500 ;; *start-answer-time* 3500 ;; *end-answer-time* ( 0 "stim1" "centre" 1000 "blank" 1500 "stim2" "left" "stim3" "right" 3500 "end" )