Skip to content

Commit

Permalink
Merge pull request #72 from dityas/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dityas authored Mar 26, 2020
2 parents 37a6a04 + 6daa3e0 commit 8737f4b
Show file tree
Hide file tree
Showing 45 changed files with 2,488 additions and 1,165 deletions.
Binary file modified Protos/build/Protos.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Protos/domains/tiger.L1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ discount 0.9
tolerance 0.001

(frames
(frame 0 level 0
(frame 0 level 0 def
(variables
(tiger-location tiger-left tiger-right))

Expand Down
4 changes: 2 additions & 2 deletions Protos/domains/tiger.L1multiple_new_parser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ discount 0.9
tolerance 0.001

(frames
(frame 0 level 0
(frame 0 level 0 def
(variables
(tiger-location tiger-left tiger-right))

Expand Down Expand Up @@ -197,7 +197,7 @@ tolerance 0.001
tolerance 0.001
)

(frame 1 level 0
(frame 1 level 0 def
(variables
(tiger-location tiger-left tiger-right))

Expand Down
28 changes: 25 additions & 3 deletions Protos/src/thinclab/belief/SSGABeliefExpansion.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package thinclab.belief;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

Expand Down Expand Up @@ -49,6 +48,7 @@ public class SSGABeliefExpansion extends BeliefRegionExpansionStrategy {

/* number of iterations of SSGA during each expansion */
private int nIterations;
private int maxBeliefs = 500;

private static final Logger LOGGER = Logger.getLogger(SSGABeliefExpansion.class);

Expand Down Expand Up @@ -81,6 +81,7 @@ public SSGABeliefExpansion(POMDP p, int maxDepth, int iterations) {
this.exploredBeliefs.addAll(fb.getBeliefPoints());

fb = null;
this.maxBeliefs = 500;

LOGGER.debug("SSGA expansion search initialized");
}
Expand All @@ -102,6 +103,8 @@ public SSGABeliefExpansion(IPOMDP ip, int iterations) {

this.exploredBeliefs = new HashSet<DD>();
this.exploredBeliefs.addAll(this.initialBeliefs);

this.maxBeliefs = 200;
}

// ----------------------------------------------------------------------------------------
Expand Down Expand Up @@ -192,8 +195,27 @@ public void expand() {

}

if (minDist > 0.01)
this.exploredBeliefs.add(nextBelief);
if (minDist > 0.01) {

if (this.exploredBeliefs.size() < this.maxBeliefs) {
this.exploredBeliefs.add(nextBelief);
}

else {

LOGGER.warn("Max beliefs limit reached. stopping.");
break;
// DD beliefToRemove = null;
//
// for (DD belToRemove: this.exploredBeliefs) {
// beliefToRemove = belToRemove;
// break;
// }
//
// this.exploredBeliefs.remove(beliefToRemove);
// this.exploredBeliefs.add(nextBelief);
}
}
}

belief = nextBelief;
Expand Down
15 changes: 15 additions & 0 deletions Protos/src/thinclab/belief/SparseFullBeliefExpansion.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class SparseFullBeliefExpansion extends FullBeliefExpansion {
*/

private int nIters = 30;
private int maxBeliefs = 200;

private static final long serialVersionUID = 1571517162981801344L;

Expand Down Expand Up @@ -120,6 +121,20 @@ public void expandSingleStep() {
if (nextBelief == null) continue;

if (!this.exploredBeliefs.contains(nextBelief)) {

if (this.exploredBeliefs.size() > this.maxBeliefs) {

LOGGER.warn("Max beliefs limit reached, stopping");
break;
// DD beliefToRemove = null;
// for (DD belToRemove: this.exploredBeliefs) {
// beliefToRemove = belToRemove;
// break;
// }
//
// this.exploredBeliefs.remove(beliefToRemove);
}

this.exploredBeliefs.add(nextBelief);
newLeaves.add(nextBelief);
}
Expand Down
6 changes: 6 additions & 0 deletions Protos/src/thinclab/decisionprocesses/DecisionProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ public abstract class DecisionProcess implements Serializable {
public abstract void step(DD belief, String action, String[] obs) throws Exception;
public abstract void setTi(String action, DD[] Ti);
public abstract int getNumVars();

public abstract double evaluatePolicy(
DD[] alphaVectors, int[] policy, int trials, int evalDepth, boolean verbose);

public abstract double evaluateDefaultPolicy(
String defaultAction, int trials, int evalDepth, boolean verbose);

public abstract double evaluateRandomPolicy(int trials, int evalDepth, boolean verbose);

// ---------------------------------------------------------------------------------

public static String getActionFromPolicy(
Expand Down
Loading

0 comments on commit 8737f4b

Please sign in to comment.