This page was automatically generated by NetLogo 5.0.5.
The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.
In order for this to work, this file, your model file (Supplementary_1._Sub_Thresholds.nlogo), and the files NetLogoLite.jar and NetLogoLite.jar.pack.gz must all be in the same directory. (You can copy NetLogoLite.jar and NetLogoLite.jar.pack.gz from the directory where you installed NetLogo.)
On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.
You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.
If the NetLogoLite files and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of the NetLogoLite files in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your users.)
powered by NetLogo
view/download model file: Supplementary_1._Sub_Thresholds.nlogo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; AGENT_ZERO ;; Supplementary Applet 1. Sub_Thresholds. ;; Corresponds to Supplementary Discussion 1 on the Website: ;; ;; A Road Not Taken ;; ;; ;; Version 1.0 ;; ;; Joshua M. Epstein ;; December 2013 ;; ;; Sliders [70, 0, 4, 0, 1] Seed 1 ;; ;; Note: Decomposes Tau into Tau_V + Tau_P. ;; Expresses Action condition as D = (V-Tau_V) + (P-Tau_P) > 0. ;; Action is exactly as in single Tau formulation. ;; But net_V and net_P can now disagree in sign. ;; Code given is overpowered for demo. Main changes are turtles-own ;; declaration with two thresholds, and update-disposition code. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to use-new-seed let my-seed new-seed output-print word "Generated seed: " my-seed random-seed my-seed end to use-seed-from-user let my-seed read-from-string user-input "Enter a random seed (an integer):" output-print word "User-entered seed: " my-seed random-seed my-seed end turtles-own [ affect learning_rate lambda delta age v_threshold p_threshold event_count disposition probability memory ] to setup __clear-all-and-reset-ticks ;use-new-seed use-seed-from-user setup-patches setup-turtles ; movie-start "out.mov" ; movie-grab-view ; repeat 135 ; [ go ; movie-grab-view ] ; movie-close tick end to setup-turtles set-default-shape turtles "person" create-turtles 1 ask turtle 0 [ setxy 9 9 set color blue set age random 20 set affect 0.001 set delta 0 set lambda 1 set learning_rate .1 set v_threshold 0.25 set p_threshold 0.75 set event_count 0 set disposition 0 set probability 0 set memory [] repeat memory_length [set memory lput random-float 0 memory] ;set memory [0] ;set memory [0 0 0 0] ;set label who ] end to setup-patches ask patches [set pcolor yellow + random 2] end to go if ticks >= 50000 [stop] activate-patches update-affect update-probability update-disposition ; take-action deactivate-patches do-plots1 do-plots2 do-plots3 ; print ticks tick end to update-affect ask turtles [ if pcolor = orange + 1 [set affect affect + (learning_rate * (affect ^ delta) * (lambda - affect))] if pcolor != orange + 1 [set affect affect + (learning_rate * (affect ^ delta) * extinction_rate *(0 - affect))] ] end to update-probability ask turtles[ let current_probability (count patches in-radius vision with [pcolor = orange + 1]/(count patches in-radius vision)) set memory but-first memory set memory lput current_probability memory set probability mean memory ;set probability median memory ] end to update-disposition ask turtle 0 [ set disposition affect - v_threshold + probability - p_threshold] end to move-turtles ask turtles [ right random 360 forward 1 ] end to take-action ask turtles [ if disposition > 0 [ask patches in-radius action_radius [set pcolor red - 3]] ] end to activate-patches ask patches with [pycor > 0] [if random 1000 < attack_rate and pcolor != red - 3 [set pcolor orange + 1]] end to deactivate-patches ask patches with [ pycor > 0] [if random 100 < 8 and pcolor != red - 3 [set pcolor yellow + random 2]] end to do-plots1 set-current-plot "Disposition" set-current-plot-pen "turtle 0" plot [disposition] of turtle 0 end to do-plots2 set-current-plot "Net Probability" set-current-plot-pen "turtle 0" plot [probability - p_threshold] of turtle 0 end to do-plots3 set-current-plot "Net Affect" set-current-plot-pen "turtle 0" plot [affect - v_threshold] of turtle 0 end