CS300b – Agent Modeling
\[x_1 = x_1 + \gamma (x_2 - x_1)\] \[x_2 = x_2 + \gamma (x_1 - x_2)\]
Coding caveats:
\[color = \frac{x+1}{2} \times 9.9\]
Coding caveats:
to go
ask one-of-people [
let x1 opinion
let other-person one-of other people
...
let x2 [opinion] of other-person
if (abs (x1 - x2) < confidence-threshold) [
let x1-new (x1 + learning-rate * (x2 - x1))
let x2-new (x2 + learning-rate * (x1 - x2))
set opinion x1-new
ask other-person [ set opinion x2-new ]
]
]
update-colors
tick
end
Reporting number of cliques:
to-report num-cliques
let cliques 1
let d confidence-threshold
let min-value min [opinion] of people with [opinion] > (-1 + (d / 2))
while [any? people with
[opinion > (min-value + d) and opinion < (1 - (d / 2))]] [
set min-value min [opinion] of
(people with [opinion > (min-value + (d / 2))])
set cliques cliques + 1
]
report cliques
end
\[x_1 = \begin{cases} x_1 + \frac{\gamma}{2}(x_1 - x_2)(1 - x_1),\ if\ x_1 >x_2 \\ x_1 + \frac{\gamma}{2}(x_1 - x_2)(1 + x_1),\ otherwise \end{cases} \]
\[x_2 = \begin{cases} x_2 + \frac{\gamma}{2}(x_2 - x_1)(1 + x_2),\ if\ x_1 > x_2 \\ x_2 + \frac{\gamma}{2}(x_2 - x_1)(1 - x_2),\ otherwise \end{cases} \]
Fall 2024