Skip to content

Commit

Permalink
Merge pull request #31 from whoenig/issue30
Browse files Browse the repository at this point in the history
Issue30
  • Loading branch information
whoenig committed Dec 7, 2021
2 parents d3cfb64 + 6fea197 commit b01a527
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: Build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
on: [push, pull_request]

jobs:
build:
Expand All @@ -17,6 +9,10 @@ jobs:
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
# Also test debug build, to find potential asserts when running tests
strategy:
matrix:
BUILD_TYPE: ["Release", "Debug"]

steps:
- uses: actions/checkout@v2
Expand All @@ -31,11 +27,11 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/build --config ${{matrix.BUILD_TYPE}}

- name: Test
run: make run-test
Expand Down
10 changes: 10 additions & 0 deletions example/cbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,16 @@ int main(int argc, char* argv[]) {
goals.emplace_back(Location(goal[0].as<int>(), goal[1].as<int>()));
}

// sanity check: no identical start states
std::unordered_set<State> startStatesSet;
for (const auto& s : startStates) {
if (startStatesSet.find(s) != startStatesSet.end()) {
std::cout << "Identical start states detected -> no solution!" << std::endl;
return 0;
}
startStatesSet.insert(s);
}

Environment mapf(dimx, dimy, obstacles, goals, disappearAtGoal);
CBS<State, Action, int, Conflict, Constraints, Environment> cbs(mapf);
std::vector<PlanResult<State, Action, int> > solution;
Expand Down
10 changes: 10 additions & 0 deletions example/cbs_ta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,16 @@ int main(int argc, char* argv[]) {
}
}

// sanity check: no identical start states
std::unordered_set<State> startStatesSet;
for (const auto& s : startStates) {
if (startStatesSet.find(s) != startStatesSet.end()) {
std::cout << "Identical start states detected -> no solution!" << std::endl;
return 0;
}
startStatesSet.insert(s);
}

Environment mapf(dimx, dimy, obstacles, startStates, goals,
maxTaskAssignments);
CBSTA<State, Action, int, Conflict, Constraints, Location, Environment>
Expand Down
10 changes: 10 additions & 0 deletions example/ecbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,16 @@ int main(int argc, char* argv[]) {
goals.emplace_back(Location(goal[0].as<int>(), goal[1].as<int>()));
}

// sanity check: no identical start states
std::unordered_set<State> startStatesSet;
for (const auto& s : startStates) {
if (startStatesSet.find(s) != startStatesSet.end()) {
std::cout << "Identical start states detected -> no solution!" << std::endl;
return 0;
}
startStatesSet.insert(s);
}

Environment mapf(dimx, dimy, obstacles, goals, disappearAtGoal);
ECBS<State, Action, int, Conflict, Constraints, Environment> ecbs(mapf, w);
std::vector<PlanResult<State, Action, int> > solution;
Expand Down
10 changes: 10 additions & 0 deletions example/ecbs_ta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,16 @@ int main(int argc, char* argv[]) {
}
}

// sanity check: no identical start states
std::unordered_set<State> startStatesSet;
for (const auto& s : startStates) {
if (startStatesSet.find(s) != startStatesSet.end()) {
std::cout << "Identical start states detected -> no solution!" << std::endl;
return 0;
}
startStatesSet.insert(s);
}

Environment mapf(dimx, dimy, obstacles, startStates, goals,
maxTaskAssignments);
ECBSTA<State, Action, int, Conflict, Constraints, Location,
Expand Down
3 changes: 3 additions & 0 deletions test/issue30.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{agents: [{goal: [0, 1], name: agent0, start: [3, 2]}, {goal: [0, 1], name: agent1,
start: [3, 2]}, {goal: [1, 3], name: agent2, start: [2, 0]}], map: {dimensions: [
4, 4], obstacles: []}}
4 changes: 4 additions & 0 deletions test/test_ecbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ def test_issue28_disappearingAgents(self):
r = self.runECBS("../test/issue28.yaml", 1.0, additionalArgs=["--disappear-at-goal"])
self.assertTrue(r["statistics"]["cost"] == 8)

def test_issue30(self):
r = self.runECBS("../test/issue30.yaml", 1.5)
# no need to check anything other than successful process termination

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

0 comments on commit b01a527

Please sign in to comment.