From: Nick C. <nic...@ve...> - 2010-09-29 12:58:32
|
The issue is most likely that the location of the agent passed to gridWithin + the distance passed is outside of the grid. I see you are using StrictBorders which are just that -- if any location is outside then you get that exception. Nick On Sep 29, 2010, at 7:16 AM, Trevize wrote: > Hello, i just started using Repast. > Right now i'm trying to make an agent count the number of agents in its > surroundings: > .... > // I create the grid in the context contructor > GridBuilderParameters params = > GridBuilderParameters.multiOccupancy2D(new > SimpleGridAdder<MyAgent>(),new StrictBorders(), 20, 20); > GridFactory factoryGrid = GridFactoryFinder.createGridFactory(new > HashMap()); > Grid grid = factoryGrid.createGrid("Grid2D", this, params); > .... > //Method in the MyAgent class > @Watch(watcheeClassName = "prova.MyAgent", > whenToTrigger = WatcherTriggerSchedule.IMMEDIATE, > watcheeFieldNames = "moved") > public void action(MeetingAgent agent) { > MyContext context=(MyContext)ContextUtils.getContext(this); > Grid<MyAgent> grid=(Grid<MyAgent>) > context.getProjection("Grid2D"); > Query<MyAgent> myQuery=new > GridWithin<MyAgent>(grid,this,5); // I position the agents though the > runtime gui > Iterable<MyAgent> itColl=myQuery.query(); > .... > } > > but i always get a SpatialException on the execution of the query method: > .... > Caused by: repast.simphony.space.SpatialException: Target location > 20 is outside of grid's dimensions. > ... > > Does anyone have any idea about what could be wrong? > > Thanks. > Trevize. > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Repast-interest mailing list > Rep...@li... > https://lists.sourceforge.net/lists/listinfo/repast-interest |