Skip to content

Commit

Permalink
Merge pull request #29 from whoenig/issue28
Browse files Browse the repository at this point in the history
Add regression test for issue28
  • Loading branch information
whoenig committed Oct 11, 2021
2 parents d64c138 + 7d33df5 commit d3cfb64
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/cbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class Environment {
// This is a trick to avoid changing the rest of the code significantly
// After an agent disappeared, put it at a unique but invalid position
// This will cause all calls to equalExceptTime(.) to return false.
return State(-1 * agentIdx, -1, -1);
return State(-1, -1 * (agentIdx + 1), -1);
}
return solution[agentIdx].states.back().first;
}
Expand Down
2 changes: 1 addition & 1 deletion example/ecbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ class Environment {
// This is a trick to avoid changing the rest of the code significantly
// After an agent disappeared, put it at a unique but invalid position
// This will cause all calls to equalExceptTime(.) to return false.
return State(-1 * agentIdx, -1, -1);
return State(-1, -1 * (agentIdx+1), -1);
}
return solution[agentIdx].states.back().first;
}
Expand Down
17 changes: 17 additions & 0 deletions test/issue28.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
map:
dimensions: [4, 4]
obstacles:
- [0, 2]
- [0, 3]
- [1, 3]
- [3, 3]
agents:
- name: agent0
start: [1, 2]
goal: [3, 0]
- name: agent1
start: [3, 2]
goal: [2, 2]
- name: agent2
start: [2, 1]
goal: [0, 0]
4 changes: 4 additions & 0 deletions test/test_cbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,9 @@ def test_someAtGoal_disappearingAgents(self):
r = self.runCBS("../test/mapf_someAtGoal.yaml", additionalArgs=["--disappear-at-goal"])
self.assertTrue(r["statistics"]["cost"] == 1)

def test_issue28_disappearingAgents(self):
r = self.runCBS("../test/issue28.yaml", additionalArgs=["--disappear-at-goal"])
self.assertTrue(r["statistics"]["cost"] == 8)

if __name__ == '__main__':
unittest.main()
4 changes: 4 additions & 0 deletions test/test_ecbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@ def test_someAtGoal_disappearingAgents(self):
r = self.runECBS("../test/mapf_someAtGoal.yaml", 1.0, additionalArgs=["--disappear-at-goal"])
self.assertTrue(r["statistics"]["cost"] == 1)

def test_issue28_disappearingAgents(self):
r = self.runECBS("../test/issue28.yaml", 1.0, additionalArgs=["--disappear-at-goal"])
self.assertTrue(r["statistics"]["cost"] == 8)

if __name__ == '__main__':
unittest.main()

0 comments on commit d3cfb64

Please sign in to comment.