Skip to content

Commit

Permalink
Add regenerated nodes metric. Low level only.
Browse files Browse the repository at this point in the history
  • Loading branch information
J-morag committed Oct 23, 2024
1 parent 15bf47f commit 4240bea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/BasicMAPF/Solvers/A_Solver.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract class A_Solver implements I_Solver{
protected long endTime;
protected boolean abortedForTimeout;
protected int totalLowLevelNodesGenerated;
protected int totalLowLevelNodesRegenerated;
protected int totalLowLevelNodesExpanded;
protected int totalLowLevelTimeMS;
protected int totalLowLevelCalls;
Expand Down Expand Up @@ -87,6 +88,7 @@ protected void init(MAPF_Instance instance, RunParameters parameters){
this.generatedNodes = 0;

this.totalLowLevelNodesGenerated = 0;
this.totalLowLevelNodesRegenerated = 0;
this.totalLowLevelNodesExpanded = 0;
this.totalLowLevelTimeMS = 0;
this.totalLowLevelCalls = 0;
Expand All @@ -105,6 +107,8 @@ protected void init(MAPF_Instance instance, RunParameters parameters){
protected void digestSubproblemReport(InstanceReport subproblemReport) {
Integer statesGenerated = subproblemReport.getIntegerValue(InstanceReport.StandardFields.generatedNodesLowLevel);
this.totalLowLevelNodesGenerated += statesGenerated==null ? 0 : statesGenerated;
Integer statesRegenerated = subproblemReport.getIntegerValue(InstanceReport.StandardFields.regeneratedNodesLowLevel);
this.totalLowLevelNodesRegenerated += statesRegenerated==null ? 0 : statesRegenerated;
Integer statesExpanded = subproblemReport.getIntegerValue(InstanceReport.StandardFields.expandedNodesLowLevel);
this.totalLowLevelNodesExpanded += statesExpanded==null ? 0 : statesExpanded;
Integer totalLowLevelTimeMS = subproblemReport.getIntegerValue(InstanceReport.StandardFields.elapsedTimeMS);
Expand Down Expand Up @@ -147,6 +151,7 @@ protected void writeMetricsToReport(Solution solution){
instanceReport.putIntegerValue(InstanceReport.StandardFields.totalLowLevelTimeMS, this.totalLowLevelTimeMS);
instanceReport.putIntegerValue(InstanceReport.StandardFields.generatedNodesLowLevel, this.totalLowLevelNodesGenerated);
instanceReport.putFloatValue(InstanceReport.StandardFields.generationRateLowLevel,(float) this.totalLowLevelNodesGenerated / ((float) (this.totalLowLevelTimeMS) / 1000f));
instanceReport.putIntegerValue(InstanceReport.StandardFields.regeneratedNodesLowLevel, this.totalLowLevelNodesRegenerated);
instanceReport.putIntegerValue(InstanceReport.StandardFields.expandedNodesLowLevel, this.totalLowLevelNodesExpanded);
instanceReport.putFloatValue(InstanceReport.StandardFields.expansionRateLowLevel, (float) this.totalLowLevelNodesExpanded / ((float) (this.totalLowLevelTimeMS) / 1000f));
instanceReport.putIntegerValue(InstanceReport.StandardFields.totalLowLevelCalls, this.totalLowLevelCalls);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/Environment/Metrics/InstanceReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static class StandardFields{
public final static String expandedNodesLowLevel = "Expanded Nodes (Low Level)";
public final static String expandedNodes = "Expanded Nodes (High Level)";
public final static String generatedNodesLowLevel = "Generated Nodes (Low Level)";
public final static String regeneratedNodesLowLevel = "Regenerated Nodes (Low Level)";
public final static String generatedNodes = "Generated Nodes (High Level)";
public final static String startDateTime = "Start Date";
public final static String endDateTime = "End Date";
Expand Down

0 comments on commit 4240bea

Please sign in to comment.