swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Serialization consternation


From: Paul E Johnson
Subject: Serialization consternation
Date: Fri, 22 Feb 2002 15:14:40 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020212

I never heard the term serialization before Alex Lancaster mentioned it to me and he wrote the section in the Swarm User Guide about it. Marcus Daniels has written some working example code that can write and load scheme/LISP formatted files and I can understand most of that. But I think there is some philosophical element I'm missing in how one does serialization on a big project, as opposed to a simple working example.

Some people ( N>1 ) have tried to explain this to me, but since my examples don't work the way I expect, I was hoping someone had done this in an Obj-C Swarm program(or knows somebody who has) so I could see their example.

Lately, I've become interested in serialization because I want to run a big model until it reaches a particular stage, and then I want to restart it many times from that stage to measure the impact of particular perturbations. Serialization, as far as Alex and Marcus have explained it to me, is intended for that kind of thing.

But now I have hit the problem that my agents and environments are full of things that are difficult to serialize. For example, in one simulation each agent meets other agents and adds them to a listOfFriends. In another, each agent has a Swarm Map in which the key is the id of the other agent and that points to a data container object summarizing their interactions. In that one, each agent has to draw itself on a raster, and so each agent has an IVAR for the observerSwarm and each agent gets information from the modelSwarm periodically, so it has an IVAR for that.

When I try to save an agent, the serializer saves a full copy of each agent in the listOfFriends. So when I load those objects, all hell breaks loose. Loading of the modelSwarm level recreates the list of agents, and then each agent who gets "reborn" also gives birth to a redundant set of environment objects from their listOfFriends.

So, obviously, I have fundamentally misunderstood something about how to design my classes and how to serialize them.

Has anybody got a working example that deals with serialization in a context like this?

I wonder if I ought to get the source code for Doom and see how they do it :)

I can see some ways to solve part of my problem. Instead of having each agent keep a listOfFriends that includes the agents it likes, it could instead keep a Tag object for each friend, which could be matched up against people it meets to see if they match. That involves some redesign in my code, but I think I understand it. I fear it will slow everything down a bit with all the Tag swapping, but the only way to find out for sure is to write it up, right? And for Maps of other agents which use the agents themselves as key values, I have to change to use Tags from the other agents as the keys, right? That way, when the agents are reloaded, then the listOfFriends does not create a redundant set of friends, but instead a set of tags that can be compared against tags retrieved from other agents when they meet.

So, if you know of a working example in Obj-C, i wish you'd share so I can see what you did.

--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700


                 ==================================
  Swarm-Support is for discussion of the technical details of the day
  to day usage of Swarm.  For list administration needs (esp.
  [un]subscribing), please send a message to <address@hidden>
  with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]