use of aima.core.environment.map.MapEnvironment in project aima-java by aimacode.
the class OsmLRTAStarAgentApp method simulate.
/** Starts the experiment. */
public void simulate() {
List<MapNode> markers = map.getOsmMap().getMarkers();
if (markers.size() < 2) {
simPaneCtrl.setStatus("Error: Please set two markers with mouse-left.");
} else {
List<String> locations = new ArrayList<>(markers.size());
for (MapNode node : markers) {
Point2D pt = new Point2D(node.getLon(), node.getLat());
locations.add(map.getNearestLocation(pt));
}
Agent agent = createAgent(locations);
env = new MapEnvironment(map);
env.addEnvironmentView(new TrackUpdater());
env.addAgent(agent, locations.get(0));
while (!env.isDone() && !CancelableThread.currIsCanceled()) {
env.step();
simPaneCtrl.waitAfterStep();
}
}
}
Aggregations