Skip to content

Commit

Permalink
start refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Kei18 committed Aug 8, 2020
1 parent 588d47d commit 1b1ff4f
Show file tree
Hide file tree
Showing 44 changed files with 1,268 additions and 2,187 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
project(mapf-refine CXX)
add_subdirectory(./mapf)
add_executable(app main.cpp)
add_executable(app app.cpp)
target_compile_features(app PUBLIC cxx_std_17)
target_link_libraries(app lib-mapf)
36 changes: 13 additions & 23 deletions main.cpp → app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
#include <cbs.hpp>
#include <icbs.hpp>
#include <ecbs.hpp>
#include <pibt_icbs.hpp>
#include <pibt_complete.hpp>
#include <ir.hpp>
#include <ir_configs.hpp>
#include <ir_paths.hpp>
#include <ir_tester.hpp>

void printHelp();
Solver* getSolver(const std::string solver_name,
Expand All @@ -24,13 +21,12 @@ Solver* getSolver(const std::string solver_name,
int argc,
char *argv[]);

const std::string DEFAULT_SOLVER_NAME = "PIBT";


int main(int argc, char *argv[]) {
int main(int argc, char *argv[])
{
std::string instance_file = "";
std::string output_file = DEFAULT_OUTPUT_FILE;
std::string solver_name = DEFAULT_SOLVER_NAME;
std::string solver_name;
bool verbose = false;
char *argv_copy[argc+1];
for (int i = 0; i < argc; ++i) argv_copy[i] = argv[i];
Expand Down Expand Up @@ -129,16 +125,12 @@ Solver* getSolver(const std::string solver_name,
solver = new CBS(P);
} else if (solver_name == "ICBS") {
solver = new ICBS(P);
} else if (solver_name == "PIBT_COMPLETE") {
solver = new PIBT_COMPLETE(P);
} else if (solver_name == "ECBS") {
solver = new ECBS(P);
} else if (solver_name == "IR_CONFIGS") {
solver = new IR_CONFIGS(P);
} else if (solver_name == "IR_PATHS") {
solver = new IR_PATHS(P);
} else if (solver_name == "IR_TESTER") {
solver = new IR_TESTER(P);
} else if (solver_name == "PIBT_ICBS") {
solver = new PIBT_ICBS(P);
} else if (solver_name == "IR") {
solver = new IR(P);
} else {
warn("unknown solver name, " + solver_name + ", continue by PIBT");
solver = new PIBT(P);
Expand All @@ -151,12 +143,12 @@ Solver* getSolver(const std::string solver_name,
void printHelp() {
std::cout << "\nUsage: ./app [OPTIONS] [SOLVER-OPTIONS]\n"
<< "\n**instance file is necessary to run MAPF simulator**\n\n"
<< " -i --instance [INSTANCE-FILE] instance file path\n"
<< " -s --solver [SOLVER_NAME] solver\n"
<< " -o --output [OUTPUT-FILE] ouptut file path\n"
<< " -i --instance [FILE_PATH] instance file path\n"
<< " -o --output [FILE_PATH] ouptut file path\n"
<< " -v --verbose print additional info\n"
<< " -h --help help\n"
<< "\nSolver Options:"
<< " -s --solver [SOLVER_NAME] solver, choose from the below"
<< "\n\nSolver Options:"
<< std::endl;
// each solver
PIBT::printHelp();
Expand All @@ -165,8 +157,6 @@ void printHelp() {
CBS::printHelp();
ECBS::printHelp();
ICBS::printHelp();
PIBT_ICBS::printHelp();
PIBT_COMPLETE::printHelp();
IR::printHelp();
IR_CONFIGS::printHelp();
IR_PATHS::printHelp();
}
Loading

0 comments on commit 1b1ff4f

Please sign in to comment.