public void launchExplorer() { VisualExplorer exp = new VisualExplorer(domain, v, initialState); exp.addKeyAction("w", GridWorldDomain.ACTIONNORTH); exp.addKeyAction("s", GridWorldDomain.ACTIONSOUTH); exp.addKeyAction("d", GridWorldDomain.ACTIONEAST); exp.addKeyAction("a", GridWorldDomain.ACTIONWEST); StateParser sp = new GridWorldStateParser(this.domain); exp.enableEpisodeRecording("r", "f", new NullRewardFunction(), expertDir, sp); // final PuddleMapFVComponent fvg = new PuddleMapFVComponent(this.puddleMap, 5, 20, 20); final PuddleMapFV fvg = new PuddleMapFV(this.puddleMap, 5, 20, 20); ActionObserver obs = new ActionObserver() { @Override public void actionEvent(State s, GroundedAction ga, State sp) { double[] vec = fvg.generateFeatureVectorFrom(sp); System.out.println(Arrays.toString(vec)); } }; ((SADomain) this.domain).addActionObserverForAllAction(obs); exp.initGUI(); }
public static void main(String[] args) { ExampleGridWorld gen = new ExampleGridWorld(); Domain domain = gen.generateDomain(); State initialState = ExampleGridWorld.getExampleState(domain); // TerminalExplorer exp = new TerminalExplorer(domain); // exp.exploreFromState(initialState); Visualizer v = gen.getVisualizer(); VisualExplorer exp = new VisualExplorer(domain, v, initialState); exp.addKeyAction("w", ACTIONNORTH); exp.addKeyAction("s", ACTIONSOUTH); exp.addKeyAction("d", ACTIONEAST); exp.addKeyAction("a", ACTIONWEST); exp.initGUI(); }