// Test public void pickMoveHanoi() { ExpressionList gameRules = Parser.parseFile("./testdata/games/Hanoi.kif"); logger.info("" + gameRules); game = manager.getGameByGDL(gameRules.toString()); singlePlayerFuzzySearch = new SinglePlayerSearch(game, "player"); logger.info("=== Hanoi ==="); Expression aMove = singlePlayerFuzzySearch.pickMove(game.getInitialNode()); assertNotNull(aMove); assertTrue(aMove instanceof Predicate); logger.info("picked move: " + aMove); // Atom light = (Atom) ((Predicate) aMove).getOperands().get( 1 ); // assertEquals ( aA, light ); }
// Test public void pickMoveButtonsLights() { ExpressionList gameRules = Parser.parseFile("./testdata/buttons_lights.kif"); logger.info("" + gameRules); game = manager.getGameByGDL(gameRules.toString()); singlePlayerFuzzySearch = new SinglePlayerFuzzySearch(game, "robot", new StubMixin(), new TimerFlag()); logger.info("=== Button lights ==="); Expression aMove = singlePlayerFuzzySearch.pickMove(game.getInitialNode()); assertNotNull(aMove); assertTrue(aMove instanceof Predicate); Atom light = (Atom) ((Predicate) aMove).getOperands().get(1); assertEquals(aA, light); logger.info(aMove); }
/** * Use the conflict ordering search as a pluggin to improve a former search heuristic Should be * set after specifying a search strategy. * * @return last conflict strategy */ public static AbstractStrategy conflictOrderingSearch(AbstractStrategy formerSearch) { return new ConflictOrderingSearch<>(formerSearch.getVariables()[0].getModel(), formerSearch); }
/** * Use the last conflict heuristic as a pluggin to improve a former search heuristic Should be set * after specifying a search strategy. * * @param k the maximum number of conflicts to store * @return last conflict strategy */ public static AbstractStrategy lastConflict(AbstractStrategy formerSearch, int k) { return new LastConflict(formerSearch.getVariables()[0].getModel(), formerSearch, k); }