|
From: SourceForge.net <no...@so...> - 2007-04-25 02:41:02
|
Bugs item #1707054, was opened at 2007-04-24 19:41 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101703&aid=1707054&group_id=1703 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Repast J Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: NetworkFactory, NetUtilities Random initialization needed Initial Comment: NetworkFactory, NetUtilities Random initialization needed Several methods in uchicago.src.sim.network.NetworkFactory make calls to uchicago.src.sim.network.NetUtilities.randomRewire or uchicago.src.sim.network.NetUtilities.randomRewireSymmetric. These NetUtilities methods use uchicago.src.sim.util.Random to generate random numbers. For example, NetUtilities.randomRewire calls Random.uniform.nextDoubleFromTo. The documentation for uchicago.src.sim.util.Random states: "Before using any of the instance variable distributions, these distributions must be created via the appropriate create* method." However, the instance variable distributions don't seem to be intialized within the NetUtilities class for use by its static methods. This means that if one calls certain NetworkFactory methods such as createWattsStrogatzNetwork (as I did) without first manually creating uchicago.src.sim.util.Random.uniform, then one gets a strange, very difficult to track down NullPointerException when NetUtilities.randomRewire calls Random.uniform.nextDoubleFromTo and finds no Random.uniform object (see line 726 of NetUtilities). The workaround, of course, is to manually create the required distribution in user code using, e.g., uchicago.src.sim.util.Random.createUniform(). Neither the origin this strange Exception nor the need to manually create the distribution are documented in the NetworkFactory or NetUtilities classes. I'm filing a bug in part as documentation of this issue, hopefully to save others some time in tracking this down and working around it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101703&aid=1707054&group_id=1703 |