This page was automatically generated by NetLogo 4.1. Questions, problems? Contact firstname.lastname@example.org.
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 Sun's Java site. If the display appear cut off with Firefox, then try another browser (Safari works).
powered by NetLogo
view/download model file: TaskAssignment.nlogo
This model demonstrates the use of a Hopfield network to perform the Task Assignment Problem. See Flake (1998, ch. 18). Unfortunately, no further documentation is available at this time.
This section will give a general understanding of what the model is trying to show or explain.
This section will explain what rules the agents use to create the overall behavior of the model.
This section will explain how to use the model, including a description of each of the items in the interface tab.
This section will give some ideas of things for the user to notice while running the model.
This section will give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
This section will give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
This section will point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.
This section will give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
This model is a reimplementation of the Task Assignment Hopfield Network in Flake, G. (1998), The Computational Beauty of Nature. Implemented by B. J. MacLennan, Sept. 30, 2008.
To refer to this model in academic publications, please use: MacLennan, B.J. (2008). NetLogo TaskAssignment model. http://www.cs.utk.edu/~mclennan. Dept. of Electrical Engineering & Computer Science, Univ. of Tennessee, Knoxville.
set width world-width
set height world-height
set num-cells width * height
set weight-array n-values num-cells [ weight-row ? ]
set gain 0.5
set scale 0.5
[ 10 5 4 6 5 1
6 4 9 7 3 2
1 8 3 6 4 6
5 3 7 2 1 4
3 2 5 6 8 7
7 6 4 1 3 2 ]
set bias-vector compute-bias-vector test-data
ask patches [
set plabel-color green
set plabel item (cell-num pxcor pycor) test-data
to-report compute-bias-vector [data]
let min-cost min data
let max-cost max data
let avg-cost mean data
report map [ scale * (? - avg-cost) / (max-cost - min-cost) + 2 ] data
to-report weight-row [i]
report n-values num-cells [ ifelse-value (i = ?)  [ weight-val i ? ] ]
to-report weight-val [i j]
let ix floor (i / height)
let iy i mod height
let jx floor (j / height)
let jy j mod height
ifelse ix = jx or iy = jy
[ report -2 ]
[ report 0 ]
ask patches [
set new-state -0.1 + random-float 0.2
ask patches [ compute-patch-state ]
ask patches [ update-patch-state ]
let index cell-num pxcor pycor
set local-field sum map [ (weight-value index ?) * cell ? ] n-values num-cells [?]
set new-state state + delta-t * (local-field + (item index bias-vector) - state / tau)
set state new-state
set activity sigmoid state
set pcolor scale-color red activity 1.0 0.0
to-report sigmoid [x]
report 1 / (1 + exp (- gain * x))
to-report cell [p]
report [activity] of patch (floor (p / height)) (p mod height)
to-report cell-num [x y]
report x * height + y
to-report weight-value [p q]
report item q (item p weight-array)
set-current-plot "Average Cell Energy"
plot (- sum [ state * local-field ] of patches / (num-cells ^ 2))
let activities n-values num-cells [ cell ? ]
set est-cost sum (map [?1 * threshold 0.9 ?2] test-data activities) ; / (sum activities)
set-current-plot "Estimated Rate"
to-report threshold [theta x]
report ifelse-value (x < theta)  [x]