use of aima.core.util.math.geom.shapes.Point2D in project aima-java by aimacode.
the class OsmAgentBaseApp method simulate.
/** Starts the experiment. */
public void simulate() {
List<MapNode> markers = map.getOsmMap().getMarkers();
if (markers.size() < 2) {
simPaneCtrl.setStatus("Error: Please set at least 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 = createEnvironment();
env.addEnvironmentView(new TrackUpdater());
env.addAgent(agent, locations.get(0));
if (simPaneCtrl.getParam(PARAM_SEARCH).isPresent())
env.notifyViews("Using " + simPaneCtrl.getParamValue(PARAM_SEARCH));
while (!env.isDone() && !CancelableThread.currIsCanceled()) {
env.step();
simPaneCtrl.waitAfterStep();
}
envViewCtrl.notify("");
// simPaneCtrl.setStatus(search.getMetrics().toString());
}
}
use of aima.core.util.math.geom.shapes.Point2D 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