public void mctsSearch(int its) { for (int i = 0; i < its; i++) { SimpleTreeNode selected = ParetoTreePolicy(); double[] delta = selected.rollOut(); pa.add(new Solution(delta)); //Add the result of the new tree walk to the pareto front (it checks for dominance) selected.backUp(delta); } }
public SimpleTreeNode(Playfield state, SimpleTreeNode parent, RandomRoller RandomRoller, ParetoTreePolicy ParetoTreePolicy, ParetoMCTSPlayer a_ParetoMCTSPlayer) { this.m_ParetoMCTSPlayer = a_ParetoMCTSPlayer; this.parent = parent; children = new SimpleTreeNode[ParetoMCTSController.NUM_ACTIONS]; totValue = new double[ParetoMCTSParameters.NUM_TARGETS]; this.RandomRoller = RandomRoller; this.paretoTreePolicy = ParetoTreePolicy; // System.out.println("Made a TreeNode of depth " + depth() + ", arity " + children.Length); }
public SimpleTreeNode ParetoTreePolicy() { SimpleTreeNode cur = this; while (cur.nonTerminal() && !cur.state.isEnded()) { if (cur.notFullyExpanded()) { return(cur.expand()); } else { cur = cur.bestChild(); } // System.out.println("cur = " + cur); } return(cur); }
public SimpleTreeNode expand() { // choose a random unused action and add a new node for that int bestAction = -1; double bestValue = -1; for (int i = 0; i < children.Length; i++) { double x = r.NextDouble(); if (x > bestValue && children[i] == null) { bestAction = i; bestValue = x; } } Playfield nextState = new Playfield(state); nextState.tick(bestAction); SimpleTreeNode tn = new SimpleTreeNode(nextState, this, this.RandomRoller, this.paretoTreePolicy, this.m_ParetoMCTSPlayer); children[bestAction] = tn; return(tn); }
public SimpleTreeNode expand() { // choose a random unused action and add a new node for that int bestAction = -1; double bestValue = -1; for (int i = 0; i < children.Length; i++) { double x = r.NextDouble(); if (x > bestValue && children[i] == null) { bestAction = i; bestValue = x; } } Playfield nextState = new Playfield(state); nextState.tick(bestAction); SimpleTreeNode tn = new SimpleTreeNode(nextState, this, this.RandomRoller, this.paretoTreePolicy, this.m_ParetoMCTSPlayer); children[bestAction] = tn; return tn; }