@Test public void testLP() throws SAXException, ParserConfigurationException, IOException { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); SymmetricGameHandler handler = new SymmetricGameHandler(); parser.parse( new GZIPInputStream( SymmetricConstrainedReplicatorDynamicsTest.class.getResourceAsStream( "/tac-travel.xml.gz")), handler); SymmetricGame game = handler.getGame(); SymmetricConstrainedReplicatorDynamics rd = new SymmetricConstrainedReplicatorDynamics(1e-9, 100); Action[] actions = game.getActions().toArray(new Action[0]); Set<Action> restricted = new HashSet<Action>(); for (int i = 0; i < 5; i++) { restricted.add(actions[i]); } Strategy strategy = rd.run(game, null, restricted); assertNotNull(strategy); }
protected FormationSearchNode<SymmetricGame, Set<Action>> createNode(Set<Action> strategySpace) { SymmetricGame game = new ActionReducedSymmetricGame(getBase(), strategySpace); int total = calculateGameSize(strategySpace.size(), game.players().size()); double epsilon = rationalizableFinder.rationalizableEpsilon(game, getBase()); epsilon = Math.round(epsilon / tolerance) * tolerance; FormationSearchNode<SymmetricGame, Set<Action>> node = new FormationSearchNode<SymmetricGame, Set<Action>>(game, strategySpace, epsilon, total); return node; }
public SymmetricBreadthFirstFormationSearch( SymmetricGame base, SymmetricRationalizableFinder rationalizableFinder, int maxQueueSize, double tolerance) { super(base, maxQueueSize); this.rationalizableFinder = rationalizableFinder; this.tolerance = tolerance; actions = base.getActions().toArray(new Action[0]); }