Implemented agent which chooses to play winning, losing or random moves by solving a simplified MDP model of the game using policy iteration.

Portions of MDP/solver code by Ciaran O'Reilly and Ravi Mohan used under MIT license.
This commit is contained in:
Woody Folsom
2012-04-30 13:35:40 -04:00
parent c06f7ab38e
commit d0ee1e647b
35 changed files with 2500 additions and 3 deletions

View File

@@ -0,0 +1,26 @@
package model.mdp;
import static org.junit.Assert.assertTrue;
import model.mdp.MDP.MODE;
import org.junit.Test;
public class ValueIterationSolverTest {
@Test
public void testSolve() {
MDPSolver solver = new ValueIterationSolver();
//solve for a score of 25 in at most 35 turns
int maxScore = 6;
int maxTurns = 10;
MDP mdp = new MDP(maxScore,maxTurns,MODE.CEIL);
Policy policy = solver.solve(mdp);
assertTrue(policy.size() >= maxScore);
assertTrue(policy.size() <= maxTurns);
System.out.println("Policy: " + policy);
}
}