Commit 893c44c9 authored by root's avatar root

Fixed a few bugs for while working on model for IEEE paper (mostly in SEEKING...

Fixed a few bugs for while working on model for IEEE paper (mostly in SEEKING system) and got rid of annoying bug where A-A module printed out struct at .01s in model run
parent b326df1e
This diff is collapsed.
......@@ -30,7 +30,7 @@
(defvar *START-TIME* (write-to-string (get-internal-real-time)))
(defun add-aa-to-chunks ()
;(defun add-aa-to-chunks ()
(suppress-extension-warnings)
(extend-chunks fValue :default-value 0 :merge-function merge-chunks-fValue)
(extend-chunks fFunction :default-value nil :merge-function merge-chunks-fFunction)
......@@ -41,9 +41,9 @@
(extend-productions sValue :default-value 0)
(extend-productions fFunction :default-value nil)
(extend-productions fValue :default-value 0)
(unsuppress-extension-warnings))
(unsuppress-extension-warnings)
(add-aa-to-chunks)
;(add-aa-to-chunks)
;;Set of functions used when chunks are merged that make sure the correct
(defun merge-chunks-fValue (c1 c2)
(/ (+ (chunk-fValue c1) (chunk-fValue c2)) 2))
......@@ -945,7 +945,8 @@
(setf (AA-dm-SEEKING-hash AA) (make-hash-table))
(setf (AA-vis-SEEKING-hash AA) (make-hash-table))
(setf (AA-aur-SEEKING-hash AA) (make-hash-table))
(schedule-event 0.001 'schedule-AA-events :params (list AA) :priority :max :module 'Affective-Associations :maintenance t))
(schedule-event 0.001 'schedule-AA-events :params (list AA) :priority :max :module 'Affective-Associations :maintenance t)
nil)
(defun AA-module-query (AA buff slot val)
(case slot
......
......@@ -344,7 +344,16 @@ t)
(solverOutputFile (concatenate 'string *HumModDir* "SolverOut" (phys-module-pipeID phys)))
(init-vals-msg "\"<solverin>")
ordered-val-list
old-dir
ics-val-list)
(setf old-dir
#+:ccl (ccl::current-directory-name)
#+:sbcl (sb-posix:getcwd)
)
#+:ccl (ccl::cwd *HumModDir*)
#+:ccl (ccl::cwd "../")
#+:sbcl (sb-posix:chdir *HumModDir*)
#+:sbcl (sb-posix:chdir "../")
(setf ics-val-list (s-xml:parse-xml-file init-filename))
(setf init-vals-msg (concatenate 'string init-vals-msg (list #\newline) "<sending_current_values>" (list #\newline)))
......@@ -390,7 +399,9 @@ t)
(while (and (not (probe-file solverOutputFile))
(< (- (get-universal-time) currTime) 55))))
(while (and (probe-file solverOutputFile) (not (handler-case (delete-file solverOutputFile)
(error () nil)))))|#))
(error () nil)))))|#
#+:ccl (ccl::cwd old-dir)
#+:sbcl (sb-posix:chdir old-dir)))
;;Generate hash-table of physiological variables & Hash-Table of the order of the variables
;; and default values
......
......@@ -75,21 +75,21 @@
(eq checkOsmoVal-base nil) (eq (cadar checkOsmoVal-base) nil)) 0
(read-from-string (cadar checkOsmoVal-base))))
(tVal nil)
(subjMult (SEEKING-subj-thirst SEEKING))
(tMult (if (SEEKING-thirst-multiplier SEEKING) (SEEKING-thirst-multiplier SEEKING) 1))
(max-reward (if (SEEKING-max-seeking-val SEEKING) (SEEKING-max-seeking-val SEEKING) 1))
(noise-val (if (SEEKING-hom-noise SEEKING) (act-r-noise (* (SEEKING-hom-noise SEEKING) max-reward)) 0)))
(subjMult (SEEKING-subj-thirst S))
(tMult (if (SEEKING-thirst-multiplier S) (SEEKING-thirst-multiplier S) 1))
(max-reward (if (SEEKING-max-seeking-val S) (SEEKING-max-seeking-val S) 1))
(noise-val (if (SEEKING-hom-noise S) (act-r-noise (* (SEEKING-hom-noise S) max-reward)) 0)))
(declare (ignore tMult))
(declare (ignore subjMult))
;(print checkOsmoVal)
(if (> osmoVal (SEEKING-thirst-max SEEKING))
(if (> osmoVal (SEEKING-thirst-max S))
(setf tVal 1)
(if (< osmoVal (SEEKING-thirst-min SEEKING))
(if (< osmoVal (SEEKING-thirst-min S))
(setf tVal -1)
(if (<= osmoVal base-osmoVal)
(setf tVal (/ (- osmoVal base-osmoVal) (- base-osmoVal (SEEKING-thirst-min SEEKING))))
(setf tVal (/ (- osmoVal base-osmoVal) (- (SEEKING-thirst-max SEEKING) base-osmoVal))))))
(setf tVal (/ (- osmoVal base-osmoVal) (- base-osmoVal (SEEKING-thirst-min S))))
(setf tVal (/ (- osmoVal base-osmoVal) (- (SEEKING-thirst-max S) base-osmoVal))))))
;(print (list base-osmoVal osmoVal (* subjMult tVal)))
;;Could use log-type curve to convert tVal to thirst, however I will just make a linear conversion w/ added noise for now
......@@ -104,9 +104,9 @@
(setf tVal (exp (* (- tval 1) max-reward)))
(when (> tVal max-reward) (setf tVal max-reward))
(when (< tVal (SEEKING-max-neg-incentive SEEKING)) (setf tVal (SEEKING-max-neg-incentive SEEKING)))
(when (< tVal (SEEKING-max-neg-incentive S)) (setf tVal (SEEKING-max-neg-incentive S)))
(setf (gethash 'thirstVal (SEEKING-S-vals SEEKING)) tVal)
(setf (gethash 'thirstVal (SEEKING-S-vals S)) tVal)
tVal
)))
......@@ -411,4 +411,3 @@
:request 'SEEKING-requests
:params 'SEEKING-params
:query 'SEEKING-query)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment