Showing posts with label netlogo. Show all posts
Showing posts with label netlogo. Show all posts

Saturday, August 02, 2025

NLRX tricks

 I just realized that it is possible to combine `runtime` and `stopcond` options to accommodate the situation that most NetLogo simulation runs can reach equilibrium but some cannot. In my case, I used the following code:

runtime = 300,

stopcond = "all? turtles [happy?]",

With amazing results. 

Thursday, February 01, 2024

ABM using Julia

Just spent some time with Agents.jl, then I discovered EasyABM.jl, which looks and works more like NetLogo. 

Wednesday, April 27, 2022

Processing the sugar map

 Different implementations of the Sugarscpe agent-based model have different ways to get up the sugar map. SugarscapeCW used a built-in matrix (no space between each number) whereas the NetLogo model library uses an external text file with a blank space between each number. 

The easy way to translate between these two different format is to use the readr R package, something like this:

library(readr)

sugar_map1 <- read_fwf("~/tmp/sugar-map1.txt", fwf_widths(c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), col_names = NULL))

write_delim(sugar_map1, "~/tmp/sugar-map-out.txt", delim = " ", col_names = FALSE)

Tuesday, April 06, 2021

NetLogo code for Party Competition

 Today I spent some time to manually convert the NetLogo code for Party Competition from version 5 to version 6. 

Fascinating book, by the way. 

Sunday, October 11, 2020

Reading map files into NetLogo

 I am trying to read the map files provided by the coronavirus-data into NetLogo using the following code: 

extensions [gis]

globals [zip-data projection]

to setup

  clear-all

  ;gis:load-coordinate-system (word "data/" projection ".prj")

  set zip-data gis:load-dataset "MODZCTA_2010.shp"

  gis:set-drawing-color 5  gis:fill zip-data 1.0

end

I got the error message complaining about the unsupported Lambert_Conformal_Conic projection. A simple solution is provided here.

Monday, January 13, 2020

Using raster data in Netlogo

I am trying to replicate the procedure described on page 111-114 in AGIS. The generated clipped population data file cannot be read into NetLogo. After some digging, here is the problem and the solution is really simple: just add '-co force_cellsize=true' to the text box for additional command-line parameters.

Saturday, December 28, 2019

NetLogo

I enjoyed reading the book Agent-Based Modeling & Geographical Information Systems. I first got interested in agent-based modeling around 1999. At that time, the only software platform for this kind of modeling is Mathematica. Now with free and open source software like NetLogo, it is much easier to translate ideas into executable code and see the results.

A large number of agent-based models have been developed. OpenABM is an online repository for such models, the majority of which were developed in NetLogo.

Sunday, August 03, 2014

RNetLogo

The RNetLogo package completes the NetLogo simulation environment and makes it an attractive and complete experimentation tool for social scientists and alike.

Sunday, September 08, 2013

RNetLogo

The RNetLogo package is a small piece of wonder. One can conduct agent-based simulation, try different model parameters, and then collect and conduct statistical analysis of the simulation results.

Wednesday, January 18, 2012

NetLogo

The NetLogo developers really want to get things right: today they released the 7th release candidate for the new version (v. 5)!

Counter