Thanks Sean! Yes, that would be great. I’d prefer a link to my repo, if you’re willing to do that.
I don’t think that ABMs necessarily have to be so stateful, but it is a natural approach. I think it depends on the model. (I have a more moderate view about this than some Clojure people, who argue that you can always, in theory, make a productive ABM without much state. I think it depends.)
(When I was first experimenting with MASON, I got a Clojure version of the Students model to about 50% of the speed of the Java version. I did use refs, but not all that much. The main trick is to use Clojure’s deftype data structure for in a particular way to create your agents, rather than using defrecords or maps, which is how one usually does that sort of thing. However, that means that you have to throw out all sorts of normal coding practices for Clojure. I have been finding that using Clojure with defrecords in a semi-functional semi-stateful way works well, and allows me to write Clojure the way I want, for the most part. It’s more than fast enough for my needs. I don’t consider speed a problem at all. Some of my notes at the masonclj repo have to do with speed, and one can see from the Example app there how I do things. It requires a bit of study beyond the usual Clojure methods, becase in the end I have used most of the different Clojure-Java interop tricks, which have different benefits in different contexts. I don’t think most Clojure programmers have bothered to learn all of this stuff; there’s usually no reason to do so.)
Marshall
Marshall Abrams, Associate Professor
Department of Philosophy, University of Alabama at Birmingham
Email: [log in to unmask]; Phone: (205) 996-7483; Fax: (205) 975-6610
Mail: HB 414A, 900 13th Street South, Birmingham, AL 35294-1260; Office: HB 418
Website: http://secure-web.cisco.com/1SJkuT4zHJ9r5d6i31XBlrEOmZMRBezEEB0MT6dDmBFsHY3aT-OwQlCdnpMOGW8HwuYdguKkBbWvmpg9Ve4awoTP6zeiR4FFmxJENxEH0j7xoNLsiGkYV9x8NLvHfBXZRX3_nu0IJzV1dTpzludtWgEy4zDdIYyGJCUaxd7YLJ1QqL-V0lldZ1ld2PttTnzHEhJFm9YePN6FjU9fYussFMrtXwvFX-Hw0VBD92-Oe2QhJ1Fkl2qibihG2JaBaa2nSyLvCbeuv423KWDLv38Nk2uap--44oFCH8a78qSBWW_sku-G0s4KLmYueDRW2mIrm1wG23k5F0mrfWqgE60PAf9w-h_s7QRMhZpNMrs-mAKEX5-FrLzCR7obQFzqVA3vBXCnmIj20pvZcKxOVLSOPEROqEYKcX4N7lZxXX5L28rX4fQFqqgtIzLyERd0mmUtedvLqSHc40ty7yHWinFDz3g/http%3A%2F%2Fmembers.logical.net%2F%7Emarshall
> On May 18, 2019, at 5:38 PM, Sean Luke <[log in to unmask]> wrote:
>
> Marshall, there are a two ways that we can involve your library:
>
> - Include a link on the MASON web page to your repo
> - Let you move (and manage) your repo in MASON's contrib directory
>
> I'd be happy to do either of these.
>
> I've seen you've noticed that clojure has some efficiency issues with MASON. We also built a clojure wrapper library many years back, and found similar problems. The basic issue that got us was that idiomatic clojure tries to be immutable, but agent-based modeling is *extremely* stateful and mutable. This means you had to wrap everything with tons of Refs, which just destroyed the performance. :-( :-(
>
> Sean
>
>> On May 18, 2019, at 12:56 PM, Abrams, Marshall <[log in to unmask]> wrote:
>>
>> Hi everyone-
>>
>> Just wanted to let people know that I created a small library for use of MASON with Clojure: https://secure-web.cisco.com/1as6I-TdYImGD4IPIiaIK-fSUd9O4iYNgmp1c8ohOKK1AKT89i_xbMuQZwJh3O7ln48_a4SROi6mXeGvc-A9BJxum0sxJzyR7nOMuiFw2mJC2k6_7fat_krLXBDjZqmyv6dOHmKTFl39Za5DRgWPzuwSiPu61LeOEvkC-sOx_4OO2y8Z1t_tCnpNPzA_X3heSZ3IT7CW831CRM-_NkxwvpfQqrS_YGhbUGLP1i3frSy0HpaqR63sz4bI7iBySc7SpBptopXsgWKWJX_nJSDrjQkk7Rp_x3wskHfdna5VJep97W_VkamHQYOb4NNSrkdfahGEHUt4AVZWg6oj5qE78Whcxd8__sS8iWctljeAQwDmzGRVVz_8xl67Afl93Fbjv4FVvMI8mwqOmigJYbAle66o8pBFJ0OAvFhTm8qtHqgHxzNGsbxMpnoK_jXbIYtom67FzZvqiMXSplvjJgo7L2g/https%3A%2F%2Fgithub.com%2Fmars0i%2Fmasonclj
>>
>>
>> The focus of masonclj is not on making code as fast as possible--although there are some Clojure type hints added automatically that might help--but rather, on making it easier to get the full benefits of MASON in idiomatic Clojure code. masonclj provides functions and macros for two purposes:
>>
>> • Making it easier to define parameters for control of a model via the GUI and the command line.
>>
>> • Making it easier to track agents using the MASON inspector facilities, if you use defrecords to implement agents.
>>
>> Essentially, getting this stuff to work with idiomatic Clojure code--which is mostly functional in style--requires some extra work, and masonclj does most of the work for you.
>>
>> The masonclj repo includes a toy program illustrating use of masonclj. (My pasta repo contains a full-fledged program.)
>>
>>
>> Please pass the word on to any Clojure fans you know who want to get into agent-based modeling and might like MASON.
>>
>>
>> (There are a few minor things to be improved that I know of, but rather than wait until everything is perfect, I thought I'd announce the library now. Feedback welcome.)
>>
>> (Why not make it easier to write fast code? I've tried this, and making Clojure as efficienct as possible with MASON requires using Clojure in unusual ways that deny the programmer of much of what makes Clojure attractive in the first place. Java is a better choice for fast MASON code.)
>>
>>
>> Marshall
>>
>>
>> Marshall Abrams, Associate Professor
>> Department of Philosophy, University of Alabama at Birmingham
>> Email: [log in to unmask]; Phone: (205) 996-7483; Fax: (205) 975-6610
>> Mail: HB 414A, 900 13th Street South, Birmingham, AL 35294-1260; Office: HB 418
>> Website: http://secure-web.cisco.com/1dR7yuKO0cyRQGODEX0UVmyouHQdq93OCm_uqvTZBENYHgyUjJGCd_JcXiMrbRqTnK0Wy08nXnRLg7LeYhoxy1td098y6zagxC0-iRaUpTLgpu5BEIgyXOgLLg83IDSXTRfhOZflVEAujVSi8_vluoxxf9NFV4A6PhgHcGNZALUAh0-duxpQ7dtNVDuoC4xwJ2QJ51XAvdPgg3DzxzR9_24WzWNGoVbccKZL0MvMkRXH_CUdbeSRNoF2yLzl0Dnewn0fBR-eG9M2pgH3jRoBp43TivdOe4toeDwphaPMQ6H_B5phsfq6-T89cCwxe98oWqynAqe0UBCxlPf05YraedLZj1RvD3JIdriWg2E-3WDjAtEhIHloeDLtoFIrgaI4fPXMdgLolcH5nVlQMmJFL1_EjZI-EEp0xCksDi_w3iMjvvL7-LvHYGVp6Cz43jVQflmOuRIoX9R0WVwpV4iq1Zw/http%3A%2F%2Fmembers.logical.net%2F%7Emarshall
>>
|