Hi all.
First. For those who remember, I posted an individual-based model in
this group some time ago (eden.clj), and got some very helpful replies
on where I misunderstood clojure and did things the hard way. I wanted
to report that that model by now is written purely as nonblocking
agents, and is happily burning cpu cycles as it simulates the
evolution of our immune system :). thanks for that!
Second. I am updating an older model on Chlamydia prevalence in a
dynamic sexual contact network, and implemented it in clojure (http://
clojure.googlegroups.com/web/chlam-clean.clj), based on the model in
this paper (
http://aje.oxfordjournals.org/cgi/content/abstract/
144/3/306). It isn't fully equivalent to the model in the paper yet
(for some reason, Chlamydia keeps going extinct), but that is
something I will puzzle over myself. I am however, still somewhat
fuzzy on what a good way is to get the model concurrent.
I tried replacing
(doseq [e [retire-host slowdown-host infect-hosts naturalrecovery-host
pair-host breakup-host] i world]
(e i))))
with
(doseq [e [retire-host slowdown-host infect-hosts naturalrecovery-host
pair-host breakup-host] i world]
(send-off (agent i) e)))
or
(doseq [e [retire-host slowdown-host infect-hosts naturalrecovery-
host pair-host breakup-host] i world]
(send-off (agent nil) (fn [_] (e i))))))
There doesn't seem to be any concurrency happening, and the whole
thing just slows down to not doing much at all. Anyone knows what I am
doing wrong?. Considering that I wrestled with this before in previous
posts in this group, I offer my apologies for not getting the correct
way of mixing agents and refs into my thick skull. (Luckily I have
grasped agents-only models, so there is hope :), but as I need refs in
this model, I'm again banging my head against the wall).