Commit 6fd4a1a0 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Add cmake option to compile AIrouter

cmake  -DAIROUTER=true

if you want to use AIRouter.
(CGAL should be installed)
parent 311f63fa
Pipeline #9454 failed with stages
in 9 minutes and 51 seconds
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
# -DBUILD_CPPUNIT_TEST=ON (default OFF) for unit tests # -DBUILD_CPPUNIT_TEST=ON (default OFF) for unit tests
# -DUSE_DUAL_ABI=ON (default OFF) https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html # -DUSE_DUAL_ABI=ON (default OFF) https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
# -D Boost_NO_SYSTEM_PATHS=true (default false) -D BOOST_ROOT=PATH_where_to_find_boost # -D Boost_NO_SYSTEM_PATHS=true (default false) -D BOOST_ROOT=PATH_where_to_find_boost
# -D AIROUTER (default true)
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8 FATAL_ERROR) cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
...@@ -13,6 +14,12 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0) ...@@ -13,6 +14,12 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
project(JPScore) project(JPScore)
if(NOT AIROUTER)
set(AIROUTER false)
else()
set(AIROUTER true)
endif()
set(CMAKE_COLOR_MAKEFILE ON) set(CMAKE_COLOR_MAKEFILE ON)
set(JPSCORE_MAJOR_VERSION 0) set(JPSCORE_MAJOR_VERSION 0)
set(JPSCORE_MINOR_VERSION 8) set(JPSCORE_MINOR_VERSION 8)
...@@ -63,7 +70,6 @@ if (NOT DEFINED PROCESSOR_COUNT) ...@@ -63,7 +70,6 @@ if (NOT DEFINED PROCESSOR_COUNT)
list(LENGTH procs PROCESSOR_COUNT) list(LENGTH procs PROCESSOR_COUNT)
endif (EXISTS "${cpuinfo_file}") endif (EXISTS "${cpuinfo_file}")
# Windows: # Windows:
if (WIN32) if (WIN32)
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}") set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
...@@ -199,7 +205,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") ...@@ -199,7 +205,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
find_package(Boost COMPONENTS timer chrono system filesystem unit_test_framework REQUIRED) find_package(Boost COMPONENTS timer chrono system filesystem unit_test_framework REQUIRED)
#CGAL #CGAL
find_package(CGAL REQUIRED) find_package(CGAL QUIET) # for AI router
# test all cpp-files in Utest # test all cpp-files in Utest
...@@ -336,24 +342,6 @@ set(source_files ...@@ -336,24 +342,6 @@ set(source_files
routing/smoke_router/cognitiveMap/internnavigationnetwork.cpp routing/smoke_router/cognitiveMap/internnavigationnetwork.cpp
visiLibity/source_code/visilibity.cpp visiLibity/source_code/visilibity.cpp
#AI router
routing/ai_router/AIRouter.cpp
routing/ai_router/BrainStorage.cpp
routing/ai_router/cognitiveMap/associations.cpp
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.cpp
routing/ai_router/cognitiveMap/landmark.cpp
routing/ai_router/cognitiveMap/region.cpp
routing/ai_router/cognitiveMap/landmarknetwork.cpp
routing/ai_router/cognitiveMap/internnavigationnetwork.cpp
routing/ai_router/perception/visualsystem.cpp
routing/ai_router/perception/visibleenvironment.cpp
routing/ai_router/perception/cgalgeometry.cpp
routing/ai_router/perception/sign.cpp
routing/ai_router/Cortex.cpp
poly2tri/common/shapes.cpp poly2tri/common/shapes.cpp
poly2tri/sweep/sweep_context.cpp poly2tri/sweep/sweep_context.cpp
poly2tri/sweep/advancing_front.cpp poly2tri/sweep/advancing_front.cpp
...@@ -426,23 +414,6 @@ set(header_files ...@@ -426,23 +414,6 @@ set(header_files
routing/smoke_router/cognitiveMap/internnavigationnetwork.h routing/smoke_router/cognitiveMap/internnavigationnetwork.h
visiLibity/source_code/visilibity.hpp visiLibity/source_code/visilibity.hpp
#AI router
routing/ai_router/AIRouter.h
routing/ai_router/BrainStorage.h
routing/ai_router/cognitiveMap/associations.h
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.h
routing/ai_router/cognitiveMap/landmark.h
routing/ai_router/cognitiveMap/region.h
routing/ai_router/cognitiveMap/landmarknetwork.h
routing/ai_router/cognitiveMap/internnavigationnetwork.h
routing/ai_router/perception/visualsystem.h
routing/ai_router/perception/visibleenvironment.h
routing/ai_router/perception/cgalgeometry.h
routing/ai_router/perception/sign.h
routing/ai_router/Cortex.h
pedestrian/Pedestrian.h pedestrian/Pedestrian.h
pedestrian/PedDistributor.h pedestrian/PedDistributor.h
pedestrian/Ellipse.h pedestrian/Ellipse.h
...@@ -465,7 +436,7 @@ set(header_files ...@@ -465,7 +436,7 @@ set(header_files
general/ArgumentParser.h general/ArgumentParser.h
general/Configuration.h general/Configuration.h
general/Macros.h general/Macros.h
general/randomnumbergenerator.h general/randomnumbergenerator.h
geometry/Crossing.h geometry/Crossing.h
geometry/NavLine.h geometry/NavLine.h
...@@ -516,6 +487,49 @@ set(header_files ...@@ -516,6 +487,49 @@ set(header_files
JPSfire/C_toxicity_analysis/ToxicityOutputhandler.h JPSfire/C_toxicity_analysis/ToxicityOutputhandler.h
) )
SET(AIROUTER_SRC
#AI router
routing/ai_router/AIRouter.cpp
routing/ai_router/BrainStorage.cpp
routing/ai_router/cognitiveMap/associations.cpp
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.cpp
routing/ai_router/cognitiveMap/landmark.cpp
routing/ai_router/cognitiveMap/region.cpp
routing/ai_router/cognitiveMap/landmarknetwork.cpp
routing/ai_router/cognitiveMap/internnavigationnetwork.cpp
routing/ai_router/perception/visualsystem.cpp
routing/ai_router/perception/visibleenvironment.cpp
routing/ai_router/perception/cgalgeometry.cpp
routing/ai_router/perception/sign.cpp
routing/ai_router/Cortex.cpp
)
SET(AIROUTER_HDR
#AI router
routing/ai_router/AIRouter.h
routing/ai_router/BrainStorage.h
routing/ai_router/cognitiveMap/associations.h
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.h
routing/ai_router/cognitiveMap/landmark.h
routing/ai_router/cognitiveMap/region.h
routing/ai_router/cognitiveMap/landmarknetwork.h
routing/ai_router/cognitiveMap/internnavigationnetwork.h
routing/ai_router/perception/visualsystem.h
routing/ai_router/perception/visibleenvironment.h
routing/ai_router/perception/cgalgeometry.h
routing/ai_router/perception/sign.h
routing/ai_router/Cortex.h
)
message(STATUS "AIROUTER: ${AIROUTER}")
if(CGAL_FOUND AND AIROUTER)
SET(source_files ${source_files} ${AIROUTER_SRC})
SET(header_files ${header_files} ${AIROUTER_HDR})
message(STATUS "USE AI ROUTER")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DAIROUTER")
endif()
add_library(core STATIC ${source_files}) add_library(core STATIC ${source_files})
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
...@@ -671,6 +685,7 @@ if (NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio") ...@@ -671,6 +685,7 @@ if (NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
endif () endif ()
endif () endif ()
if (MSVC) if (MSVC)
message(STATUS "MSVC: " ${MSVC}) message(STATUS "MSVC: " ${MSVC})
elseif (MSVC_IDE) elseif (MSVC_IDE)
......
...@@ -122,7 +122,7 @@ bool IniFileParser::Parse(std::string iniFile) ...@@ -122,7 +122,7 @@ bool IniFileParser::Parse(std::string iniFile)
// Progressbar // Progressbar
if (xMainNode->FirstChild("progressbar")) { if (xMainNode->FirstChild("progressbar")) {
_config->SetPRB(true); _config->SetPRB(true);
Log->Write("INFO: \tUse Progressbar"); Log->Write("INFO: \tUse Progressbar");
} }
// geometry file name // geometry file name
...@@ -143,8 +143,8 @@ bool IniFileParser::Parse(std::string iniFile) ...@@ -143,8 +143,8 @@ bool IniFileParser::Parse(std::string iniFile)
if (numthreads) { if (numthreads) {
#ifdef _OPENMP #ifdef _OPENMP
omp_set_num_threads(xmltoi(numthreads->Value())); omp_set_num_threads(xmltoi(numthreads->Value()));
#endif #endif
} }
} }
_config->SetMaxOpenMPThreads(omp_get_max_threads()); _config->SetMaxOpenMPThreads(omp_get_max_threads());
Log->Write("INFO:\tUsing num_threads <%d> threads (%d available)", _config->GetMaxOpenMPThreads(), max_threads); Log->Write("INFO:\tUsing num_threads <%d> threads (%d available)", _config->GetMaxOpenMPThreads(), max_threads);
...@@ -379,25 +379,25 @@ bool IniFileParser::ParseGCFMModel(TiXmlElement* xGCFM, TiXmlElement* xMainNode) ...@@ -379,25 +379,25 @@ bool IniFileParser::ParseGCFMModel(TiXmlElement* xGCFM, TiXmlElement* xMainNode)
return false; return false;
//force_ped //force_ped
if (xModelPara->FirstChild("force_ped")) { if (xModelPara->FirstChild("force_ped")) {
string nu = xModelPara->FirstChildElement("force_ped")->Attribute("nu"); string nu = xModelPara->FirstChildElement("force_ped")->Attribute("nu");
string dist_max = xModelPara->FirstChildElement("force_ped")->Attribute( string dist_max = xModelPara->FirstChildElement("force_ped")->Attribute(
"dist_max"); "dist_max");
string disteff_max = string disteff_max =
xModelPara->FirstChildElement("force_ped")->Attribute( xModelPara->FirstChildElement("force_ped")->Attribute(
"disteff_max"); // @todo: rename disteff_max to force_max "disteff_max"); // @todo: rename disteff_max to force_max
string interpolation_width = string interpolation_width =
xModelPara->FirstChildElement("force_ped")->Attribute( xModelPara->FirstChildElement("force_ped")->Attribute(
"interpolation_width"); "interpolation_width");
_config->SetMaxFPed(atof(dist_max.c_str())); _config->SetMaxFPed(atof(dist_max.c_str()));
_config->SetNuPed(atof(nu.c_str())); _config->SetNuPed(atof(nu.c_str()));
_config->SetDistEffMaxPed(atof(disteff_max.c_str())); _config->SetDistEffMaxPed(atof(disteff_max.c_str()));
_config->SetIntPWidthPed(atof(interpolation_width.c_str())); _config->SetIntPWidthPed(atof(interpolation_width.c_str()));
Log->Write( Log->Write(
"INFO: \tfrep_ped nu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f", "INFO: \tfrep_ped nu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str())); atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str()));
} }
//force_wall //force_wall
if (xModelPara->FirstChild("force_wall")) { if (xModelPara->FirstChild("force_wall")) {
...@@ -416,7 +416,7 @@ bool IniFileParser::ParseGCFMModel(TiXmlElement* xGCFM, TiXmlElement* xMainNode) ...@@ -416,7 +416,7 @@ bool IniFileParser::ParseGCFMModel(TiXmlElement* xGCFM, TiXmlElement* xMainNode)
_config->SetIntPWidthWall(atof(interpolation_width.c_str())); _config->SetIntPWidthWall(atof(interpolation_width.c_str()));
Log->Write( Log->Write(
"INFO: \tfrep_wall mu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f", "INFO: \tfrep_wall mu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str())); atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str()));
} }
//Parsing the agent parameters //Parsing the agent parameters
...@@ -487,7 +487,7 @@ bool IniFileParser::ParseKrauszModel(TiXmlElement* xKrausz, TiXmlElement* xMainN ...@@ -487,7 +487,7 @@ bool IniFileParser::ParseKrauszModel(TiXmlElement* xKrausz, TiXmlElement* xMainN
_config->SetIntPWidthPed(atof(interpolation_width.c_str())); _config->SetIntPWidthPed(atof(interpolation_width.c_str()));
Log->Write( Log->Write(
"INFO: \tfrep_ped nu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f", "INFO: \tfrep_ped nu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str())); atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str()));
} }
//force_wall //force_wall
...@@ -507,7 +507,7 @@ bool IniFileParser::ParseKrauszModel(TiXmlElement* xKrausz, TiXmlElement* xMainN ...@@ -507,7 +507,7 @@ bool IniFileParser::ParseKrauszModel(TiXmlElement* xKrausz, TiXmlElement* xMainN
_config->SetIntPWidthWall(atof(interpolation_width.c_str())); _config->SetIntPWidthWall(atof(interpolation_width.c_str()));
Log->Write( Log->Write(
"INFO: \tfrep_wall mu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f", "INFO: \tfrep_wall mu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str())); atof(nu.c_str()), atof(dist_max.c_str()), atof(disteff_max.c_str()), atof(interpolation_width.c_str()));
} }
//Parsing the agent parameters //Parsing the agent parameters
...@@ -1045,7 +1045,6 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag ...@@ -1045,7 +1045,6 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
Log->Write("ERROR: \t Agent Distribution section is missing"); Log->Write("ERROR: \t Agent Distribution section is missing");
return false; return false;
} }
//first get list of actually used router //first get list of actually used router
std::vector<int> usedRouter; std::vector<int> usedRouter;
usedRouter.clear(); usedRouter.clear();
...@@ -1104,6 +1103,7 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag ...@@ -1104,6 +1103,7 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
} }
else if ((strategy == "AI") && else if ((strategy == "AI") &&
(std::find(usedRouter.begin(), usedRouter.end(), id) != usedRouter.end()) ) { (std::find(usedRouter.begin(), usedRouter.end(), id) != usedRouter.end()) ) {
#ifdef AIROUTER
Router *r = new AIRouter(id, ROUTING_AI); Router *r = new AIRouter(id, ROUTING_AI);
_config->GetRoutingEngine()->AddRouter(r); _config->GetRoutingEngine()->AddRouter(r);
...@@ -1111,6 +1111,7 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag ...@@ -1111,6 +1111,7 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
///Parsing additional options ///Parsing additional options
if (!ParseAIOpts(e)) if (!ParseAIOpts(e))
return false; return false;
#endif
} }
else if ((strategy == "ff_global_shortest") && else if ((strategy == "ff_global_shortest") &&
(std::find(usedRouter.begin(), usedRouter.end(), id) != usedRouter.end()) ) { (std::find(usedRouter.begin(), usedRouter.end(), id) != usedRouter.end()) ) {
...@@ -1252,7 +1253,7 @@ bool IniFileParser::ParseCogMapOpts(TiXmlNode* routingNode) ...@@ -1252,7 +1253,7 @@ bool IniFileParser::ParseCogMapOpts(TiXmlNode* routingNode)
return true; return true;
} }
#ifdef AIROUTER
bool IniFileParser::ParseAIOpts(TiXmlNode* routingNode) { bool IniFileParser::ParseAIOpts(TiXmlNode* routingNode) {
TiXmlNode *sensorNode = routingNode->FirstChild(); TiXmlNode *sensorNode = routingNode->FirstChild();
...@@ -1311,7 +1312,7 @@ bool IniFileParser::ParseAIOpts(TiXmlNode* routingNode) { ...@@ -1311,7 +1312,7 @@ bool IniFileParser::ParseAIOpts(TiXmlNode* routingNode) {
return true; return true;
} }
#endif
bool IniFileParser::ParseLinkedCells(const TiXmlNode& linkedCellNode) bool IniFileParser::ParseLinkedCells(const TiXmlNode& linkedCellNode)
......
...@@ -61,9 +61,9 @@ private: ...@@ -61,9 +61,9 @@ private:
bool ParseFfRouterOps(TiXmlNode* routingNode, RoutingStrategy s); bool ParseFfRouterOps(TiXmlNode* routingNode, RoutingStrategy s);
bool ParseCogMapOpts(TiXmlNode* routingNode); bool ParseCogMapOpts(TiXmlNode* routingNode);
#ifdef AIROUTER
bool ParseAIOpts(TiXmlNode* routingNode); bool ParseAIOpts(TiXmlNode* routingNode);
#endif
bool ParseLinkedCells(const TiXmlNode& linkedCellNode); bool ParseLinkedCells(const TiXmlNode& linkedCellNode);
bool ParseStepSize(TiXmlNode& stepNode); bool ParseStepSize(TiXmlNode& stepNode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment