Skip to content

Commit 1d1cd83

Browse files
committed
default planner namespace rename to DefaultPlanner
re organise python interface code layout and adjust set_track
1 parent 56ee774 commit 1d1cd83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+96
-91247
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ local
55
test.json
66
test.txt
77
.DS_Store
8+
python/tmp

CMakeLists.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,22 @@ include_directories( ${Boost_INCLUDE_DIRS} )
4040

4141

4242
IF(PYTHON)
43-
include_directories("python")
4443
message(STATUS "Python support is enabled")
4544

4645
find_package(pybind11 REQUIRED)
4746
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ version selection")
4847

48+
# check if python/tmp exists, raise an error if it does not
49+
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/python/tmp")
50+
message(FATAL_ERROR "Track is not configured for python bindings. Please run python/set_track.bash <combined|planner|scheduler> to configure the track before compiling.")
51+
endif()
52+
53+
include_directories("python/tmp")
4954

50-
pybind11_add_module(MAPF "./src/Grid.cpp" "./src/States.cpp" "./python/MAPFbinding.cpp")
55+
pybind11_add_module(MAPF "./src/Grid.cpp" "./src/States.cpp" "./python/tmp/MAPFbinding.cpp")
5156
target_link_libraries(MAPF PRIVATE )
5257

53-
file(GLOB PY_SOURCES "python/*.cpp")
58+
file(GLOB PY_SOURCES "python/tmp/*.cpp")
5459
list(FILTER PY_SOURCES EXCLUDE REGEX ".*python/MAPFbinding\.cpp")
5560

5661
add_executable(lifelong ${PY_SOURCES} ${SOURCES})

RunInDocker.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ echo "Remove container and images if exist... ..."
4545
out=$(docker container stop mapf_test 2>&1 ; docker container rm mapf_test 2>&1 ; docker rmi mapf_image 2>&1)
4646

4747
echo "Build image and run the container... ..."
48+
4849
docker build --no-cache -t mapf_image ./
4950

50-
docker container run -it --gpus all --name mapf_test mapf_image
51+
# check if gpu is available
52+
if nvidia-smi &> /dev/null; then
53+
echo "GPU is available."
54+
docker container run -it --gpus all --name mapf_test mapf_image
55+
else
56+
echo "GPU is not available."
57+
docker container run -it --name mapf_test mapf_image
58+
fi
5159

apt.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
cmake
12
build-essential
23
libboost-all-dev
34
python3-dev

compile.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mkdir build
44

55
# build exec for cpp
66

7-
cmake -B build ./ -DCMAKE_BUILD_TYPE=Release
7+
cmake -B build ./ -DPYTHON=false -DCMAKE_BUILD_TYPE=Release
88
make -C build -j
99

1010

default_planner/Memory.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "search_node.h"
88

9-
namespace TrafficMAPF{
9+
namespace DefaultPlanner{
1010

1111
class MemoryPool
1212
{

default_planner/TrajLNS.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <set>
1212

13-
namespace TrafficMAPF{
13+
namespace DefaultPlanner{
1414
// enum ADAPTIVE {RANDOM, CONGESTION, COUNT};
1515
enum ADAPTIVE {RANDOM, CONGESTION, DEVIATION, COUNT};
1616

default_planner/Types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "SharedEnv.h"
1717
#include "ActionModel.h"
1818

19-
namespace TrafficMAPF{
19+
namespace DefaultPlanner{
2020

2121

2222
enum DONE{

default_planner/flow.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <random>
77
#include <unordered_set>
88

9-
namespace TrafficMAPF{
9+
namespace DefaultPlanner{
1010

1111
std::mt19937 g(0);
1212

default_planner/flow.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <random>
1010
#include <unordered_set>
1111

12-
namespace TrafficMAPF{
12+
namespace DefaultPlanner{
1313

1414
//remove flow for each location's outgoing edge according to the traj
1515
void remove_traj(TrajLNS& lns, int agent);

default_planner/heap.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <cassert>
1919
#include <iostream>
2020

21-
namespace TrafficMAPF{
21+
namespace DefaultPlanner{
2222

2323

2424
struct min_q

default_planner/heuristics.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "heuristics.h"
33
#include <queue>
44

5-
namespace TrafficMAPF{
5+
namespace DefaultPlanner{
66

77
std::vector<HeuristicTable> global_heuristictable;
88
Neighbors global_neighbors;

default_planner/heuristics.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "TrajLNS.h"
99
#include "search_node.h"
1010

11-
namespace TrafficMAPF{
11+
namespace DefaultPlanner{
1212

1313
void init_heuristics(SharedEnvironment* env);
1414

default_planner/pibt.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99

10-
namespace TrafficMAPF{
10+
namespace DefaultPlanner{
1111

1212
bool causalPIBT(int curr_id, int higher_id,std::vector<State>& prev_states,
1313
std::vector<State>& next_states,

default_planner/pibt.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818

19-
namespace TrafficMAPF{
19+
namespace DefaultPlanner{
2020

2121

2222
bool causalPIBT(int curr_id, int higher_id,std::vector<State>& prev_states,

default_planner/planner.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "flow.h"
66

77

8-
namespace TrafficMAPF{
8+
namespace DefaultPlanner{
99

1010
//default planner data
1111
std::vector<int> decision;

default_planner/planner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <random>
77

88

9-
namespace TrafficMAPF{
9+
namespace DefaultPlanner{
1010

1111

1212
void initialize(int preprocess_time_limit, SharedEnvironment* env);

default_planner/scheduler.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#include "scheduler.h"
22

3-
namespace TrafficMAPF{
3+
namespace DefaultPlanner{
44

55
std::mt19937 mt;
66

77
void schedule_initialize(int preprocess_time_limit, SharedEnvironment* env)
88
{
99
// cout<<"schedule initialise limit" << preprocess_time_limit<<endl;
10-
TrafficMAPF::init_heuristics(env);
10+
DefaultPlanner::init_heuristics(env);
1111
mt.seed(0);
1212
}
1313

@@ -41,7 +41,7 @@ void schedule_plan(int time_limit, std::vector<int> & proposed_schedule, Shared
4141
dist = 0;
4242
c_loc = env->curr_states.at(i).location;
4343
for (int loc : env->task_pool[i_task].locations){
44-
dist += TrafficMAPF::get_h(env, c_loc, loc);
44+
dist += DefaultPlanner::get_h(env, c_loc, loc);
4545
c_loc = loc;
4646
}
4747
if (dist < min_task_makespan){

default_planner/scheduler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "heuristics.h"
77
#include <random>
88

9-
namespace TrafficMAPF{
9+
namespace DefaultPlanner{
1010

1111
void schedule_initialize(int preprocess_time_limit, SharedEnvironment* env);
1212

default_planner/search.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "search.h"
55

66

7-
namespace TrafficMAPF{
7+
namespace DefaultPlanner{
88
std::chrono::nanoseconds t;
99
//a astar minimized the opposide traffic flow with existing traffic flow
1010

default_planner/search.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "search_node.h"
1010
#include "heuristics.h"
1111

12-
namespace TrafficMAPF{
12+
namespace DefaultPlanner{
1313
//a astar minimized the opposide traffic flow with existing traffic flow
1414

1515
s_node astar(SharedEnvironment* env, std::vector<Int4>& flow,

default_planner/search_node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <vector>
55
#include <iostream>
66

7-
namespace TrafficMAPF{
7+
namespace DefaultPlanner{
88
struct s_node
99
{
1010
int label = 0;

default_planner/utils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "utils.h"
55

6-
namespace TrafficMAPF{
6+
namespace DefaultPlanner{
77
int get_d(int diff, const SharedEnvironment* env) {
88

99
return (diff == 1)? 0: (diff == -1)? 2: (diff == env->cols)? 1: 3;

default_planner/utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "Types.h"
66

7-
namespace TrafficMAPF{
7+
namespace DefaultPlanner{
88
int get_d(int diff, const SharedEnvironment* env) ;
99

1010

0 commit comments

Comments
 (0)