Java Agent Based Modeling Systems and Clojure

418 views
Skip to first unread message

Fred Concklin

unread,
Feb 17, 2011, 12:46:37 AM2/17/11
to clo...@googlegroups.com
Hi,

I've been surveying some agent based modeling systems for use in a
project I am doing in clojure. I've narrowed down the list to those
below. I am wondering if anybody here has experience with these or has
any thoughts about choosing one over the other for use with clojure. I
will probably write a clojure wrapper for the abms I end up using.

list (bare)

* mason
* jaslibrary
* netlogo
* repast
* swarm

list (w/ tags, links, annotations)

*** agent based libraries java
**** mason :java:fast:small:
***** models independent from visualization
***** models self contained / run inside other frameworks + apps
**** jaslibrary [[http://jaslibrary.sourceforge.net/]] :java:
***** seems old (last update 2006)
**** netlogo [[http://ccl.northwestern.edu/netlogo/resources.shtml]] :java:scala:good:
***** good community
**** repast [[http://repast.sourceforge.net/docs.html]] :java:
***** clusters
***** java api [[http://repast.sourceforge.net/docs/api/repastjava/index.html]]
**** swarm :java:
***** obj.c > java :support:
***** good community


list of libs
[[http://www.swarm.org/index.php/Tools_for_Agent-Based_Modelling]]

cheers,

fpc

ky...@brandeis.edu

unread,
Feb 17, 2011, 7:59:34 AM2/17/11
to Clojure
Hi Fred,

I've just finished prototyping clj-breve (http://spiderland.org/)
everything works but the integration isn't as elegant as I would like,
hence why I haven't released it yet. The current paradigm for using
clj-breve is to develop models in Clojure then export to breve. More
details when I post this later in the Spring.

Best,
Kyle

Stuart Sierra

unread,
Feb 18, 2011, 12:23:12 PM2/18/11
to clo...@googlegroups.com
I don't know much about Agent-Based Modeling, but is it possible you could use Clojure's built-in features, like Agents and Refs, for your application?  The old "ants" demo in Clojure is a simple agent-based simulation.

-Stuart Sierra

bOR_

unread,
Feb 23, 2011, 4:31:32 AM2/23/11
to clo...@googlegroups.com
I've been programming agent-based models in clojure for the last 2 years, and I've found that having a vector full of refs works fine. If two individuals interact (in my case, form a relationship), I use dosync and alter in a parallel environment to ensure that noone is starting more relationships than they have capacity for).

(def world (vec (map (fn [pos] (ref (create-host (- (rand-int (* timespan 365)) (* maximum-age 365)) pos))) (range fullpopsize)))))

(defn pair-hosts [h1 h2]
      (dosync 
         (let [keep-till (+ @day (exp-decay (table-relation reltype)))]
           (alter h1 assoc :relas (vec (conj (:relas @h1) (struct relation (:id @h2) reltype @day keep-till))))
           (alter h2 assoc :relas (vec (conj (:relas @h2) (struct relation (:id @h1) reltype @day keep-till))))
           (vector h1 h2))))))


Mars0i

unread,
Jan 28, 2015, 1:02:31 PM1/28/15
to clo...@googlegroups.com
Fred,

This is an old thread, but did you end up using Repast, Mason, or another Java library with Clojure?  I've been doing agent-based modeling in NetLogo and pure Clojure separately, but would be interested in exploring a more integrated approach. 

I have written a proof-of-concept NetLogo extension that allows calling Clojure from NetLogo, and may develop it further for a specific set of models.  However: Despite the fact that I think NetLogo is a great programming environment for certain kinds of modeling, I don't think that NetLogo integration with Clojure will ever by a good general strategy.  NetLogo is too much of a standalone tool. 

A better strategy, off the top of my head, would be using Clojure with one of the Java-based ABM libraries, such as the others you listed.  My guess is that some of them are easier to integrate with Clojure than others.  (I would say that some Java libraries require more Javafication in your Clojure code than others do.)

Anyone else using Clojure with one of an ABM library?

Thanks.
Reply all
Reply to author
Forward
0 new messages