Coder Social home page Coder Social logo

Comments (4)

jozik avatar jozik commented on September 28, 2024

If you just want to re-import the tutorial model, you could delete what you have in your workspace and re-import it. If you need to download the sample models again, here's the link for those.

To better understand the error's cause, you'd need to post, e.g., the ContextBuilder you've created.

from repast.simphony.

AChammas avatar AChammas commented on September 28, 2024

Hi,

Thanks for the link I will look into the examples and compare them with what I've written. Here is the jzombies context builder I wrote that is throwing the errors mentioned above:

package jzombies;

import repast.simphony.context.Context;
import repast.simphony.context.space.continuous.ContinuousSpaceFactory;
import repast.simphony.context.space.continuous.ContinuousSpaceFactoryFinder;
import repast.simphony.context.space.grid.GridFactory;
import repast.simphony.context.space.grid.GridFactoryFinder;
import repast.simphony.dataLoader.ContextBuilder;
import repast.simphony.random.RandomHelper;
import repast.simphony.space.continuous.ContinuousSpace;
import repast.simphony.space.continuous.NdPoint;
import repast.simphony.space.continuous.RandomCartesianAdder;
import repast.simphony.space.grid.Grid;
import repast.simphony.space.grid.GridBuilderParameters;
import repast.simphony.space.grid.SimpleGridAdder;
import repast.simphony.space.grid.WrapAroundBorders;

public class JZombiesBuilder implements ContextBuilder {

@Override
public Context build(Context<Object> context) {

	context.setId("jzombies");
	
	ContinuousSpaceFactory spaceFactory = 
			ContinuousSpaceFactoryFinder.createContinuousSpaceFactory(null);
	ContinuousSpace<Object> space =
			spaceFactory.createContinuousSpace("space", context,
					new RandomCartesianAdder<Object>(), 
					new repast.simphony.space.continuous.WrapAroundBorders(),
					50, 50);
	
	GridFactory gridFactory = GridFactoryFinder.createGridFactory(null);
	Grid<Object> grid = gridFactory.createGrid("grid", context,
			new GridBuilderParameters<Object>(new WrapAroundBorders(),
					new SimpleGridAdder<Object>(),
					true, 50, 50));
	
	int zombieCount = 5;
	for(int i = 0; i<zombieCount;i++) {
		context.add(new Zombie(space, grid));
	}
	int humanCount = 100;
	for (int i = 0; i < humanCount; i++) {
		int energy = RandomHelper.nextIntFromTo(4, 10);
		context.add(new Human(space, grid, energy));	
	}
	for(Object obj:context) {
		NdPoint pt = space.getLocation(obj);
		grid.moveTo(obj, (int)pt.getX(), (int)pt.getY());
	}
	
	return context;
}

}

from repast.simphony.

AChammas avatar AChammas commented on September 28, 2024

I tested out the JZombies_Demo model and it worked out fine, the issue I have seems to be because of the DataLoader.. the builders aren't appearing as options when I choose set data loaders even in the JZombies_Demo model.
The error I get is after choosing context.xml as the data source type and it appears that way even with the JZombies_Demo model if chose context.xml when setting my data loader.. could this be due to the illegal reflective access warning?

Thanks for your help.

from repast.simphony.

AChammas avatar AChammas commented on September 28, 2024

Ah nevermind, I found myerror, I was setting context.xml when I should have used custom context builder.

from repast.simphony.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.