Skip to content

Commit

Permalink
[PCover] Update rl reward feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-goel committed Nov 8, 2023
1 parent abb3387 commit 8a4bb5a
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ public void updateIterationCoverage(
estimatedCoverage = estimatedCoverage.add(iterationCoverage);
// assert (estimatedCoverage.compareTo(BigDecimal.ONE) <= 0): "Error in path coverage
// estimation";
// if (rewardMode != ChoiceLearningRewardMode.None) {
// for (int i = startDepth; i <= choiceDepth; i++) {
// CoverageChoiceDepthStats stats = perChoiceDepthStats.get(i);
// if (stats != null) {
// PSymGlobal.getChoiceLearningStats()
// .rewardIteration(
// stats.getStateActions(), iterationCoverage.doubleValue(), rewardMode);
// }
// }
// }
if (rewardMode != ChoiceLearningRewardMode.None) {
for (int i = startDepth; i <= choiceDepth; i++) {
CoverageChoiceDepthStats stats = perChoiceDepthStats.get(i);
if (stats != null) {
PSymGlobal.getChoiceLearningStats()
.rewardIteration(
stats.getStateActions(), iterationCoverage.doubleValue(), rewardMode);
}
}
}
}

/** Reset coverage statistics after a resumed run */
Expand Down Expand Up @@ -345,7 +345,7 @@ boolean isNotEmpty() {
public static class CoverageChoiceDepthStats implements Serializable {
BigDecimal pathCoverage;
int numTotal;
// @Getter ChoiceQTable.ChoiceQTableKey stateActions;
@Getter ChoiceQTable.ChoiceQTableKey stateActions;

CoverageChoiceDepthStats() {
this(new BigDecimal(1), 0, new ChoiceQTable.ChoiceQTableKey());
Expand All @@ -361,7 +361,7 @@ private CoverageChoiceDepthStats(
ChoiceQTable.ChoiceQTableKey inputStateActions) {
this.pathCoverage = inputPathCoverage;
this.numTotal = inputNumTotal;
// this.stateActions = inputStateActions;
this.stateActions = inputStateActions;
}

void update(
Expand All @@ -382,15 +382,15 @@ void update(
BigDecimal.valueOf(numExplored)
.divide(BigDecimal.valueOf(numTotal), 20, RoundingMode.FLOOR));
}
// this.stateActions = chosenActions;
this.stateActions = chosenActions;
}

public void reset() {
pathCoverage = new BigDecimal(1);
numTotal = 0;
// if (stateActions != null) {
// stateActions.clear();
// }
if (stateActions != null) {
stateActions.clear();
}
}

public CoverageChoiceDepthStats getCopy() {
Expand Down

0 comments on commit 8a4bb5a

Please sign in to comment.