swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] Problems creating input object from .scm


From: Paul Johnson
Subject: Re: [Swarm-Support] Problems creating input object from .scm
Date: Thu, 23 Feb 2006 09:21:08 -0600
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

It is not clear what you are trying to do. The question refers to input object from scm, but the comment in the file is about creating output files. And you don't say if you mean output as a summary of results or output as a snapshot of the condition of the agents.

If you mean you want to save the state of your simulation into an scm file and then restart the simulation using those values, I have a couple of complete working examples you can look at. The newest ArtificialStockMarket does serialization, and the public opinion model does that too. I believe I put in pretty much commentary in the readme files.

http://pj.freefaculty.org/Swarm/MySwarmCode/OpinionFormation/Opinion-2.0.1.tar.gz
http://ArtStkMkt.sourceforge.net

There are some examples on Lisp output in the WorkingExample directory as well:

http://pj.freefaculty.org/SwarmFaq/WorkingExampleCode/objc/LispSaveOutput.txt
http://pj.freefaculty.org/SwarmFaq/WorkingExampleCode/objc/LispInDoubles.txt

You choose lispOutDeep or lispOutShallow, depending on if you need to try to force a recursive search of an object and all the objects inside it, or just a set of IVARs (doubles, int, BOOL, like that). Then in the classes you intend to save, you can write customized methods to override the default lispOutXXX methods. I wrote up a slide show about this topic, which we were calling Serialization.
http://pj.freefaculty.org/Papers/Presentations/SwarmFest03/Sfest03_serialization.pdf

It is difficult to admit this, but when I was "knee deep" in this, it all seemed perfectly obvious to me. But, after not doing it for a year or so, I can see it requires some concentration. I wish there were more personal payoff in writing up documentation, but there just isn't.

If you find broken links in my web pages, please let me know. I've been forced to migrate out of KU service altogether and bought space on Dreamhost.com. Currently old links are redirecting, but you can go directly to http://pj.freefaculty.org.

pj

David Camacho Trujillo wrote:

Hi dear Swarm community,

My model runs fine under GUI and Batch mode, but I it can not open an external
file (to read some data) utilizing "replicator2.pl",  (there are no crash, it
just simply do not open the file and terminate).

Usually to open that external file, (and to perform something on those data) I
utilize a another object, from a separate class named "Input". I have try to
create this class, similarly to the "Output" class from the tutorial. (the idea
behind was that this "Input" class should be at a similar level into the whole
model structure related to the dependencies ).  Therefore, this "Input-object"
is created in the "buildObjects" method from the "modelSwarm".

I have already try to create this class in a superior class than the
"modelSwarm", so I try with on the "buildObjects" from the Batch and Observer
classes, and same result: runs fine for GUI and Batch but not with 
replicator2.pl

In  "Parameter" class we do not have "buildObjects", and from the " .scm" file I
have no idea how to call this class or pass the info.
How to solve this?
I work under suse 9.2, objective-c

David




_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support


--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504 University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700



reply via email to

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