From: Dumoulin N. <nic...@cl...> - 2004-10-15 07:19:33
|
Le mercredi 13 Octobre 2004 11:48, Lars-Bo Jacobsen a =E9crit=A0: > Hi all > > I am completely new to agent based modelling trying to get an insight and > learn to use the RePast framework. > > I have just started out with the How-to " How to build a RePast model - 1" > and I immediately run into confusion. I am not sure I have understood the > meaning of this how-to, is it actually a working example? I am confused > because I run into several errors from the beginning. > > Following the how-to I started out with following > > import uchicago.src.sim.engine.SimpleModel; > public class RePast1 extends SimpleModel{ > public static final int TIT_FOR_TAT =3D 0; > public static final int ALWAYS_DEFECT =3D 1; > private p1Strategy =3D TIT_FOR_TAT; > private p2Strategy =3D ALWAYS_DEFECT; > } > > Which results (in the Eclipse IDE) in a syntax error on token "=3D" in the > two "private" declarations. > > Changing the two private declaration to (adding a int) > private int p1Strategy =3D TIT_FOR_TAT; > private int p2Strategy =3D ALWAYS_DEFECT; > Resolves this issue > > > Continuing the How-to adding the setup and buildModel methods > > > import uchicago.src.sim.engine.SimpleModel; > public class RePast1 extends SimpleModel{ > public static final int TIT_FOR_TAT =3D 0; > public static final int ALWAYS_DEFECT =3D 1; > private int p1Strategy =3D TIT_FOR_TAT; > private int p2Strategy =3D ALWAYS_DEFECT; > > public void setup(){ > super.setup(); // Kalder setup() i SimpleModel > p1Strategy =3D TIT_FOR_TAT; > p2Strategy =3D ALWAYS_DEFECT; > } > public void buildModel(){ > Player p1 =3D new Player(p1Strategy); > Player p2 =3D new Player(p2Strategy); > p1.setOtherPlayer(p2); > p2.setOtherPlayer(p1); > agentList.add(p1); > agentList.add(p2); > } > } > > > Results in Eclipse saying that the object Player cannot be resolved or is > not a type. > > I would expect Player to be a Class defined in the > uchicago.src.sim.engine.SimpleModel but apparently it is not. > > > > So I am confused - Can I actually use this how-to to learn and build > something that works or are there more information I need to know before > proceeding? > > I know it's a bit confusing( probably because I completely new to RePast) > but I hope someone can comment on these issue, have I started in the right > place. > > Kind regards > > Lars-Bo Hi, I recommend you an other tutorial, quite longer, but very good, at : http://www.u.arizona.edu/~jtmurphy/H2R/HowTo01.htm I think that the REpast howto's are good for an overview of the mechanism, = but=20 that the code is not complete. An other solution (very good too) is to look= =20 at the samples sources. Best regards =2D-=20 Nicolas Dumoulin Doctorant / PhD Student CEMAGREF, LISC=20 24 avenue des Landais - BP 50085=20 63172 AUBIERE CEDEX 1 - France=20 =20 Tel. : 33 (0)4.73.44.07.29 IM : bo...@ja... - 131572326 (ICQ) |