You can subscribe to this list here.
| 2000 |
Jan
(3) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(10) |
Sep
(14) |
Oct
(1) |
Nov
(21) |
Dec
(13) |
| 2002 |
Jan
(17) |
Feb
(2) |
Mar
(1) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
(4) |
Aug
|
Sep
(7) |
Oct
(4) |
Nov
(12) |
Dec
(39) |
| 2003 |
Jan
(28) |
Feb
(18) |
Mar
(7) |
Apr
(5) |
May
(23) |
Jun
(29) |
Jul
(23) |
Aug
(18) |
Sep
(1) |
Oct
(5) |
Nov
(3) |
Dec
|
| 2004 |
Jan
(7) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(8) |
Jun
(2) |
Jul
(8) |
Aug
(2) |
Sep
(4) |
Oct
(3) |
Nov
|
Dec
|
| 2005 |
Jan
(2) |
Feb
(2) |
Mar
(13) |
Apr
(2) |
May
(2) |
Jun
(2) |
Jul
(32) |
Aug
(7) |
Sep
(11) |
Oct
(8) |
Nov
(16) |
Dec
(2) |
| 2006 |
Jan
(3) |
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(6) |
Nov
(1) |
Dec
(10) |
| 2007 |
Jan
(7) |
Feb
(6) |
Mar
(1) |
Apr
(5) |
May
(4) |
Jun
(6) |
Jul
(20) |
Aug
(21) |
Sep
(12) |
Oct
(4) |
Nov
(12) |
Dec
(17) |
| 2008 |
Jan
(18) |
Feb
(6) |
Mar
(9) |
Apr
(13) |
May
(14) |
Jun
(8) |
Jul
(23) |
Aug
(31) |
Sep
(26) |
Oct
(10) |
Nov
(3) |
Dec
(79) |
| 2009 |
Jan
(63) |
Feb
(13) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(2) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(1) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(2) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
|
From: Nick C. <ni...@sr...> - 2001-09-07 14:44:24
|
Oops, attached the wrong file. Here's the correct one. On Fri, 2001-09-07 at 10:36, Nick Collier wrote: > Thanks for the feedback. I've attached a new version with the shuffling > in place. This does raise questions about how you want to handle the > random seed, however. > > Nick > > On Thu, 2001-09-06 at 19:29, Laszlo Gulyas wrote: > > Hi, > > > > First of all, I liked the SimpleModel class pretty much, so thanks for the > > good work. > > I'll give it some more thoughts during the coming days, though... > > > > At this point, the only thing which came up was the scrambling of the > > agentList before each autoStep, in order to have the order in which the > > agents are called randomized. I wonder whether this should also be automated. > > I understand that you could do that in preStep(), but may be, having a flag > > for that, > > too would be even easier. > > > > Best, > > > > Gulya > > > > -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Nick C. <ni...@sr...> - 2001-09-07 14:38:28
|
Thanks for the feedback. I've attached a new version with the shuffling in place. This does raise questions about how you want to handle the random seed, however. Nick On Thu, 2001-09-06 at 19:29, Laszlo Gulyas wrote: > Hi, > > First of all, I liked the SimpleModel class pretty much, so thanks for the > good work. > I'll give it some more thoughts during the coming days, though... > > At this point, the only thing which came up was the scrambling of the > agentList before each autoStep, in order to have the order in which the > agents are called randomized. I wonder whether this should also be automated. > I understand that you could do that in preStep(), but may be, having a flag > for that, > too would be even easier. > > Best, > > Gulya > > > At 02:42 PM 9/6/01 -0400, Nick Collier wrote: > >Hi, > > > >I've attached the first cut of a base model class that attempts to hide > >the scheduling mechanism. (For those of you tuning in late, this is for > >teaching purposes although its probably applicable to a lot of current > >models as well). Its based on the tutorial TemplateModel by Lars-Erik and > >Gulya. The idea here is that the user subclasses SimpleModel and > >implements or overrides a few methods while SimpleModel takes care of the > >scheduling. > > > >The important pieces here are: > > > >1. The run*(), and *step() methods. The idea here is to split up the > >behavoir executed each tick into pre (preStep()), post (postStep()), and > >executing (step()) phases. So in the case of a cooperation game, the user > >would override the step() method to have the agents play the game, and the > >preStep() and postStep() would do any necessary prepartion or destruction. > >What actually executes each tick is preStep(), step() and then postStep(). > > > >If autoStep is set to true, SimpleModel will execute the preStep(), > >autoStep() and then postStep(). autoStep() loops through the agent list > >calling step on each agent. For this to work the agents must implement the > >Stepable interface. > > > >2. The stopping time stuff. This was in the TemplateModel code so I > >assumed it was important and implemented it. The idea here is that the > >user can set the stopping time via a call to setStoppingTime in their > >model, and SimpleModel will schedule the model to stop when that tick has > >completed. > > > >So, is this enough? Do we need to include some random number > >initialization? Should SimpleModel be abstract and force people to > >implement buildModel()? Any other thoughts, comments, etc. are of course > >welcome. > > > >Nick > > > > > >Lars-Erik Cederman wrote: > >>Nick: This sounds like music to our ears! When do you think you might be > >>done with this new version? Gulya and I will be teaching RePast as of > >>October and we're obviously very keen to have a standardized hiding mechanism. > >>We'd be more than happy to contribute ideas and code so that we can get > >>this one up and running very soon. > >>I should mention that Gulya has now arrived in Cambridge. His email > >>address is gu...@la.... > >>Cheers, L-E > >> > >> > >>>Hi, > >>> > >>>I'm thinking for the next release of repast I'll add something along the > >>>lines of your tutorial model that hides the scheduler, and assumes a > >>>step method in the agents. I'd appreciate your thoughts on this. > >>> > >>>thanks, > >>> > >>>Nick > >>> > >>>-- > >>>Nick Collier > >>>Social Science Research Computing > >>>University of Chicago > >>>http://repast.sourceforge.net > >> > > > > > >-- > >Nick Collier > >Social Science Research Computing > >University of Chicago > >http://repast.sourceforge.net > > > > > > > >package uchicago.src.sim.engine; > > > >public interface Stepable { > > > > public void step(); > > > >} > >package uchicago.src.sim.engine; > > > >import java.util.ArrayList; > > > >public class SimpleModel extends SimModelImpl { > > > > protected Schedule schedule; > > protected ArrayList agentList; > > protected String name = "A RePast Model"; > > protected String[] params = {""}; > > private long stoppingTime = -1; > > private BasicAction stoppingAction; > > protected boolean autoStep = false; > > > > public void setStoppingTime(int time) { > > stoppingTime = time; > > if (stoppingAction != null) schedule.removeAction(stoppingAction); > > if (schedule != null) setStopAction(); > > } > > > > private void setStopAction() { > > System.out.println(stoppingTime); > > schedule.scheduleActionAt(stoppingTime, this,"stop", Schedule.LAST); > > } > > > > public void setup() { > > stoppingTime = -1; > > stoppingAction = null; > > schedule = new Schedule(); > > agentList = new ArrayList(); > > } > > > > public void begin() { > > buildModel(); > > buildSchedule(); > > } > > > > public String getName() { > > return name; > > } > > > > public Schedule getSchedule() { > > return schedule; > > } > > > > public String[] getInitParam() { > > return params; > > } > > > > public void buildModel() {} > > > > public void buildSchedule() { > > if (autoStep) schedule.scheduleActionBeginning(1, this, "runAutoStep"); > > else schedule.scheduleActionBeginning(1, this, "run"); > > setStopAction(); > > } > > > > public void runAutoStep() { > > preStep(); > > autoStep(); > > postStep(); > > } > > > > public void run() { > > preStep(); > > step(); > > postStep(); > > } > > > > private void autoStep() { > > int size = agentList.size(); > > for (int i = 0;i < size; i++) { > > Stepable agent = (Stepable)agentList.get(i); > > agent.step(); > > } > > } > > > > protected void preStep() {} > > protected void step() {} > > protected void postStep() {} > > > > public static void main(String[] args) { > > SimInit init = new SimInit(); > > SimpleModel model = new SimpleModel(); > > if (args.length > 0) init.loadModel(model, args[0], false); > > else init.loadModel(model, null, false); > > } > > > >} > > > > > > > > > > > > > > > > > > > > > > -- > Laszlo Gulyas, MSc > Government Department Weatherhead Center for International Affairs > Harvard University 602C Coolidge Hall > 1737 Cambridge street Cambridge, MA-02138 > > -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Laszlo G. <gu...@la...> - 2001-09-06 23:27:16
|
Hi, First of all, I liked the SimpleModel class pretty much, so thanks for the good work. I'll give it some more thoughts during the coming days, though... At this point, the only thing which came up was the scrambling of the agentList before each autoStep, in order to have the order in which the agents are called randomized. I wonder whether this should also be automated. I understand that you could do that in preStep(), but may be, having a flag for that, too would be even easier. Best, Gulya At 02:42 PM 9/6/01 -0400, Nick Collier wrote: >Hi, > >I've attached the first cut of a base model class that attempts to hide >the scheduling mechanism. (For those of you tuning in late, this is for >teaching purposes although its probably applicable to a lot of current >models as well). Its based on the tutorial TemplateModel by Lars-Erik and >Gulya. The idea here is that the user subclasses SimpleModel and >implements or overrides a few methods while SimpleModel takes care of the >scheduling. > >The important pieces here are: > >1. The run*(), and *step() methods. The idea here is to split up the >behavoir executed each tick into pre (preStep()), post (postStep()), and >executing (step()) phases. So in the case of a cooperation game, the user >would override the step() method to have the agents play the game, and the >preStep() and postStep() would do any necessary prepartion or destruction. >What actually executes each tick is preStep(), step() and then postStep(). > >If autoStep is set to true, SimpleModel will execute the preStep(), >autoStep() and then postStep(). autoStep() loops through the agent list >calling step on each agent. For this to work the agents must implement the >Stepable interface. > >2. The stopping time stuff. This was in the TemplateModel code so I >assumed it was important and implemented it. The idea here is that the >user can set the stopping time via a call to setStoppingTime in their >model, and SimpleModel will schedule the model to stop when that tick has >completed. > >So, is this enough? Do we need to include some random number >initialization? Should SimpleModel be abstract and force people to >implement buildModel()? Any other thoughts, comments, etc. are of course >welcome. > >Nick > > >Lars-Erik Cederman wrote: >>Nick: This sounds like music to our ears! When do you think you might be >>done with this new version? Gulya and I will be teaching RePast as of >>October and we're obviously very keen to have a standardized hiding mechanism. >>We'd be more than happy to contribute ideas and code so that we can get >>this one up and running very soon. >>I should mention that Gulya has now arrived in Cambridge. His email >>address is gu...@la.... >>Cheers, L-E >> >> >>>Hi, >>> >>>I'm thinking for the next release of repast I'll add something along the >>>lines of your tutorial model that hides the scheduler, and assumes a >>>step method in the agents. I'd appreciate your thoughts on this. >>> >>>thanks, >>> >>>Nick >>> >>>-- >>>Nick Collier >>>Social Science Research Computing >>>University of Chicago >>>http://repast.sourceforge.net >> > > >-- >Nick Collier >Social Science Research Computing >University of Chicago >http://repast.sourceforge.net > > > >package uchicago.src.sim.engine; > >public interface Stepable { > > public void step(); > >} >package uchicago.src.sim.engine; > >import java.util.ArrayList; > >public class SimpleModel extends SimModelImpl { > > protected Schedule schedule; > protected ArrayList agentList; > protected String name = "A RePast Model"; > protected String[] params = {""}; > private long stoppingTime = -1; > private BasicAction stoppingAction; > protected boolean autoStep = false; > > public void setStoppingTime(int time) { > stoppingTime = time; > if (stoppingAction != null) schedule.removeAction(stoppingAction); > if (schedule != null) setStopAction(); > } > > private void setStopAction() { > System.out.println(stoppingTime); > schedule.scheduleActionAt(stoppingTime, this,"stop", Schedule.LAST); > } > > public void setup() { > stoppingTime = -1; > stoppingAction = null; > schedule = new Schedule(); > agentList = new ArrayList(); > } > > public void begin() { > buildModel(); > buildSchedule(); > } > > public String getName() { > return name; > } > > public Schedule getSchedule() { > return schedule; > } > > public String[] getInitParam() { > return params; > } > > public void buildModel() {} > > public void buildSchedule() { > if (autoStep) schedule.scheduleActionBeginning(1, this, "runAutoStep"); > else schedule.scheduleActionBeginning(1, this, "run"); > setStopAction(); > } > > public void runAutoStep() { > preStep(); > autoStep(); > postStep(); > } > > public void run() { > preStep(); > step(); > postStep(); > } > > private void autoStep() { > int size = agentList.size(); > for (int i = 0;i < size; i++) { > Stepable agent = (Stepable)agentList.get(i); > agent.step(); > } > } > > protected void preStep() {} > protected void step() {} > protected void postStep() {} > > public static void main(String[] args) { > SimInit init = new SimInit(); > SimpleModel model = new SimpleModel(); > if (args.length > 0) init.loadModel(model, args[0], false); > else init.loadModel(model, null, false); > } > >} > > > > > > > > > > -- Laszlo Gulyas, MSc Government Department Weatherhead Center for International Affairs Harvard University 602C Coolidge Hall 1737 Cambridge street Cambridge, MA-02138 |
|
From: Nick C. <sr...@ea...> - 2001-09-06 18:41:49
|
Hi, I've attached the first cut of a base model class that attempts to hide the scheduling mechanism. (For those of you tuning in late, this is for teaching purposes although its probably applicable to a lot of current models as well). Its based on the tutorial TemplateModel by Lars-Erik and Gulya. The idea here is that the user subclasses SimpleModel and implements or overrides a few methods while SimpleModel takes care of the scheduling. The important pieces here are: 1. The run*(), and *step() methods. The idea here is to split up the behavoir executed each tick into pre (preStep()), post (postStep()), and executing (step()) phases. So in the case of a cooperation game, the user would override the step() method to have the agents play the game, and the preStep() and postStep() would do any necessary prepartion or destruction. What actually executes each tick is preStep(), step() and then postStep(). If autoStep is set to true, SimpleModel will execute the preStep(), autoStep() and then postStep(). autoStep() loops through the agent list calling step on each agent. For this to work the agents must implement the Stepable interface. 2. The stopping time stuff. This was in the TemplateModel code so I assumed it was important and implemented it. The idea here is that the user can set the stopping time via a call to setStoppingTime in their model, and SimpleModel will schedule the model to stop when that tick has completed. So, is this enough? Do we need to include some random number initialization? Should SimpleModel be abstract and force people to implement buildModel()? Any other thoughts, comments, etc. are of course welcome. Nick Lars-Erik Cederman wrote: > Nick: This sounds like music to our ears! When do you think you might be > done with this new version? Gulya and I will be teaching RePast as of > October and we're obviously very keen to have a standardized hiding > mechanism. > > We'd be more than happy to contribute ideas and code so that we can get > this one up and running very soon. > > I should mention that Gulya has now arrived in Cambridge. His email > address is gu...@la.... > > Cheers, L-E > > > >> Hi, >> >> I'm thinking for the next release of repast I'll add something along >> the lines of your tutorial model that hides the scheduler, and assumes >> a step method in the agents. I'd appreciate your thoughts on this. >> >> thanks, >> >> Nick >> >> -- >> Nick Collier >> Social Science Research Computing >> University of Chicago >> http://repast.sourceforge.net > > > -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Nick C. <sr...@ea...> - 2001-09-05 20:11:42
|
Hi, I've begun consolidating the various junit unit tests that I've created. I've made a new directory uchicago/src/sim/test and placed the various tests in there. These all use the junit testing framework created by those giants among men Erich Gamma and Kent Beck (see www.junit.org). The README attempts to summarize what each test does and what it requires in the way of external libraries. To run the tests you'll need to get a hold of junit from the above url. Once it is installed, make sure you start it with a classpath that includes wherever you've compiled the tests and whatever external library those tests need. For example, java -cp /home/nick/classes:/usr/local/junit/junit.jar:/home/nick/repast/lib/colt.jar junit.swingui.TestRunner You'll get a nice gui where you can load the class file that contains your test (e.g. uchicago.src.sim.test.NetworkTest). Writing these sorts of unit tests serves two purposes (or at least it works that way for me). The first is, of course, to exercise some API to find bugs and I invariably do. The second is to test the semantics of the API itself by actually using it. In fact, developing the tests in conjuction with developing the API helps with the conceptual/semantic part of framework development. So, the point of all this is that if you change the framework in some way, see if there is a relevant test that you can add to and run. If not, try and create some tests to exercise your changes. Of course writing tests is a bit tedious, but junit makes a lot more "fun". There's only a few tests in the the test directory at the moment, but there's some offhand, one-off tests scattered througout the repast source tree and even more in my own non-public test directory. In the next few days, I'll try and consolidate these and make unit tests out of them where applicable. Nick -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: ravi m. <rma...@ya...> - 2001-09-04 20:06:25
|
__________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com |
|
From: Thomas H. <th...@sr...> - 2001-09-04 18:13:49
|
Don't know what the spec says, but I've tested the order on both linux and nt, and it worked as expected. Maybe this is the best way to handle parameter changes. -Tom On Mon, Sep 03, 2001 at 04:41:57PM -0400, Nick Collier wrote: > Hi, > > I just checked some code (uchicago/src/reflector/PropertyTextField.java) > into cvs that will update a text field parameter whenever that field > loses focus. It seems to work okay on Linux. I do have qualms however, > and that's why I'm writing this. I've set PropertyTextField to send a > message to the console whenever focus is lost and thus an update occurs, > and you'll see that focus is lost for virtually any kind of key-stroke > or mouse event. I'd rather not be calling methods on the model so often. > The other thing I'm worried about is call sequence. That is, if the user > changes a parameter and then clicks start at least two events are > fired, one is the obvious button click on start, and the second is the > loss of focus on the parameter text field. Some simple tests on linux > show the the loss of focus event is handled first, and then the mouse > click. Does anyone know if this order is guaranteed by the java spec? > That is, loss of focus broadcast and handled prior to the click that > cause the loss of focus. Obviously if its not guaranteed the whole thing > goes out the window. I can look this up, but wanted to know if anyone > knew offhand. So, thoughts, comment on setting parameters via focus > adapters? > > thanks, > > Nick > > ps. I've included a sample model that has a few different kind of > parameters. I've used to it test this new focus parameter setting. Its > in a test package so you'll need to put in a test directory and compile > it from there. > > n. > > -- > Nick Collier > Social Science Research Computing > University of Chicago > http://repast.sourceforge.net > > package test; > > import java.util.Hashtable; > > import uchicago.src.sim.engine.*; > import uchicago.src.reflector.*; > > /** > * An example model demonstrating parameter display both unadorned and > * in PropertyDescriptors. > */ > public class UIExample extends SimModelImpl { > > // int flags contained in the ListPropertyDescriptor "pd" created > // below. > private static final int INT_VALUE_1 = 1; > private static final int INT_VALUE_2 = 2; > private static final int INT_VALUE_3 = 3; > > private Schedule schedule; > static OutputFrame output = new OutputFrame(); > > // these store the value of this model's parameters, but they > // themselves are not the parameters, the parameters are defined in > // the get and set method names. A get and set method (a parameter) > // could store its value in two variables and thus the variable itself > // is not the true parameter. > private ParameterClass pclass = new ParameterClass(); > private int lpdExample = INT_VALUE_3; > private double lpdDblExample = 3.1; > private int intVal = 1; > private String stringVal = "hello"; > private boolean boolVal = true; > > public UIExample() { > output.display(); > > // this sets up the ListPropertyDescriptor > Hashtable h = new Hashtable(); > h.put(new Integer(INT_VALUE_1), "Int Value One"); > h.put(new Integer(INT_VALUE_2), "Int Value Two"); > h.put(new Integer(INT_VALUE_3), "Int Value Three"); > ListPropertyDescriptor pd = new ListPropertyDescriptor("LPDExample", h); > descriptors.put("LPDExample", pd); > > // sets up another ListPropertyDescriptor, this time with an > // array rather than a Hashtable. > Double[] doubles = {new Double(3.1), new Double(102.2), new Double(.33)}; > ListPropertyDescriptor pd1 = new ListPropertyDescriptor("LPDDblExample", > doubles); > descriptors.put("LPDDblExample", pd1); > > } > > // begins the definition of the LPDExample parameter. This parameter > // is set via the ListPropertyDescriptor "pd" defined above. The current > // value of the combobox is the hashtable value for the key returned by > // this getLPDExample method. > public int getLPDExample() { > return lpdExample; > } > > // called whenever the combobox for the LPDExample is selected. The > // key value of the hashtable is set here. > public void setLPDExample(int val) { > lpdExample = val; > output.append("LPDVal: " + lpdExample); > } > // ends the definition of the LPDExample parameter. > > // begins the definition of the LPDDblParameter. This is set via > // the ListPropertyDescriptor "pd1". > public void setLPDDblExample(double val) { > lpdDblExample = val; > output.append("LPDDblVal: " + lpdDblExample); > } > > public double getLPDDblExample() { > return lpdDblExample; > } > > // ends the definition of LPDblExample > > // int values are displayed and set via their string representation > // in a text box. > public int getIntVal() { > return intVal; > } > > public void setIntVal(int val) { > intVal = val; > output.append("IntVal: " + intVal); > } > > // String values are displayed and set in a text box. > public String getStringVal() { > return stringVal; > } > > public void setStringVal(String val) { > stringVal = val; > output.append("StringVal: " + stringVal); > } > > // boolean values are displayed and set via a checkbox. This > // BooleanPropertyDescriptor is created automatically by repast. > public boolean getBooleanVal() { > return boolVal; > } > > public void setBooleanVal(boolean val) { > boolVal = val; > output.append("BooleanVal: " + boolVal); > } > > // class type (excluding strings, and the primitive wrappers) parameters > // are displayed and modified via a button. Clicking the button displays > // the properties (parameters) of that class which can now be modified. > public ParameterClass getParameterClass() { > return pclass; > } > > // this method is necessary otherwise the button for working with > // the ParameterClass parameters will be disabled, that is, the > // Parameters is read-only. > public void setParameterClass(ParameterClass val) {} > > private void buildModel() { > > } > > private void buildDisplay() { > > } > > > private void buildSchedule() { > > > } > > public void begin() { > buildModel(); > buildDisplay(); > buildSchedule(); > } > > public void setup() { > schedule = new Schedule(1); > schedule.scheduleActionBeginning(1, new BasicAction() { > public void execute() { > System.out.println(getStringVal() + " @ " + getTickCount()); > } > }); > > > } > > // the parameters of the model must be returned here if they are > // to be displayed. The names here are the get and set methods > // minus the get and set. > public String[] getInitParam() { > String[] params = {"ParameterClass", "LPDExample", "LPDDblExample", > "StringVal", "IntVal", "BooleanVal"}; > return params; > } > > public Schedule getSchedule() { > return schedule; > } > > public String getName() { > return "UIExample"; > } > > > public static void main(String[] args) { > SimInit init = new SimInit(); > UIExample model = new UIExample(); > if (args.length > 0) { > init.loadModel(model, args[0], false); > } else { > init.loadModel(model, null, false); > } > } > } > package test; > > import java.awt.Color; > import java.util.Hashtable; > > import uchicago.src.sim.space.Multi2DTorus; > import uchicago.src.sim.util.Random; > import uchicago.src.sim.gui.*; > import uchicago.src.reflector.DescriptorContainer; > import uchicago.src.reflector.ListPropertyDescriptor; > > /** > * An example of a drawable agent. Any agent that is to be visualized must > * implement the Drawable interface. Agents that want to display their > * properties in PropertyDescriptors (e.g. ComboBoxes etc.) must implement > * the DescriptorContainer interface. This is the agent for the UIExample2 > * model. > */ > > public class UIAgent implements Drawable, DescriptorContainer, Moveable { > > // int value flags get and set via the ListPropertyDescriptor set up > // below. > private static final int BLUE = 0; > private static final int RED = 1; > > private int x, y; > private Multi2DTorus space; > private Hashtable descriptors = new Hashtable(); > private Color color = Color.red; > > public UIAgent(int x, int y, Multi2DTorus space) { > this.x = x; > this.y = y; > this.space = space; > > // sets up the propertyDescriptor for this agent. > Hashtable h = new Hashtable(); > h.put(new Integer(BLUE), "Blue"); > h.put(new Integer(RED), "Red"); > ListPropertyDescriptor lpd = new ListPropertyDescriptor("Color", h); > descriptors.put("Color", lpd); > } > > public void setColor(int val) { > if (val == 0) color = Color.blue; > else color = Color.red; > } > > public int getColor() { > if (color == Color.blue) return BLUE; > else return RED; > } > > /** > * Moves the agent in a random direction in the grid space. > */ > public void step() { > int amt = Random.uniform.nextIntFromTo(1, 10); > boolean plus = Random.uniform.nextIntFromTo(0, 1) == 0; > space.removeObjectAt(x, y, this); > > if (plus) { > x += amt; > } else { > x -= amt; > } > > amt = Random.uniform.nextIntFromTo(1, 10); > plus = Random.uniform.nextIntFromTo(0, 1) == 0; > > if (plus) { > y += amt; > } else { > y -= amt; > } > > space.putObjectAt(x, y, this); > > > } > > // Drawable interface implementation > > /** > * Gets the x coordinate of this agent. > */ > public int getX() { > return x; > } > > /** > * Gets the y coordinate of this agent. > */ > public int getY() { > return y; > } > > public void setX(int val) { > space.removeObjectAt(x, y, this); > space.putObjectAt(val, y, this); > x = val; > } > > public void setY(int val) { > space.removeObjectAt(x, y, this); > space.putObjectAt(x, val, this); > y = val; > } > > /** > * Draws this agent as a rounded rectangle. > */ > public void draw(SimGraphics sg) { > sg.drawFastRoundRect(color); > } > > // DescriptorContainer interface > public Hashtable getParameterDescriptors() { > return descriptors; > } > } > > > > package test; > /** > * A sample class with some simple get and set methods. This is used to > * illustrate how parameters with class types are manipulated. See > * UIExample for more info. > */ > public class ParameterClass { > > private int integerVal = 0; > private boolean bVal; > > > public boolean getBooleanVal() { > return bVal; > } > > public void setBooleanVal(boolean val) { > bVal = val; > UIExample.output.append(this); > } > > public int getIntegerVal() { > return integerVal; > } > > public void setIntegerVal(int val) { > integerVal = val; > UIExample.output.append(this); > } > > public String toString() { > return "IntegerVal = " + integerVal + "\n" + "booleanVal = " + bVal; > } > > } |
|
From: North, M. <no...@an...> - 2001-09-04 15:38:52
|
Nick and Skye:
The deep copy code that I mentioned follows.
Mike
/*
* Import the required classes.
*
*/
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
/**
* Deep copies the given source object using serialization to and
* form a memory buffer. All of the contained objects must
* implement java.io.Serializable. Deep copying can fail for
* several reasons. The two most common causes of deep copy failure
* are attempting to copy objects that are not serializable and a
* lack of memory.
*
* Please note that there are limitations on serializing the
* Java Foundation Classes as noted in following entries from the
* Java Bug Database:
*
* 4379839: "Some tests fail with NotSerializableException."
* 4368050: "JToolBar is throwing a NotSerializableException."
* 4374993: "JSpinner is throwing NotSerializableException."
* 4375004: "TransferHandler is throwing
NotSerializableException."
* 4081159: "JFC components cannot be serialized as Java Beans"
*
* @param source - the element to duplicated.
* @return a deep copy of the source element or null if there is a
failure.
*/
public static Object deepCopy(Object source) {
// Declare the needed local variables.
ByteArrayOutputStream ostream = new
ByteArrayOutputStream();
ByteArrayInputStream istream = null;
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
Object destination = null;
// Attempt to duplicate the given item.
try {
// Attempt to serialize the given item to memory.
oos = new ObjectOutputStream(ostream);
oos.writeObject(source);
oos.flush();
ostream.close();
// Attempt to deserialize the given item from
memory.
istream = new
ByteArrayInputStream(ostream.toByteArray());
ois = new ObjectInputStream(istream);
destination = ois.readObject();
istream.close();
// Return the results.
return destination;
// Note errors.
} catch (Exception e) {
// Signal an error.
return null;
}
}
-----Original Message-----
From: Skye Bender-deMoll [mailto:sky...@sa...]
Sent: Friday, August 31, 2001 11:56 AM
To: ni...@sr...; rep...@li...
Subject: Re: [Repast-developer] interesting copy question
The way I've been doing it is to assume that people are either working
with multiplex networks, or they arn't (hows that for logic!). So, for
ex., all of the generation classes are either designed so that they will
not create duplicate ties, or (I belive random net does this) you must
explicity allow the possiblity of duplicate ties and self-loops. Many
network statistics not meaningful if duplicate ties are allowed, but
there are definitly some models where that is the way to go. So Density
(the ratio of existing arcs to possible arcs in the network) will still
return a reasonable value, but it is not really defined if you have
multiplex ties, as you don't know what the max possbile num ties is.
My soln. was to have calcDensity(ArrayList network) check if the network
was multiplex, and throw a message. However this takes time, so I was
also creating a method calcDensity(ArrayList network, boolean
isMultiplx) If false, it would calc the density and return a value
without checking for multplex (expensive) Method won't crash if the net
was multi, just would return funny value. if isMultiplex is true, I was
going to have it call a method, collapseMulti(ArralyList network) which
would return the network with multiplex ties removed and calc the
density. This pattern could be extened to other methods as well. Idea
is that if they don't know what they are doing, things will be safe and
slow, or if they know they've generated a network with no multiple ties,
they can be fast.
But, I realized that it would be dangerous to call collapseMulti from
within another method, as it would delete the ties in the original
network, hence the disire for a deep copy method. But it made me
realise that there may be other (non-network) cases were people might
want to perform operations on agents without actually modifying the
"real" agents in the agent list. So perhaps we should implement Mikes
suggestion, but as RepastUtilties.getDeepCopy(Object agent)? The other
tricky thing is that getting a deep copy of a node would have to return
a copy of the entire network it is connected to, otherwise if it still
has the original edges, changing them would still change the original
network.
So, as I doubt we will figure all this out before i leave, I'll make
sure collapseMulti is not called from within other methods, that it
doesn't return (to make it clear that it is chaging the pased network
rather than returning a copy), and it is documented as dangerous!
BTW, NetUtilities.isMultiplex(ArrayList network) is a great way to check
if a construction algorithm is working correctly!
best skye
Nick Collier wrote:
>
> I think Mike's suggestion here is a good one. But a question, under what
> conditions will there be duplicate ties. Is it something we can protect
> against when ties are created, a switch to all multiplex networks, or an
> exception is thrown?
>
> nick
>
>
> --
> Nick Collier
> Social Science Research Computing
> University of Chicago
> http://repast.sourceforge.net
_______________________________________________
Repast-developer mailing list
Rep...@li...
http://lists.sourceforge.net/lists/listinfo/repast-developer
|
|
From: Nick C. <sr...@ea...> - 2001-09-04 15:24:12
|
I think Skye's idea is a good one and probably what I'll do but I have a few reservations. 1. A user should be able to set the parameters without pressing start. This is not a problem as we can leave the enter stuff in there. 2. There is at least one simulation that I know of that relies on the proper order of parameters being set -- i.e. can only set y coherently if x is set to 0. Setting all the parameters via the start button means that the user can't use this. Again, this can be overcome by setting the relevant parameters first with enter, although there will need to be some documentation about what's going on. 3. A user may want to set a parameter but not start the simulation. Again, this can probably be taken care of with keeping enter. What I'm really worried about is that setting them at start may break some simulations, although I can't think why this would happen. Thoughts? Nick Thomas Howe wrote: > The thought that skye had (and I think it's a good one) is to have the > model check the parameters whenever the start button is clicked. This > gets around the messy issue of constantly firing events, but still eliminates the need to hit return everytime (which I must say is driving me crazy). > > BTW, I wrote a simulation which seems to work fine, albeit slowly (I have agents giving birth which causes a lot of object creation). I feel like I have a much beeter feel for the framework and I'm ready to get started. If you have any directions that you would like me to work on, let me know. > > -Tom > > On Mon, Sep 03, 2001 at 04:41:57PM -0400, Nick Collier wrote: > >>Hi, >> >>I just checked some code (uchicago/src/reflector/PropertyTextField.java) >>into cvs that will update a text field parameter whenever that field >>loses focus. It seems to work okay on Linux. I do have qualms however, >>and that's why I'm writing this. I've set PropertyTextField to send a >>message to the console whenever focus is lost and thus an update occurs, >>and you'll see that focus is lost for virtually any kind of key-stroke >>or mouse event. I'd rather not be calling methods on the model so often. >>The other thing I'm worried about is call sequence. That is, if the user >> changes a parameter and then clicks start at least two events are >>fired, one is the obvious button click on start, and the second is the >>loss of focus on the parameter text field. Some simple tests on linux >>show the the loss of focus event is handled first, and then the mouse >>click. Does anyone know if this order is guaranteed by the java spec? >>That is, loss of focus broadcast and handled prior to the click that >>cause the loss of focus. Obviously if its not guaranteed the whole thing >>goes out the window. I can look this up, but wanted to know if anyone >>knew offhand. So, thoughts, comment on setting parameters via focus >>adapters? >> >>thanks, >> >>Nick >> >>ps. I've included a sample model that has a few different kind of >>parameters. I've used to it test this new focus parameter setting. Its >>in a test package so you'll need to put in a test directory and compile >>it from there. >> >>n. >> >>-- >>Nick Collier >>Social Science Research Computing >>University of Chicago >>http://repast.sourceforge.net >> >> > >>package test; >> >>import java.util.Hashtable; >> >>import uchicago.src.sim.engine.*; >>import uchicago.src.reflector.*; >> >>/** >> * An example model demonstrating parameter display both unadorned and >> * in PropertyDescriptors. >> */ >>public class UIExample extends SimModelImpl { >> >> // int flags contained in the ListPropertyDescriptor "pd" created >> // below. >> private static final int INT_VALUE_1 = 1; >> private static final int INT_VALUE_2 = 2; >> private static final int INT_VALUE_3 = 3; >> >> private Schedule schedule; >> static OutputFrame output = new OutputFrame(); >> >> // these store the value of this model's parameters, but they >> // themselves are not the parameters, the parameters are defined in >> // the get and set method names. A get and set method (a parameter) >> // could store its value in two variables and thus the variable itself >> // is not the true parameter. >> private ParameterClass pclass = new ParameterClass(); >> private int lpdExample = INT_VALUE_3; >> private double lpdDblExample = 3.1; >> private int intVal = 1; >> private String stringVal = "hello"; >> private boolean boolVal = true; >> >> public UIExample() { >> output.display(); >> >> // this sets up the ListPropertyDescriptor >> Hashtable h = new Hashtable(); >> h.put(new Integer(INT_VALUE_1), "Int Value One"); >> h.put(new Integer(INT_VALUE_2), "Int Value Two"); >> h.put(new Integer(INT_VALUE_3), "Int Value Three"); >> ListPropertyDescriptor pd = new ListPropertyDescriptor("LPDExample", h); >> descriptors.put("LPDExample", pd); >> >> // sets up another ListPropertyDescriptor, this time with an >> // array rather than a Hashtable. >> Double[] doubles = {new Double(3.1), new Double(102.2), new Double(.33)}; >> ListPropertyDescriptor pd1 = new ListPropertyDescriptor("LPDDblExample", >> doubles); >> descriptors.put("LPDDblExample", pd1); >> >> } >> >> // begins the definition of the LPDExample parameter. This parameter >> // is set via the ListPropertyDescriptor "pd" defined above. The current >> // value of the combobox is the hashtable value for the key returned by >> // this getLPDExample method. >> public int getLPDExample() { >> return lpdExample; >> } >> >> // called whenever the combobox for the LPDExample is selected. The >> // key value of the hashtable is set here. >> public void setLPDExample(int val) { >> lpdExample = val; >> output.append("LPDVal: " + lpdExample); >> } >> // ends the definition of the LPDExample parameter. >> >> // begins the definition of the LPDDblParameter. This is set via >> // the ListPropertyDescriptor "pd1". >> public void setLPDDblExample(double val) { >> lpdDblExample = val; >> output.append("LPDDblVal: " + lpdDblExample); >> } >> >> public double getLPDDblExample() { >> return lpdDblExample; >> } >> >> // ends the definition of LPDblExample >> >> // int values are displayed and set via their string representation >> // in a text box. >> public int getIntVal() { >> return intVal; >> } >> >> public void setIntVal(int val) { >> intVal = val; >> output.append("IntVal: " + intVal); >> } >> >> // String values are displayed and set in a text box. >> public String getStringVal() { >> return stringVal; >> } >> >> public void setStringVal(String val) { >> stringVal = val; >> output.append("StringVal: " + stringVal); >> } >> >> // boolean values are displayed and set via a checkbox. This >> // BooleanPropertyDescriptor is created automatically by repast. >> public boolean getBooleanVal() { >> return boolVal; >> } >> >> public void setBooleanVal(boolean val) { >> boolVal = val; >> output.append("BooleanVal: " + boolVal); >> } >> >> // class type (excluding strings, and the primitive wrappers) parameters >> // are displayed and modified via a button. Clicking the button displays >> // the properties (parameters) of that class which can now be modified. >> public ParameterClass getParameterClass() { >> return pclass; >> } >> >> // this method is necessary otherwise the button for working with >> // the ParameterClass parameters will be disabled, that is, the >> // Parameters is read-only. >> public void setParameterClass(ParameterClass val) {} >> >> private void buildModel() { >> >> } >> >> private void buildDisplay() { >> >> } >> >> >> private void buildSchedule() { >> >> >> } >> >> public void begin() { >> buildModel(); >> buildDisplay(); >> buildSchedule(); >> } >> >> public void setup() { >> schedule = new Schedule(1); >> schedule.scheduleActionBeginning(1, new BasicAction() { >> public void execute() { >> System.out.println(getStringVal() + " @ " + getTickCount()); >> } >> }); >> >> >> } >> >> // the parameters of the model must be returned here if they are >> // to be displayed. The names here are the get and set methods >> // minus the get and set. >> public String[] getInitParam() { >> String[] params = {"ParameterClass", "LPDExample", "LPDDblExample", >> "StringVal", "IntVal", "BooleanVal"}; >> return params; >> } >> >> public Schedule getSchedule() { >> return schedule; >> } >> >> public String getName() { >> return "UIExample"; >> } >> >> >> public static void main(String[] args) { >> SimInit init = new SimInit(); >> UIExample model = new UIExample(); >> if (args.length > 0) { >> init.loadModel(model, args[0], false); >> } else { >> init.loadModel(model, null, false); >> } >> } >>} >> > >>package test; >> >>import java.awt.Color; >>import java.util.Hashtable; >> >>import uchicago.src.sim.space.Multi2DTorus; >>import uchicago.src.sim.util.Random; >>import uchicago.src.sim.gui.*; >>import uchicago.src.reflector.DescriptorContainer; >>import uchicago.src.reflector.ListPropertyDescriptor; >> >>/** >> * An example of a drawable agent. Any agent that is to be visualized must >> * implement the Drawable interface. Agents that want to display their >> * properties in PropertyDescriptors (e.g. ComboBoxes etc.) must implement >> * the DescriptorContainer interface. This is the agent for the UIExample2 >> * model. >> */ >> >>public class UIAgent implements Drawable, DescriptorContainer, Moveable { >> >> // int value flags get and set via the ListPropertyDescriptor set up >> // below. >> private static final int BLUE = 0; >> private static final int RED = 1; >> >> private int x, y; >> private Multi2DTorus space; >> private Hashtable descriptors = new Hashtable(); >> private Color color = Color.red; >> >> public UIAgent(int x, int y, Multi2DTorus space) { >> this.x = x; >> this.y = y; >> this.space = space; >> >> // sets up the propertyDescriptor for this agent. >> Hashtable h = new Hashtable(); >> h.put(new Integer(BLUE), "Blue"); >> h.put(new Integer(RED), "Red"); >> ListPropertyDescriptor lpd = new ListPropertyDescriptor("Color", h); >> descriptors.put("Color", lpd); >> } >> >> public void setColor(int val) { >> if (val == 0) color = Color.blue; >> else color = Color.red; >> } >> >> public int getColor() { >> if (color == Color.blue) return BLUE; >> else return RED; >> } >> >> /** >> * Moves the agent in a random direction in the grid space. >> */ >> public void step() { >> int amt = Random.uniform.nextIntFromTo(1, 10); >> boolean plus = Random.uniform.nextIntFromTo(0, 1) == 0; >> space.removeObjectAt(x, y, this); >> >> if (plus) { >> x += amt; >> } else { >> x -= amt; >> } >> >> amt = Random.uniform.nextIntFromTo(1, 10); >> plus = Random.uniform.nextIntFromTo(0, 1) == 0; >> >> if (plus) { >> y += amt; >> } else { >> y -= amt; >> } >> >> space.putObjectAt(x, y, this); >> >> >> } >> >> // Drawable interface implementation >> >> /** >> * Gets the x coordinate of this agent. >> */ >> public int getX() { >> return x; >> } >> >> /** >> * Gets the y coordinate of this agent. >> */ >> public int getY() { >> return y; >> } >> >> public void setX(int val) { >> space.removeObjectAt(x, y, this); >> space.putObjectAt(val, y, this); >> x = val; >> } >> >> public void setY(int val) { >> space.removeObjectAt(x, y, this); >> space.putObjectAt(x, val, this); >> y = val; >> } >> >> /** >> * Draws this agent as a rounded rectangle. >> */ >> public void draw(SimGraphics sg) { >> sg.drawFastRoundRect(color); >> } >> >> // DescriptorContainer interface >> public Hashtable getParameterDescriptors() { >> return descriptors; >> } >>} >> >> >> >> > >>package test; >>/** >> * A sample class with some simple get and set methods. This is used to >> * illustrate how parameters with class types are manipulated. See >> * UIExample for more info. >> */ >>public class ParameterClass { >> >> private int integerVal = 0; >> private boolean bVal; >> >> >> public boolean getBooleanVal() { >> return bVal; >> } >> >> public void setBooleanVal(boolean val) { >> bVal = val; >> UIExample.output.append(this); >> } >> >> public int getIntegerVal() { >> return integerVal; >> } >> >> public void setIntegerVal(int val) { >> integerVal = val; >> UIExample.output.append(this); >> } >> >> public String toString() { >> return "IntegerVal = " + integerVal + "\n" + "booleanVal = " + bVal; >> } >> >>} >> > > -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Nick C. <sr...@ea...> - 2001-09-03 20:40:58
|
Hi, I just checked some code (uchicago/src/reflector/PropertyTextField.java) into cvs that will update a text field parameter whenever that field loses focus. It seems to work okay on Linux. I do have qualms however, and that's why I'm writing this. I've set PropertyTextField to send a message to the console whenever focus is lost and thus an update occurs, and you'll see that focus is lost for virtually any kind of key-stroke or mouse event. I'd rather not be calling methods on the model so often. The other thing I'm worried about is call sequence. That is, if the user changes a parameter and then clicks start at least two events are fired, one is the obvious button click on start, and the second is the loss of focus on the parameter text field. Some simple tests on linux show the the loss of focus event is handled first, and then the mouse click. Does anyone know if this order is guaranteed by the java spec? That is, loss of focus broadcast and handled prior to the click that cause the loss of focus. Obviously if its not guaranteed the whole thing goes out the window. I can look this up, but wanted to know if anyone knew offhand. So, thoughts, comment on setting parameters via focus adapters? thanks, Nick ps. I've included a sample model that has a few different kind of parameters. I've used to it test this new focus parameter setting. Its in a test package so you'll need to put in a test directory and compile it from there. n. -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Nick C. <sr...@ea...> - 2001-08-31 20:53:34
|
test -- still having problems -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Nick C. <sr...@ea...> - 2001-08-31 17:44:04
|
I think Mike's suggestion here is a good one. But a question, under what conditions will there be duplicate ties. Is it something we can protect against when ties are created, a switch to all multiplex networks, or an exception is thrown? nick Skye Bender-deMoll wrote: > Nick, Tom, > > So I'm doing some network stuff where I want to make changes to the > network (removing duplicate ties as preperation for stats methods) > without makeing changes to the actual node "Agents" of the model. > Unfortunatly, methods like ArrayList.clone() only return shallow copies, > so any changes to the copied nodes will change the origial nodes. Now > in my case, I can probably come up with a workaround: > > 1) modify the stat function to check the condition (very awkward, but > probably the least expensive) > 2) since I am only interested in edges (and not the rest of nodes > properties), I can make a method which constructs a new network, > identical to the old one, but constructed from default nodes and edges, > and perform operations on it. > > However, there may be other cases in which people want to do things to > agents, without changeing the "real" agents. I was thinking that we > should add copy methods to the existing node structures, and add > getCopy() to the Node interface, but this would break all existing > nodes, and still not insure that all relevent variables would be > copied. Tom suggested creating a "copyable" interface and having the > abstract classes implement it... > > Nick, do you know of any other way of getting deep copies of objects? > (clone() is protected) This would still be a problem for networks, as a > deep copy of a node would necessarily have to return the whole network, > as each edge contains nodes, which contain edges.... > > Something to think about anyway! > > (in the meantime, I just won't let people work with multiplex networks!) > -skye > > _______________________________________________ > Repast-developer mailing list > Rep...@li... > http://lists.sourceforge.net/lists/listinfo/repast-developer > > -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Nick C. <sr...@ea...> - 2001-08-31 17:38:48
|
test -- don't seem to be getting mail from the lists. nick -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Nick C. <sr...@ea...> - 2001-08-31 17:25:40
|
Hi, I'm thinking for the next release of repast I'll add something along the lines of your tutorial model that hides the scheduler, and assumes a step method in the agents. I'd appreciate your thoughts on this. thanks, Nick -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Skye Bender-d. <sky...@sa...> - 2001-08-31 17:16:23
|
The way I've been doing it is to assume that people are either working with multiplex networks, or they arn't (hows that for logic!). So, for ex., all of the generation classes are either designed so that they will not create duplicate ties, or (I belive random net does this) you must explicity allow the possiblity of duplicate ties and self-loops. Many network statistics not meaningful if duplicate ties are allowed, but there are definitly some models where that is the way to go. So Density (the ratio of existing arcs to possible arcs in the network) will still return a reasonable value, but it is not really defined if you have multiplex ties, as you don't know what the max possbile num ties is. My soln. was to have calcDensity(ArrayList network) check if the network was multiplex, and throw a message. However this takes time, so I was also creating a method calcDensity(ArrayList network, boolean isMultiplx) If false, it would calc the density and return a value without checking for multplex (expensive) Method won't crash if the net was multi, just would return funny value. if isMultiplex is true, I was going to have it call a method, collapseMulti(ArralyList network) which would return the network with multiplex ties removed and calc the density. This pattern could be extened to other methods as well. Idea is that if they don't know what they are doing, things will be safe and slow, or if they know they've generated a network with no multiple ties, they can be fast. But, I realized that it would be dangerous to call collapseMulti from within another method, as it would delete the ties in the original network, hence the disire for a deep copy method. But it made me realise that there may be other (non-network) cases were people might want to perform operations on agents without actually modifying the "real" agents in the agent list. So perhaps we should implement Mikes suggestion, but as RepastUtilties.getDeepCopy(Object agent)? The other tricky thing is that getting a deep copy of a node would have to return a copy of the entire network it is connected to, otherwise if it still has the original edges, changing them would still change the original network. So, as I doubt we will figure all this out before i leave, I'll make sure collapseMulti is not called from within other methods, that it doesn't return (to make it clear that it is chaging the pased network rather than returning a copy), and it is documented as dangerous! BTW, NetUtilities.isMultiplex(ArrayList network) is a great way to check if a construction algorithm is working correctly! best skye Nick Collier wrote: > > I think Mike's suggestion here is a good one. But a question, under what > conditions will there be duplicate ties. Is it something we can protect > against when ties are created, a switch to all multiplex networks, or an > exception is thrown? > > nick > > > -- > Nick Collier > Social Science Research Computing > University of Chicago > http://repast.sourceforge.net |
|
From: North, M. <no...@an...> - 2001-08-29 21:41:11
|
Skye: One approach that has worked for me is to serialize objects to a memory buffer and then deserialize them. The result is a new, deep copy of the objects. Only a few lines of code are required. These lines could be added to RePast as a generic Factory-type service method. I can send the details if you are interested. Mike Michael J. North Software Engineer Argonne National Laboratory Decision and Information Sciences Division Complex Adaptive Systems Section 9700 S. Cass Avenue Argonne, IL 60349 E-mail: no...@an... Telephone: (630) 252-6234 Facsimile: (630) 252-6073 -----Original Message----- From: Skye Bender-deMoll [mailto:sky...@sa...] Sent: Wednesday, August 29, 2001 4:39 PM To: rep...@li... Subject: [Repast-developer] interesting copy question Nick, Tom, So I'm doing some network stuff where I want to make changes to the network (removing duplicate ties as preperation for stats methods) without makeing changes to the actual node "Agents" of the model. Unfortunatly, methods like ArrayList.clone() only return shallow copies, so any changes to the copied nodes will change the origial nodes. Now in my case, I can probably come up with a workaround: 1) modify the stat function to check the condition (very awkward, but probably the least expensive) 2) since I am only interested in edges (and not the rest of nodes properties), I can make a method which constructs a new network, identical to the old one, but constructed from default nodes and edges, and perform operations on it. However, there may be other cases in which people want to do things to agents, without changeing the "real" agents. I was thinking that we should add copy methods to the existing node structures, and add getCopy() to the Node interface, but this would break all existing nodes, and still not insure that all relevent variables would be copied. Tom suggested creating a "copyable" interface and having the abstract classes implement it... Nick, do you know of any other way of getting deep copies of objects? (clone() is protected) This would still be a problem for networks, as a deep copy of a node would necessarily have to return the whole network, as each edge contains nodes, which contain edges.... Something to think about anyway! (in the meantime, I just won't let people work with multiplex networks!) -skye _______________________________________________ Repast-developer mailing list Rep...@li... http://lists.sourceforge.net/lists/listinfo/repast-developer |
|
From: Skye Bender-d. <sky...@sa...> - 2001-08-29 21:36:47
|
Nick, Tom, So I'm doing some network stuff where I want to make changes to the network (removing duplicate ties as preperation for stats methods) without makeing changes to the actual node "Agents" of the model. Unfortunatly, methods like ArrayList.clone() only return shallow copies, so any changes to the copied nodes will change the origial nodes. Now in my case, I can probably come up with a workaround: 1) modify the stat function to check the condition (very awkward, but probably the least expensive) 2) since I am only interested in edges (and not the rest of nodes properties), I can make a method which constructs a new network, identical to the old one, but constructed from default nodes and edges, and perform operations on it. However, there may be other cases in which people want to do things to agents, without changeing the "real" agents. I was thinking that we should add copy methods to the existing node structures, and add getCopy() to the Node interface, but this would break all existing nodes, and still not insure that all relevent variables would be copied. Tom suggested creating a "copyable" interface and having the abstract classes implement it... Nick, do you know of any other way of getting deep copies of objects? (clone() is protected) This would still be a problem for networks, as a deep copy of a node would necessarily have to return the whole network, as each edge contains nodes, which contain edges.... Something to think about anyway! (in the meantime, I just won't let people work with multiplex networks!) -skye |
|
From: Nick C. <ni...@sr...> - 2001-08-19 16:42:13
|
On Fri, Aug 17, 2001 at 03:27:26PM -0500, Skye Bender-deMoll wrote: > Nick, > don't worry about this until you are moved! > > but, since I know you are going to look at the repast controller > strip and threading stuff anyway... > > I was testing the KK layout stuff with the NetTester model, and > discoverd that the "step" button doesn't always disable the "reload > button". This is an easily fixed bug. If you click step first, the reload button is not disabled. Just missing a single line to disable the reload button. > When I click the reload button (expecting it to fire the event > after the long update layout has finished), it seems to dump the objects > before the display surface is done with them, resulting in the display > surface throwing a whole pile of exceptions (one for each agent), and > the reload not occuring... This, as you've pointed out, is the result of the threading structure. I'll take a look at it after I get to Baltimore. I've been aware of it for a while, but its never been a priority to fix it. > just thought you should know, or would this be a good project for Tom to > get familiar with repast's event structure? ;-) (lord knows, even I > don't want to get THAT cozy with it!) > > -skye > > _______________________________________________ > Repast-developer mailing list > Rep...@li... > http://lists.sourceforge.net/lists/listinfo/repast-developer -- -------------- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Skye Bender-d. <sky...@sa...> - 2001-08-17 20:25:49
|
Nick, don't worry about this until you are moved! but, since I know you are going to look at the repast controller strip and threading stuff anyway... I was testing the KK layout stuff with the NetTester model, and discoverd that the "step" button doesn't always disable the "reload button". When I click the reload button (expecting it to fire the event after the long update layout has finished), it seems to dump the objects before the display surface is done with them, resulting in the display surface throwing a whole pile of exceptions (one for each agent), and the reload not occuring... just thought you should know, or would this be a good project for Tom to get familiar with repast's event structure? ;-) (lord knows, even I don't want to get THAT cozy with it!) -skye |
|
From: Nick C. <ni...@sr...> - 2001-08-15 18:39:25
|
Hi all, Given that we now have two developers making commits, and a third very soon, and hopefully a fourth in a while, I've set up a repast-cvs-commit list. All the cvs commits made to the repast source tree will be emailed to this list. If you'd like to receive these then sign up at http://sourceforge.net/mail/?group_id=1703 If you don't have commit access to the CVS tree, and unless you are absurdly keen on observing repast development on at a very low level, there's no need to subscribe to the cvs list. Tom and Skye, I've already subscribed you. Nick -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |
|
From: Lars-Erik C. <ced...@cf...> - 2001-04-09 01:58:55
|
Hi Nick, I'm trying to implement dynamic graphs using the newly added Plot function. In fact, I want to display a moving regression line as I add points to the graph. I've managed to get everything up and running except for one thing: the clear(.) method doesn't seem to destroy the data points before I redraw the new graph. Am I missing something? The only way I could make the old points disappear was by killing the entire plot with dispose and the creating a new one. Could there be a bug in clear(.)? Cheers, L-E |
|
From: <lo...@ge...> - 2001-02-26 15:10:26
|
Hi, I ma trying to take a look to different multi-agent simulation tools available from the net. I found that the main tools are Swarm, Ascape, Repast and StarLogo with a lot of common concepts. Can you tell me about your points of vues regarding these tools, the main differences between them, domain applications... advantages you experienced. Thank you a lot for your attention. Bye, Louis. |
|
From: <li...@my...> - 2000-08-04 01:39:48
|
Whether You Are Looking For Sales, Leads or Exposure,
we offer targeted or general mailings with current
addresses. We GUARANTEE response !
Now you can afford to advertise.
SUMMER SPECIAL!!!
Call us to send 100,000 emails and we will send
an additioal 100,000 for free, using our special
targeted e-mail list.
SPECIAL RATES ENDS August 7, 00
WE HAVE OPT-IN LISTS!!!!
* We can assist you in developing your entire campaign!
* We can even create your ad or annoucement for you!
Call NOW - 702-876-6076
9-5pm. pacific standard time.
For removal see below.
++++++++++++++++++++++++++++++++++++++++++++++++++
We are terribly sorry if you received this message
in error.
If you wish to be removed. Please, type "REMOVE"
in the subject line: roy...@ca...
++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
From: <li...@my...> - 2000-08-04 01:38:26
|
Whether You Are Looking For Sales, Leads or Exposure,
we offer targeted or general mailings with current
addresses. We GUARANTEE response !
Now you can afford to advertise.
SUMMER SPECIAL!!!
Call us to send 100,000 emails and we will send
an additioal 100,000 for free, using our special
targeted e-mail list.
SPECIAL RATES ENDS August 7, 00
WE HAVE OPT-IN LISTS!!!!
* We can assist you in developing your entire campaign!
* We can even create your ad or annoucement for you!
Call NOW - 702-876-6076
9-5pm. pacific standard time.
For removal see below.
++++++++++++++++++++++++++++++++++++++++++++++++++
We are terribly sorry if you received this message
in error.
If you wish to be removed. Please, type "REMOVE"
in the subject line: roy...@ca...
++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
From: <li...@my...> - 2000-08-04 01:36:44
|
Whether You Are Looking For Sales, Leads or Exposure,
we offer targeted or general mailings with current
addresses. We GUARANTEE response !
Now you can afford to advertise.
SUMMER SPECIAL!!!
Call us to send 100,000 emails and we will send
an additioal 100,000 for free, using our special
targeted e-mail list.
SPECIAL RATES ENDS August 7, 00
WE HAVE OPT-IN LISTS!!!!
* We can assist you in developing your entire campaign!
* We can even create your ad or annoucement for you!
Call NOW - 702-876-6076
9-5pm. pacific standard time.
For removal see below.
++++++++++++++++++++++++++++++++++++++++++++++++++
We are terribly sorry if you received this message
in error.
If you wish to be removed. Please, type "REMOVE"
in the subject line: roy...@ca...
++++++++++++++++++++++++++++++++++++++++++++++++++
|