diff --git a/Protos/build/Protos.jar b/Protos/build/Protos.jar index 541ca068..061c0981 100644 Binary files a/Protos/build/Protos.jar and b/Protos/build/Protos.jar differ diff --git a/Protos/src/thinclab/belief/SSGABeliefExpansion.java b/Protos/src/thinclab/belief/SSGABeliefExpansion.java index 18f953ae..a19ae591 100644 --- a/Protos/src/thinclab/belief/SSGABeliefExpansion.java +++ b/Protos/src/thinclab/belief/SSGABeliefExpansion.java @@ -65,12 +65,20 @@ public SSGABeliefExpansion(POMDP p, int maxDepth, int iterations) { this.allPossibleObs = this.p.getAllPossibleObservations(); this.nIterations = iterations; - /* add initial beliefs from the POMDP */ + /* + * Run a full belief expansion for 3 time steps to facilitate proper exploration + */ + + FullBeliefExpansion fb = new FullBeliefExpansion(this.p, 3); + fb.expand(); + this.initialBeliefs = new ArrayList
(); this.initialBeliefs.addAll(this.p.getInitialBeliefs()); this.exploredBeliefs = new HashSet
(); - this.exploredBeliefs.addAll(this.p.getInitialBeliefs()); + this.exploredBeliefs.addAll(fb.getBeliefPoints()); + + fb = null; logger.debug("SSGA expansion search initialized"); } diff --git a/Protos/src/thinclab/representations/StructuredTree.java b/Protos/src/thinclab/representations/StructuredTree.java index 5fb78811..9097dd7e 100644 --- a/Protos/src/thinclab/representations/StructuredTree.java +++ b/Protos/src/thinclab/representations/StructuredTree.java @@ -287,15 +287,29 @@ public static String jsonBeliefStringToDotNode(String beliefString, String actio for (JsonElement mj: mjArray) { /* convert to JSON object */ - JsonObject mjJSON = mj.getAsJsonObject(); + JsonObject mjJSON = mj.getAsJsonObject(); + + JsonObject mjBeliefMap = + mjJSON.get("model") + .getAsJsonObject() + .get("belief_j") + .getAsJsonObject(); + + /* Print each belief on a new line for Mj */ + String mjString = ""; + + for (String state : mjBeliefMap.keySet()) + mjString += + state + + seperator + + gsonHandler.toJson(mjBeliefMap.get(state)) + .replace("{", "(") + .replace("}", ")") + + seperator; dotString += seperator + "{" + - "{" + gsonHandler.toJson( - mjJSON.get("model").getAsJsonObject().get("belief_j")) - .replace("{", "(") - .replace("}", ")") - + "{" + mjString + seperator + gsonHandler.toJson( mjJSON.get("model").getAsJsonObject().get("A_j")) + seperator + gsonHandler.toJson( diff --git a/Protos/src/thinclab/tests/TestBeliefExpansionStartegies.java b/Protos/src/thinclab/tests/TestBeliefExpansionStartegies.java index 27cbbd35..a1111d70 100644 --- a/Protos/src/thinclab/tests/TestBeliefExpansionStartegies.java +++ b/Protos/src/thinclab/tests/TestBeliefExpansionStartegies.java @@ -95,7 +95,7 @@ void testSSGABeliefExpansion() { LOGGER.info("Testing initial beliefs"); List
beliefs0 = ssgaBE.getBeliefPoints(); - assertTrue(beliefs0.size() == this.pomdp.getInitialBeliefs().size()); + assertTrue(beliefs0.size() >= this.pomdp.getInitialBeliefs().size()); LOGGER.info("Testing policy based expansion"); LOGGER.info("computing policy..."); diff --git a/Protos/src/thinclab/tests/TestIPOMDP.java b/Protos/src/thinclab/tests/TestIPOMDP.java index 2d55954d..b0f3b4db 100644 --- a/Protos/src/thinclab/tests/TestIPOMDP.java +++ b/Protos/src/thinclab/tests/TestIPOMDP.java @@ -562,7 +562,7 @@ void testIPOMDPsteppingSingleFrame() throws Exception { Random rand = new Random(); /* run for 100 iters */ - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 5; i++) { List actions = ipomdp.getActions(); String action = actions.get(rand.nextInt(actions.size())); @@ -700,7 +700,7 @@ void testIPOMDPstepping2Frames() throws Exception { Random rand = new Random(); /* run for 100 iters */ - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 5; i++) { List actions = ipomdp.getActions(); String action = actions.get(rand.nextInt(actions.size()));