(in-package "CL-USER") ;;;;!!!!!!!!!!!!!!!!!!!!!! ;;;; ;;;; DON'T FORGET TO: (1) DEFINE *DUAL-TASK* TO BE T BEFORE LOADING ALL MODELS. ;;;; (2) USE 4CAPS,LSP v1.2.3 (10) ;;;; (3) USE PARS.LSP v2.0.2 (c7) ;;;; (4) USE ROTATION.LSP V0.2.2 (6) ;;;; ;;;;!!!!!!!!!!!!!!!!!!!!!! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Name: dual task comprehension and rotation script ;;;; Version: 0.2.3 ;;;; Date: 10.2.2003 ;;;; ;;;; Author: Sashank Varma ;;;; Email: sashank@vanderbilt.edu ;;;; Organization: Center for Cognitive Brain Imaging (CCBI) ;;;; Carnegie Mellon University ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; History: ;;;; ;;;; 12.2.2002 sv: (v0.1.1) Initial version. ;;;; ;;;; 1.1.2003 sv: (v0.1.2): The Sentence Comprehension and Mental Rotation ;;;; Models now work together to simulate dual-task ;;;; performance. This required conceptually major, but ;;;; implementationally minor changes to the main Recognize- ;;;; Act loop of 4CAPS. These changes override the default ;;;; version. ;;;; ;;;; The Recognize-Act loop was overhauled because the two ;;;; model interact with it in incompatible ways, making it ;;;; difficult to run them simultaneously to simulate ;;;; dual-task performance. The Sentence Comprehension Model, ;;;; like READER and CC READER before it, is driven by the ;;;; immediacy assumption. When a word percept is registered, ;;;; the model executes until no productions match: until ;;;; quiescence. This is the trigger to extra-model support ;;;; code that the current percept has been completely ;;;; processed, and it is time for the next word percept. The ;;;; In contrast, the Mental Rotation Model is not driven by ;;;; the periodic injection of new representations from ;;;; outside the model (e.g., the visual system); it simply ;;;; runs until the task has been performed. You can see the ;;;; problem with running the two models simulatenously. The ;;;; Sentence Comprehension Model processes the first word ;;;; while the Mental Rotation Model solves the entire SM ;;;; problem. Because the Mental Rotation Model is engaged ;;;; the whole time, firing productions on each cycle, the ;;;; Sentence Comprehension model never "realizes" that the ;;;; current percept has been completely processed, and thus ;;;; doesn't fetch the next word percept until the Mental ;;;; Rotation Model completes the SM task. ;;;; ;;;; 4CAPS has been changed in three ways. ;;;; ;;;; First, a top-level command ADD-MODEL is now used to ;;;; define a "model". (There are associated commands for ;;;; deleting individual models, for printing all models, and ;;;; for clearing all defined models.) A model definition ;;;; includes: ;;;; (1) A "start-up" function run when the model begins ;;;; performing a task. It typically creates the task ;;;; goal and encodes the initial inputs. ;;;; (2) A "macrocycle" function run after each macrocycle. ;;;; In the case of the Sentence Comprehension Model, ;;;; this function checks whether it was dormant on the ;;;; previous macrocycle. If so, it fetches the next ;;;; word percept. ;;;; (3) A "summary" function for neatly displaying the ;;;; results of the model's performance. ;;;; (4) The set of dme classes that constitute the model's ;;;; representations. Knowing them enables 4CAPS to ;;;; determine if the model is active on a particular ;;;; cycle (i.e., because its representations were ;;;; involved in processing) or whether it was dormant. ;;;; ;;;; Second, a top-level command SIM has been created to ;;;; organize the simulation of one or, in dual-task scenario, ;;;; more than one model. It takes a set of arguments for ;;;; each of the models to be run -- these represent their ;;;; respective task inputs. It passes the arguments to the ;;;; start-up function of each model one, initializing their ;;;; respective declarative memories. It then runs the ;;;; models. The "macrocycle" function for each model is run ;;;; after each macrocycle, e.g., to fetch new word percepts ;;;; for the sentence comprehension model when the previous ;;;; model has been processed. ;;;; ;;;; Third, a top-level command SUMM has been created to ;;;; organize the printing of summary information for all ;;;; defined models following a simulation run. ;;;; ;;;; 10.2.2003 sv: (v0.1.3): Inserted commands to suppress warnings issued ;;;; when functions defined in the 4CAPS, Sentence ;;;; Comprehension Model, or Mental Rotation Model source ;;;; code are redefined here. ;;;; ;;;; Renamed the TOP-LEVEL-GOAL class to TASK-GOAL in all models that instantiate ;;;; the General Executive model. This affected the SOLVE-SM-PROBLEM-GOAL, ;;;; changing it to MR-TASK-GOAL. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Bugs: ;;;; ;;;; 1.1.2003 sv: (v0.1.2) Cycle counts different in single task versus ;;;; dual task modes. ;;;; ;;;; 10.2.2003 sv: (v0.1.3) SIM command does not work when given no ;;;; arguments. ;;;; ;;;; SUMM command doesn't work when the Sentence Comprehension ;;;; Model is defined but not loaded. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Modifications of and Extension to 4CAPS. ;;;; ;;;; NOTE: Will eventually be folded into the 4CAPS source code. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Defining models. ;;; ;; Global variables. (defparameter *models* '()) ;; Top-level commands. ; (clear-models) (defmacro clear-models () `(impl-clear-models)) (defun impl-clear-models () (setq *models* '()) (values)) ; (add-model model-name &key set-up-fn macrocycle-fn summ-fn dmes) (defmacro add-model (model-name &key set-up-fn macrocycle-fn summ-fn dmes) `(impl-add-model ',model-name ',set-up-fn ',macrocycle-fn ',summ-fn ',dmes)) (defun impl-add-model (model-name set-up-fn macrocycle-fn summ-fn dmes) (when (assoc model-name *models*) (impl-del-model model-name)) (push (list* model-name nil set-up-fn macrocycle-fn summ-fn dmes) *models*) (values)) ; (del-model model-name) (defmacro del-model (model-name) `(impl-del-model ',model-name)) (defun impl-del-model (model-name) (setq *models* (delete-if #'(lambda (model-packet) (eq (first model-packet) model-name)) *models*)) (values)) ;;; ;;; Modified recognize-act loop. ;;; ;; ;;; This function is defined in the 4CAPS interpreter. Explicitly undefine ;;; it so that when it is redefined in the dual-task environment to record ;;; the activity/dormancy of each model on each macrocycle, warnings are not ;;; issued to the user. (fmakunbound 'impl-run) (defun impl-run (mcycs) (when (pending-dm-actions-p) (match)) (let ((*running-p* t)) (do () ((or (zerop mcycs) (notany #'instantiations-p *centers*))) (incf *cycles*) (decf mcycs) (reset-trace) (map-centers #'fire) ;;^^ New. (record-dormancy) (match t) (print-traces) (mapc #'funcall *post-hook-fns*))) (values)) (defun record-dormancy () (dolist (model-packet *models*) (block done-p (dolist (dm-class (nthcdr 5 model-packet)) (when (or (member dm-class *modifies* :key #'type-of :test #'(lambda (dm-class cl) (subtypep cl dm-class))) (member dm-class *spews* :key #'(lambda (spew-packet) (type-of (car spew-packet))) :test #'(lambda (dm-class cl) (subtypep cl dm-class)))) (setf (second model-packet) t) (return-from done-p))) (setf (second model-packet) nil))) (values)) ;; (defun model-dormant-p (model-name) (and (not (zerop *cycles*)) (or (notany #'instantiations-p *centers*) (not (second (assoc model-name *models*)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Simulate and Summarize (Multiple) Models. ;;;; ;;;; NOTE: Possibly fold into the 4CAPS source code. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Simulation of multi-task performance. ;;; ;; (defparameter *mcyc-timeout* nil) ;; Top-level command to run simulations. ;;; Assume these top-level commands have been defined in specific model, such ;;; as the Sentence Comprehension Model. Explicitly undefine them so that ;;; when they are redefined to work properly in a dual-task environment, ;;; properly simulate all defined models, warnings are not issued to the user. (fmakunbound 'sim) (fmakunbound 'impl-sim) (defmacro sim (&rest models-args) `(impl-sim ',models-args)) (defun impl-sim (models-args) (reset) (dolist (model-args models-args) (let ((model-packet (assoc (first model-args) *models*))) (when model-packet (apply (third model-packet) (rest model-args))))) (do* ((models-response-list (mapcar #'(lambda (model-packet) (funcall (fourth model-packet))) *models*) (mapcar #'(lambda (model-packet) (funcall (fourth model-packet))) *models*)) (done-p (every #'identity models-response-list) (every #'identity models-response-list))) ((or done-p (and *mcyc-timeout* (> *cycles* *mcyc-timeout*)))) (run 1)) (values)) ;; Top-level command to summarize the results of running simulations. ;;; Assume these top-level commands have been defined in specific model, such ;;; as the Sentence Comprehension Model. Explicitly undefine them so that ;;; when they are redefined to work properly in a dual-task environment, ;;; properly simulate all defined models, warnings are not issued to the user. (fmakunbound 'summ) (fmakunbound 'impl-summ) (defmacro summ (&rest model-names) `(impl-summ ',model-names)) (defun impl-summ (model-names) (unless model-names (setq model-names (mapcar #'first *models*))) (dolist (model-name model-names) (let ((model-packet (assoc model-name *models*))) (when model-packet (format t "~&~%MODEL: ~A" model-name) (funcall (fifth model-packet))))) (values)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Define Models. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; ;;; ;; Clear all existing models. (clear-models) ;; Sentence Comprehension Model. (add-model sentence-comprehension :set-up-fn scm-set-up :macrocycle-fn scm-post-macrocycle-processing :summ-fn scm-summ :dmes (scm-dme)) ;; Mental Rotation Model. (add-model mental-rotation :set-up-fn mr-set-up :macrocycle-fn mr-post-macrocycle-processing :summ-fn mr-summ :dmes (mr-dme)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Sentence Comprehension Model. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Global Variables. ;;; ;; (defparameter *sentence* '()) (defparameter *segment* '()) (defparameter *segment-name* nil) (defparameter *word* nil) (defparameter *word-position* 0) (defparameter *word-mcyc* 0) (defparameter *word-mcyc-timeout* 25) ;;; ;;; Defining the Model. ;;; ;; (defun scm-set-up (&rest sent) (format t "~&Sentence Trial:~{ ~A~}" sent) (setq *sentence* sent) (setq *segment* '()) (setq *segment-name* nil) (setq *word* nil) (setq *word-position* 0) (spew t (clause :number 1) *weight*) (scm-next-word-set-up) (values)) ;; (defun scm-post-macrocycle-processing () (cond ((and (null *word*) (null *segment*) (null *sentence*)) t) ((or (model-dormant-p 'sentence-comprehension) (and *word-mcyc-timeout* (= *word-mcyc* *word-mcyc-timeout*))) (when (null *segment*) (end-segment *segment-name*) (unless (or (tracing-p) (tracing-dm-p)) (let ((segment (first *segment-history*))) (format t "~&~A~A~A~A~A" (shorten *segment-name*) #\tab (1+ (- (third segment) (second segment))) #\tab *cycles*)))) (cond ((or *segment* *sentence*) (scm-next-word-set-up) nil) (t #| ;; Only partially translated. Will need to confirm this code ;; is still used by the model and, if so, adapt it to the new ;; simulation scheme and incorporate the question in the input ;; along with the "sentence" words. (unless *suppress-unselected-trs* (when (or (tracing-p) (tracing-dm-p)) (print-scm-gap) (print-scm-separator) (format t "~& QUESTION ANSWERING") (print-scm-separator)) (spew t (integrate) *weight*) (run 25) (end-segment 'integrate) (unless (or (tracing-p) (tracing-dm-p)) (let ((segment (first *segment-history*))) (format t "~&INT~A~A" #\tab (1+ (- (third segment) (second segment))))))) |# (unless (or (tracing-p) (tracing-dm-p)) (format t "~&~A:~A~A~A~A" (shorten 'total) #\tab *cycles* #\tab *cycles*)) (setq *word* nil) t))) (t (when *word-mcyc-timeout* (incf *word-mcyc*)) nil))) (defun scm-next-word-set-up () (unless *segment* (let ((next-segment (pop *sentence*))) (setq *segment* (if (symbolp next-segment) (list next-segment) next-segment)) (setq *segment-name* (intern (format nil "~A~{-~A~}" (first *segment*) (rest *segment*)))))) (setq *word* (pop *segment*)) (when *word-mcyc-timeout* (setq *word-mcyc* 1)) (when (or (tracing-p) (tracing-dm-p)) (print-scm-gap) (print-scm-separator) (format t "~& WORD ~A: ~A" (1+ *word-position*) *word*) (print-scm-separator)) (spew t (percept :ortho *word* :start *word-position* :end (1+ *word-position*)) *weight*) (let ((cur-pos-dme (first (dme-list '(current-position))))) (if cur-pos-dme (modify cur-pos-dme :pos (1+ *word-position*)) (spew t (current-position :pos (1+ *word-position*)) *weight*))) (incf *word-position*) (values)) (defun print-scm-gap () (format t "~&~2%")) (defun print-scm-separator () (format t "~&################################################################################") (format t "~&################################################################################")) ;; Summarize the results of a simulation. (defun scm-summ () (format t "~&") ;(trees theta-role quantifier) #| ;; When simulating dual-task performance, it's better to have the model-specific ;; summary functions summarize task performance and let the DT-SUMM function ;; print center capacity utilizations. (history@ (associate structure rh-associate rh-structure rh-executive) :combination avg :measure prop) |# #| ;; Useful only when fitting the model to data. (history@ (associate lh-spatial lh-executive structure associational category visual) :measure act :time 1) (history@ (rh-associate rh-spatial rh-executive rh-structure rh-associational rh-category rh-visual) :measure act :time 1) |# (values)) ;;; ;;; Simulating a number of the sentences used in the studies of Just and ;;; Carpenter. ;;; ;; ;;; This batch simulation command is defined in the Sentence Comprehension ;;; Model. Explicitly undefine it so that when it is redefined in the ;;; dual-task environment to make use of the generalized SIM command and the ;;; model-specific SCM-SUMM command, warnings are not issued to the user. (fmakunbound 'jv2005) (defun jv2005 () (format t "ACTIVE") (sim (sentence-comprehension the senator attacked the (reporter period))) (format t "~%") (scm-summ) (format t "~2%PASSIVE") (sim (sentence-comprehension the senator was attacked by the (reporter period))) (format t "~%") (scm-summ) (format t "~2%DATIVE") (sim (sentence-comprehension the senator gave an interview to the (reporter period))) (format t "~%") (scm-summ) (format t "~2%PASSIVE DATIVE") (sim (sentence-comprehension the interview was given to the reporter by the (senator period))) (format t "~%") (scm-summ) (format t "~2%CLEFT-SUBJECT") (sim (sentence-comprehension it was the senator that attacked the (reporter period))) (format t "~%") (scm-summ) (format t "~2%CLEFT-OBJECT") (sim (sentence-comprehension it was the senator that the reporter (attacked period))) (format t "~%") (scm-summ) (format t "~2%RIGHT-BRANCHING SUBJECT-RELATIVE") (sim (sentence-comprehension the senator attacked the reporter that admitted the (error period))) (format t "~%") (scm-summ) (format t "~2%RIGHT-BRANCHING OBJECT-RELATIVE") (sim (sentence-comprehension the senator attacked the reporter that the editor (fingered period))) (format t "~%") (scm-summ) (format t "~2%CONJOINED ACTIVES") (sim (sentence-comprehension the senator attacked the reporter and admitted the (error period))) (format t "~%") (scm-summ) (format t "~2%SUBJECT-RELATIVE") (sim (sentence-comprehension the senator that attacked the reporter admitted the (error period))) (format t "~%") (scm-summ) (format t "~2%OBJECT-RELATIVE") (sim (sentence-comprehension the senator that the reporter attacked admitted the (error period))) (format t "~%") (scm-summ) (format t "~2%UNAMBIGUOUS PREFERRED") (sim (sentence-comprehension (the experienced soldiers) (spoke about the dangers) (before the midnight) (raid period))) (format t "~%") (scm-summ) (format t "~2%UNAMBIGUOUS UNPREFERRED") (sim (sentence-comprehension (the experienced soldiers) (who were told about the dangers) (conducted the midnight) (raid period))) (format t "~%") (scm-summ) (format t "~2%AMBIGUOUS PREFERRED") (sim (sentence-comprehension (the experienced soldiers) (warned about the dangers) (before the midnight) (raid period))) (format t "~%") (scm-summ) (format t "~2%AMBIGUOUS UNPREFERRED") (sim (sentence-comprehension (the experienced soldiers) (warned about the dangers) (conducted the midnight) (raid period))) (format t "~%") (scm-summ) (values)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Mental Rotation Model. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Defining the model. ;;; ;; ;;; Sets up a test trial where the right figure is a rotation of the left ;;; figure by ANGLE degrees, possibly mirror-imaged. Rotation is around the ;;; corner of the figure at the origin #(0 0 0). The left figure itself is a ;;; standard Shepard-Metzler shape. A terse description: ;;; ;;; Arm Starting Point Length Orientation (Ending Point) ;;; --- -------------- ------ ----------- -------------- ;;; 1 (0, 0, 0) 3 + Y axis (0, 3, 0) ;;; 2 (0, 3, 0) 4 - Z axis (0, 3, -4) ;;; 3 (0, 3, -4) 4 + X axis (4, 3, -4) ;;; 4 (4, 3, -4) 2 + Y axis (4, 5, -4) ;;; ;;; To get a feel for the left figure, draw it as a sequence of adjacent ;;; vectors in a three dimensional space. ;;; ;;; The left figure is then rotated by ANGLE degrees, and mirror-imaged ;;; depending on the value of MIRROR-P, to produce the right figure. The two ;;; figures are combined into the problem stimulus, the task-goal to solve the ;;; problem is activated, the goal corresponding to the first phase of mental ;;; rotation is activated, and the model run. ;;; ;;; NOTE: The term "arm" should be changed to "segment," or vice versa, to ;;; ensure consistent terminology throughout the model. (defun mr-set-up (&key (angle 40) mirror-p) (format t "~&Mental Rotation Trial: Rotation of ~A figure by ~A degrees." (if mirror-p "a mirror-image" "the same") angle) (format t "~%") (let* ((arm1-pos #(0 0 0)) (arm1-orient #(0 3 0)) (arm2-pos (add-vects arm1-pos arm1-orient)) (arm2-orient #(0 0 -4)) (arm3-pos (add-vects arm2-pos arm2-orient)) (arm3-orient #(4 0 0)) (arm4-pos (add-vects arm3-pos arm3-orient)) (arm4-orient #(0 2 0)) (arm5-pos #(0 0 0)) (arm5-orient (if (or (not mirror-p) (parallel-p arm1-orient arm3-orient)) (rotate-z arm1-orient angle) (flip-vector (rotate-z arm1-orient angle)))) (arm6-pos (add-vects arm5-pos arm5-orient)) (arm6-orient (rotate-z arm2-orient angle)) (arm7-pos (add-vects arm6-pos arm6-orient)) (arm7-orient (rotate-z arm3-orient angle)) (arm8-pos (add-vects arm7-pos arm7-orient)) (arm8-orient (if (or (not mirror-p) (parallel-p arm4-orient arm2-orient)) (rotate-z arm4-orient angle) (flip-vector (rotate-z arm4-orient angle))))) ;; Initialize left figure: | ;; - ;; / ;; | (let ((left-3d-model (first (spew t (3d-model :name 'left :components (list 'arm1 'arm2 'arm3 'arm4)) 1.0)))) (spew t (sm-figure :contents left-3d-model) 1.0)) (spew t (3d-model :name 'arm1) 1.0) (spew t (external-adjunct-relation :parent 'left :component 'arm1 :pos arm1-pos :orient arm1-orient) 1.0) (spew t (3d-model :name 'arm2) 1.0) (spew t (external-adjunct-relation :parent 'left :component 'arm2 :pos arm2-pos :orient arm2-orient) 1.0) (spew t (3d-model :name 'arm3) 1.0) (spew t (external-adjunct-relation :parent 'left :component 'arm3 :pos arm3-pos :orient arm3-orient) 1.0) (spew t (3d-model :name 'arm4) 1.0) (spew t (external-adjunct-relation :parent 'left :component 'arm4 :pos arm4-pos :orient arm4-orient) 1.0) ;; Initialize right figure: (let ((right-3d-model (first (spew t (3d-model :name 'right :components (list 'arm5 'arm6 'arm7 'arm8)) 1.0)))) (spew t (end-sm-figure :contents right-3d-model) 1.0)) (spew t (3d-model :name 'arm5) 1.0) (spew t (external-adjunct-relation :parent 'right :component 'arm5 :pos arm5-pos :orient arm5-orient) 1.0) (spew t (3d-model :name 'arm6) 1.0) (spew t (external-adjunct-relation :parent 'right :component 'arm6 :pos arm6-pos :orient arm6-orient) 1.0) (spew t (3d-model :name 'arm7) 1.0) (spew t (external-adjunct-relation :parent 'right :component 'arm7 :pos arm7-pos :orient arm7-orient) 1.0) (spew t (3d-model :name 'arm8) 1.0) (spew t (external-adjunct-relation :parent 'right :component 'arm8 :pos arm8-pos :orient arm8-orient) 1.0)) ;; Initialize the goals. (spew t (mr-task-goal) 1.0) (spew t (initial-search-goal) 1.0) (values)) ;; (defun mr-post-macrocycle-processing () (model-dormant-p 'mental-rotation)) ;; Summarize the results of a simulation. ;;; NOTE: Horrible hacky expression used to determine the model's decision ;;; about whether the problem was "same" or "mirror image". (defun mr-summ () (format t "~&Time: ~A" *cycles*) ;;^^ HACK!!! ;;^^ Also: Must fix bug for the 0 degrees rotation, same case. (ignore-errors (let ((right-orient (orient (find-if #'(lambda (dme) (and (eq (parent dme) 'right) (eq (component dme) 'arm8))) (dme-list '(adjunct-relation))))) (left-orient (orient (first (sort (dme-list '(rotate-component)) #'> :key #'id))))) (format t "~%Result: ~A" (if (=approx-vects right-orient left-orient) "Same" "Mirror Image")))) #| ;; When simulating dual-task performance, it's better to have the model-specific ;; summary functions summarize task performance and let the DT-SUMM function ;; print center capacity utilizations. (history@ (lh-executive rh-executive lh-spatial rh-spatial) :combination avg :measure prop) |# (values)) ;;; ;;; Simulating the results of the Carpenter et al. (1999) study. ;;; ;; ;;; This batch simulation command is defined in the Mental Rotation Model. ;;; Explicitly undefine it so that when it is redefined in the dual-task ;;; environment to make use of the generalized SIM command and the ;;; model-specific SCM-SUMM command, warnings are not issued to the user. (fmakunbound 'mr1999) (defun mr1999 () (format t "~&Simulation of the Carpenter et al. (1999) Mental Rotation study.~2%") (sim (mental-rotation :angle 0)) (mr-summ) (format t "~2%") (sim (mental-rotation :angle 40)) (mr-summ) (format t "~2%") (sim (mental-rotation :angle 80)) (mr-summ) (format t "~2%") (sim (mental-rotation :angle 120)) (mr-summ) #| (format t "~2%") (sim (mental-rotation :angle 0 :mirror-p t)) (mr-summ) (format t "~2%") (sim (mental-rotation :angle 40 :mirror-p t)) (mr-summ) (format t "~2%") (sim (mental-rotation :angle 80 :mirror-p t)) (mr-summ) (format t "~2%") (sim (mental-rotation :angle 120 :mirror-p t)) (mr-summ) |# (values)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; The Original Just et al. (2001) Dual-Task Study. ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; ;;; ;; Summarize the results of a simulation in a manner relevant for the ;; original Just et al. (2001) dual-task study. (defun dt-summ () (format t "~&") (history@ (associate structure lh-executive lh-spatial associational category visual) :combination avg :measure prop) (format t "~%") (history@ (rh-associate rh-structure rh-executive rh-spatial rh-associational rh-category rh-visual) :combination avg :measure prop) (values)) ;; Top-level command to simulate the original Just et al. (2001) dual-task ;; study. (def-lexeme died 3 v (tense past) (frame (agent))) (defun dt2001 (&optional (summ-p t)) (format t "~&") (when summ-p (format t "Simulation of the Just et al. (2001) Dual Task study.") (format t "~3%")) (format t "CAPACITIES") (format t "~2%CENTERS:~%") (caps) (format t "~2%MACROCENTERS:") (macro-caps) (format t "~%") (cond (summ-p (format t "~2%EASY SENTENCE TASK~2%") (sim (sentence-comprehension senator that attacked reporter (died period))) (summ) (dt-summ) (format t "~3%EASY ROTATION TASK~2%") (sim (mental-rotation :angle 40)) (summ) (dt-summ) (format t "~3%EASY DUAL-TASK~2%") (sim (mental-rotation :angle 40) (sentence-comprehension senator that attacked reporter (died period))) (summ) (dt-summ)) (t (let ((sink (make-broadcast-stream))) (let ((*standard-output* sink)) (sim (sentence-comprehension senator that attacked reporter (died period)))) (dt-summ) (let ((*standard-output* sink)) (sim (mental-rotation :angle 40))) (dt-summ) (let ((*standard-output* sink)) (sim (mental-rotation :angle 40) (sentence-comprehension senator that attacked reporter (died period)))) (dt-summ)))) (values)) ;; (set-caps@ (associate rh-associate structure rh-structure lh-spatial rh-spatial lh-executive rh-executive) 100.0) #| (dt2001) |#