Swarm Tutorial
43 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
43 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Swarm Sugar S cape as a Starting PointPaul E . J ohnsonDept o f Political Sc ienceU niversity o f K ansasPrepared fo r Ecological So ciety of Am erica, 2004Plan fo r SSS Tutorial• Modified Suzuk i m ethod:– Run/Study exa mples– Tinker w ith exa mples– Ho pe th eory/f ramework w ill p ercolate up• Go al is to de velop a ppreciation fo r m odel building fro m the “b ottom up ”.• Defer di scussion o f Sw arm installation to smaller p latform-specific g roupsPresentation linked to Handoutsfile-line n umbered h andouts a re cited i n this •presentation• Av ailable o nline a s: sss-2.2-Handouts.tar.g z• Original Sug arscape m odel p resented i n famous b ook by Epstein & Ax tell, Growing Artificial S ocieties (MIT Press, 1996)Begin w ith Swarm Sugarscape • St ep by step [0-sss-shell1 .txt]–Download a “tarball” [0 -001]–U npack it w ith ta r and gz ip [0 -013]–C ompile w ith: [0 -046]make–Run w ith: ./sss [0-127]–see “ screenshots” sss-1.png, sss-2.pngStudy File La yout• Paired “*h ” a nd “*m ” files• “h” is a “h eader fi le” containing:–A class declaration–A list o f variables (aka: instance va riables, IV ARS)–A list o f methods• “m” is the “i mplementation file”, where the methods a re fully w ritten o ut.Study File Lay out #2Makefile [1 1]•–used by “make” program to ...

Informations

Publié par
Nombre de lectures 15
Langue English

Extrait

Swarm Sugar Scape as a Starting Point
Paul E. Johnson
Dept of Political Science
University of Kansas
Prepared for Ecological Society of America, 2004
Plan for SSS Tutorial
Modified Suzuki method:
Run/Study examples
Tinker with examples
Hope theory/framework will percolate up
Goal is to develop appreciation for model building from the “bottom up”.
Defer discussion of Swarm installation to smaller platform-specific groups
Presentation linked to Handouts
file-line numbered handouts are cited in this presentation
Available online as:
 sss-2.2-Handouts.tar.gz
Original Sugarscape model presented in famous book by Epstein & Axtell,Growing Artificial Societies(MIT Press, 1996)
Begin with Swarm Sugarscape
Step by step [0-sss-shell1.txt]
 [0-001]Download a “tarball”
 [0-013]Unpack it with tar and gzip
Compile with: [0-046]
make
th:
Run with:
 
./sss [0-127]
creenshots” sss-1.png, sss-2.png
see “screenshots” sss-1.png, sss-2.png
Study File Layout
Paired “*h” and “*m” files
“h” is a “header file” containing:
A class declaration
A list ofvariables
A list ofvariables
(aka: instance variables, IVARS)
fmethods
A list ofmethods
“m” is the “implementation file”, where the methods are fully written out.
Study File Layout #2
Makefile [11]
used by “make” program to manage compiling (compile=convert text into an executable program)
README [1]
comments from authors
Study File Layout #3
main.m [2]
only file actually required in order to
only file actually required in order to have a program because it has the “main” function in it.
Th
The function “main” [2-011] is the one that the system runs when you start the program. It orchestrates everything else.
// means “comment” same as /* comment */
If this were written in C, it would be “main.c”
What does main do?
initSwarm() [2-015]
a big, multi-purpose function called from
a big, multi-purpose function called from the Swarm library. Does much work behind the scenes.
create observerSwarm [2-017]
which is then told to: [2-019]
buildObjects (create “things” for the simulation)
buildActions (scheduling framework)
activateIn (places observer's schedu
activateIn (places observer's schedule into context)
Note Objective-C syntax
Message: brackets [ ] indicate an object or Class is sent a message
returnValue = [messageReceiver
 theMessage: anArgument];
returnValue = [messageReceiver
 messageArg1: argument1
 arg2: argument2 ];
[fred getGroceriesMeat: steak Fish: cod];
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents