From: Michel N. <mic...@gm...> - 2007-02-26 15:48:13
|
Miles, I changed *if* ( k==weight) by *if* ( k>=weight). It functions correctly. Thank's Best regrards. Michel On 2/26/07, Miles Parker <mil...@gm...> wrote: > > > > cc'ing to list.. > > > I think there are simply logic issues w/ code. With a quick look I think > that the issue is that you are grabbing nextNode every period and testing > k==weight (fragile, k>=weight prob. better). So anytime you grab a series of > nextNode in a way that k is allowed to be > then the node distance then you > never have this condition met. > > On Feb 26, 2007, at 10:10 AM, Michel Nabaa wrote: > > Miles, > Thank you for your help, > I will post my "little" experience on the r interest. > I think a missunderstood was happend. > My model runs correctly for 30 steps and the vehicules don't move after. > I don't know why the scheduler works correctly for 30 steps and doesn't do > > that correctly after. In fact, after 30 steps (31,32,33.......), my > vehicules do not continue any more > to move form a node to an adjacent another !!!??? > > Regards, > > Michel > > > > On 2/26/07, Miles Parker <mil...@gm...> wrote: > > > > > > > > Excellent -- please post experience to r-interest? The _more_ stable > > version is in the next couple of weeks.. > > > > On Feb 26, 2007, at 7:03 AM, Michel Nabaa wrote: > > > > Hi , > > > > long k; > > * > > > > public > > *Vehicule(){ > > > > k=0; > > > > } > > > > > > > > @ScheduledMethod > > (start = 1,interval = 1) > > *public* *void* step() { > > k = k+1; > > > > Context context = ContextUtils.*getContext*( > > *this*); > > > > ContinuousSpace space = (ContinuousSpace) context.getProjection( > > "Continuous Space"); > > > > Network network = (Network) context.getProjection( > > "A Network"); > > > > Node nextNode = (Node)network.getRandomAdjacent( > > node); > > > > weight = getEdgeWeight(network,node,nextNode); > > > > // weight = 5; > > > > NdPoint pt = space.getLocation(nextNode); > > > > > > *if* ( k==weight ) > > > > { > > > > > > space.moveTo(*this*,0,(*float*)pt.getY(),( *float*)(pt.getZ()+Math.* > > random*())); > > > > *this*.node = nextNode; > > > > k=0; > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > } > > my model runs correctly for 30 steps and the vehicules stop after. > > If i do weight = constant (5 for ex), my model runs correctly. > > Thank's for your help. > > Moreover, i wanna know, please when the simphony stable version will be > > available? > > > > Michel > > > > > > > > On 2/23/07, Miles Parker <mil...@gm... > wrote: > > > > > > > > > > > > Hi Michel, > > > > > > > > > Yes, personally I would use Repast J if my work was critical and > > > dependent on it. I think we made it pretty clear that the release version is > > > very early alpha. We should have a newer version real soon now, but I would > > > not plan on it solving your current issues or to be frank having much better > > > docs. That said, if you continue with Simphony, I think you would be best > > > off using the approach described by Nick and myself, e.g. > > > > > > > > > > > > Another way to do this would be to take a state approach, where every > > > agent is always say "IDLE" or "MOVING" and then you have a scheduled method > > > activated every period that checks movement status, updates some count and > > > when it reaches the time between nodes, moves the agent. This is sort of the > > > time-step/rules based approach ( e.g. a lo of social science > > > ABMs/Ascape) and is simpler but less efficient for cases where there may be > > > long durations between nodes. (The schedule approach doesn't have to "visit" > > > every agent every tick.) > > > > > > > > > > > > > > > On Feb 23, 2007, at 12:45 PM, Michel Nabaa wrote: > > > > > > I tried your method but it does not function even when i look in the > > > API doc. > > > you developped many classes for scheduling, but i don't know if i > > > schedule > > > the operations in my context class as in repastJ, you haven't any demo > > > about this... because, with annotations, i can't schedule my actions > > > dynamically. > > > I find simphony very good, but not documented until the moment. > > > I don't know what i must do!!! i prepare my phd thesis and i am > > > interested to > > > repast especially simphony version. I help that it will be more stable > > > and documented as soon as possible. > > > Is it a good idea to return to repast j (many users advises me to do > > > that) ?? > > > is there a good graph library as in simphony? > > > Can i do the same as in repast j in simphony?? > > > simphony will stay alpha1 until when????? > > > > > > I need your help, please. > > > I lose much time on this. > > > > > > Michel > > > > > > > > > On 2/23/07, Miles Parker <mil...@gm... > wrote: > > > > > > > > > > > > > > > > Michel, > > > > > > > > > > > > Java annotations are static so you would never be able to do a > > > > dynamic schedule exactly like this. In that sense annotations are really > > > > just a convenience. Also, don't you really want your start time to be the > > > > time that the move occurs (t + weight) and duration to be 1? > > > > > > > > > > > > You can look throguh the api, and perhaps someone can suggest some > > > > example code or a better approach, but there are lots of ways to do this, > > > > for example something like.. > > > > > > > > > > > > final Vehicle v = ... > > > > ISchedule s = RunEnvironment.getInstance().getCurrentSchedule(); > > > > ScheduleParameters p = ScheduleParameters.createOneTime( > > > > s.getTickCount()); > > > > s.schedule(p, new IAction() { > > > > public void execute() { > > > > v.moveTo([targetNode]); > > > > } > > > > }); > > > > > > > > > > > > wanring, I haven't actually compiled or tested this.. > > > > > > > > > > > > Another way to do this would be to take a state approach, where > > > > every agent is always say "IDLE" or "MOVING" and then you have a scheduled > > > > method activated every period that checks movement status, updates some > > > > count and when it reaches the time between nodes, moves the agent. This is > > > > sort of the time-step/rules based approach ( e.g. a lo of social > > > > science ABMs/Ascape) and is simpler but less efficient for cases where there > > > > may be long durations between nodes. (The schedule approach doesn't have to > > > > "visit" every agent every tick.) > > > > > > > > > > > > > > > > On Feb 23, 2007, at 5:06 AM, Michel Nabaa wrote: > > > > > > > > hi all, > > > > > > > > in my model, i have two projections : network and continuous space > > > > and two kinds of agents: > > > > 1 node agents > > > > 2 vehicule agents. > > > > > > > > the weight on a edge between two nodes corresponds to time for > > > > moving between these nodes. > > > > A vehicule agent must move from a node to other node with respect to > > > > the weight of the edge. > > > > When i do > > > > > > > > @ScheduledMethod > > > > (duration = weight,start = 1, interval = 1), i obtain this error : > > > > > > > > The value for annotation attribute ScheduledMethod.duration must be > > > > a constant expression. > > > > > > > > Any one can help me, please? > > > > > > > > Regards > > > > > > > > Michel > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > Join SourceForge.net's Techsay panel and you'll get the chance to > > > > share your > > > > opinions on IT & business topics through brief surveys-and earn cash > > > > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________ > > > > Repast-interest mailing list > > > > Rep...@li... > > > > https://lists.sourceforge.net/lists/listinfo/repast-interest > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |