Commit d9e94080 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Merge branch 'windows10' into develop

parents 2a38c74d 1c86abe6
Pipeline #6490 passed with stages
in 3 minutes and 47 seconds
......@@ -148,4 +148,5 @@ idea/codeStyleSettings.xml
*.log
*.pdf
/Utest/rimea_tests/figures
cmake-build-debug
......@@ -23,6 +23,7 @@
#include <omp.h>
#else
#define omp_get_thread_num() 0
#define omp_get_max_threads() 1
......@@ -377,25 +378,25 @@ bool IniFileParser::ParseGCFMModel(TiXmlElement* xGCFM, TiXmlElement* xMainNode)
return false;
//force_ped
if (xModelPara->FirstChild("force_ped")) {
string nu = xModelPara->FirstChildElement("force_ped")->Attribute("nu");
string dist_max = xModelPara->FirstChildElement("force_ped")->Attribute(
"dist_max");
string disteff_max =
xModelPara->FirstChildElement("force_ped")->Attribute(
"disteff_max"); // @todo: rename disteff_max to force_max
string interpolation_width =
xModelPara->FirstChildElement("force_ped")->Attribute(
"interpolation_width");
_config->SetMaxFPed(atof(dist_max.c_str()));
_config->SetNuPed(atof(nu.c_str()));
_config->SetDistEffMaxPed(atof(disteff_max.c_str()));
_config->SetIntPWidthPed(atof(interpolation_width.c_str()));
Log->Write(
"INFO: \tfrep_ped nu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
interpolation_width.c_str(), nu.c_str(), dist_max.c_str(), disteff_max.c_str(), interpolation_width.c_str());
}
if (xModelPara->FirstChild("force_ped")) {
string nu = xModelPara->FirstChildElement("force_ped")->Attribute("nu");
string dist_max = xModelPara->FirstChildElement("force_ped")->Attribute(
"dist_max");
string disteff_max =
xModelPara->FirstChildElement("force_ped")->Attribute(
"disteff_max"); // @todo: rename disteff_max to force_max
string interpolation_width =
xModelPara->FirstChildElement("force_ped")->Attribute(
"interpolation_width");
_config->SetMaxFPed(atof(dist_max.c_str()));
_config->SetNuPed(atof(nu.c_str()));
_config->SetDistEffMaxPed(atof(disteff_max.c_str()));
_config->SetIntPWidthPed(atof(interpolation_width.c_str()));
Log->Write(
"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()));
}
//force_wall
if (xModelPara->FirstChild("force_wall")) {
......@@ -414,7 +415,7 @@ bool IniFileParser::ParseGCFMModel(TiXmlElement* xGCFM, TiXmlElement* xMainNode)
_config->SetIntPWidthWall(atof(interpolation_width.c_str()));
Log->Write(
"INFO: \tfrep_wall mu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
nu.c_str(), dist_max.c_str(), disteff_max.c_str(), 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
......@@ -485,7 +486,7 @@ bool IniFileParser::ParseKrauszModel(TiXmlElement* xKrausz, TiXmlElement* xMainN
_config->SetIntPWidthPed(atof(interpolation_width.c_str()));
Log->Write(
"INFO: \tfrep_ped nu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
interpolation_width.c_str(), nu.c_str(), dist_max.c_str(), disteff_max.c_str(), 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
......@@ -505,7 +506,7 @@ bool IniFileParser::ParseKrauszModel(TiXmlElement* xKrausz, TiXmlElement* xMainN
_config->SetIntPWidthWall(atof(interpolation_width.c_str()));
Log->Write(
"INFO: \tfrep_wall mu=%.3f, dist_max=%.3f, disteff_max=%.3f, interpolation_width=%.3f",
nu.c_str(), dist_max.c_str(), disteff_max.c_str(), 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
......
#include "progress_bar.hpp"
#include "string"
ProgressBar::ProgressBar() {}
ProgressBar::ProgressBar(unsigned long n_, std::string description_, std::ostream& out_){
......
......@@ -295,7 +295,7 @@ void Simulation::UpdateRoutesAndLocations()
auto allRooms = _building->GetAllRooms();
#pragma omp parallel for shared(pedsToRemove, allRooms)
for (size_t p = 0; p < allPeds.size(); ++p) {
for (signed int p = 0; p < allPeds.size(); ++p) {
auto ped = allPeds[p];
Room* room = _building->GetRoom(ped->GetRoomID());
SubRoom* sub0 = room->GetSubRoom(ped->GetSubRoomID());
......
......@@ -120,7 +120,7 @@ bool GradientModel::Init (Building* building)
pedsToRemove.clear();
bool error_occurred = false;
#pragma omp parallel for
for(unsigned int p=0;p<allPeds.size();p++) {
for(signed int p=0;p<allPeds.size();p++) {
Pedestrian* ped = allPeds[p];
double cosPhi, sinPhi;
//a destination could not be found for that pedestrian
......
......@@ -27,7 +27,7 @@
*
**/
# define NOMINMAX
#include "../pedestrian/Pedestrian.h"
//#include "../routing/DirectionStrategy.h"
#include "../mpi/LCGrid.h"
......@@ -36,7 +36,6 @@
#include "VelocityModel.h"
#ifdef _OPENMP
#include <omp.h>
#else
......
......@@ -51,66 +51,118 @@ int AgentsParameters::GetID()
void AgentsParameters::InitV0(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_V0 = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitV0UpStairs(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_V0UpStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitV0DownStairs(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_V0DownStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitEscalatorUpStairs(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_EscalatorUpStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitEscalatorDownStairs(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_EscalatorDownStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitV0IdleEscalatorUpStairs(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_V0IdleEscalatorUpStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitV0IdleEscalatorDownStairs(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_V0IdleEscalatorDownStairs = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitBmax(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_Bmax= std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitBmin(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_Bmin = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitAmin(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_Amin = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitAtau(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_Atau = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitTau(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_Tau = std::normal_distribution<double>(mean,stdv);
}
void AgentsParameters::InitT(double mean, double stdv)
{
if (stdv == 0)
{
stdv = judge;
}
_T = std::normal_distribution<double>(mean,stdv);
}
......@@ -131,69 +183,161 @@ void AgentsParameters::EnableStretch(bool stretch)
double AgentsParameters::GetV0()
{
return _V0(_generator);
if (_V0.stddev() == judge)
{
return _V0.mean();
}
else
{
return _V0(_generator);
}
}
double AgentsParameters::GetV0UpStairs()
{
return _V0UpStairs(_generator);
if (_V0UpStairs.stddev() == judge)
{
return _V0UpStairs.mean();
}
else
{
return _V0UpStairs(_generator);
}
}
double AgentsParameters::GetV0DownStairs()
{
return _V0DownStairs(_generator);
if (_V0DownStairs.stddev() == judge)
{
return _V0DownStairs.mean();
}
else
{
return _V0DownStairs(_generator);
}
}
double AgentsParameters::GetEscalatorUpStairs()
{
return _EscalatorUpStairs(_generator);
if (_EscalatorUpStairs.stddev() == judge)
{
return _EscalatorUpStairs.mean();
}
else
{
return _EscalatorUpStairs(_generator);
}
}
double AgentsParameters::GetEscalatorDownStairs()
{
return _EscalatorDownStairs(_generator);
if (_EscalatorDownStairs.stddev() == judge)
{
return _EscalatorDownStairs.mean();
}
else
{
return _EscalatorDownStairs(_generator);
}
}
double AgentsParameters::GetV0IdleEscalatorUpStairs()
{
return _V0IdleEscalatorUpStairs(_generator);
if (_V0IdleEscalatorUpStairs.stddev() == judge)
{
return _V0IdleEscalatorUpStairs.mean();
}
else
{
return _V0IdleEscalatorUpStairs(_generator);
}
}
double AgentsParameters::GetV0IdleEscalatorDownStairs()
{
return _V0IdleEscalatorDownStairs(_generator);
if (_V0IdleEscalatorDownStairs.stddev() == judge)
{
return _V0IdleEscalatorDownStairs.mean();
}
else
{
return _V0IdleEscalatorDownStairs(_generator);
}
}
double AgentsParameters::GetBmax()
{
return _Bmax(_generator);
if (_Bmax.stddev() == judge)
{
return _Bmax.mean();
}
else
{
return _Bmax(_generator);
}
}
double AgentsParameters::GetBmin()
{
return _Bmin(_generator);
if (_Bmin.stddev() == judge)
{
return _Bmin.mean();
}
else
{
return _Bmin(_generator);
}
}
double AgentsParameters::GetAtau()
{
return _Atau(_generator);
if (_Atau.stddev() == judge)
{
return _Atau.mean();
}
else
{
return _Atau(_generator);
}
}
double AgentsParameters::GetAmin()
{
return _Amin(_generator);
if (_Amin.stddev() == judge)
{
return _Amin.mean();
}
else
{
return _Amin(_generator);
}
}
double AgentsParameters::GetTau()
{
return _Tau(_generator);
if (_Tau.stddev() == judge)
{
return _Tau.mean();
}
else
{
return _Tau(_generator);
}
}
double AgentsParameters::GetT()
{
return _T(_generator);
if (_T.stddev() == judge)
{
return _T.mean();
}
else
{
return _T(_generator);
}
}
double AgentsParameters::GetSwayFreqA() const {
......@@ -222,19 +366,68 @@ std::string AgentsParameters::writeParameter()
char tmp[CLENGTH];
s.append("\tPedestrians Parameter:\n");
sprintf(tmp, "\t\tv0 ~ N(%f, %f)\n", _V0.mean(), _V0.stddev());
if (_V0.stddev() == judge)
{
sprintf(tmp, "\t\tv0 ~ N(%f, %f)\n", _V0.mean(), _V0.stddev()-judge);
}
else
{
sprintf(tmp, "\t\tv0 ~ N(%f, %f)\n", _V0.mean(), _V0.stddev());
}
s.append(tmp);
sprintf(tmp, "\t\tb_max ~ N(%f, %f)\n", _Bmax.mean(), _Bmax.stddev());
if (_Bmax.stddev() == judge)
{
sprintf(tmp, "\t\tb_max ~ N(%f, %f)\n", _Bmax.mean(), _Bmax.stddev()-judge);
}
else
{
sprintf(tmp, "\t\tb_max ~ N(%f, %f)\n", _Bmax.mean(), _Bmax.stddev());
}
s.append(tmp);
sprintf(tmp, "\t\tb_min ~ N(%f, %f)\n", _Bmin.mean(), _Bmin.stddev());
if (_Bmin.stddev() == judge)
{
sprintf(tmp, "\t\tb_max ~ N(%f, %f)\n", _Bmin.mean(), _Bmin.stddev() - judge);
}
else
{
sprintf(tmp, "\t\tb_min ~ N(%f, %f)\n", _Bmin.mean(), _Bmin.stddev());
}
s.append(tmp);
sprintf(tmp, "\t\ta_min ~ N(%f, %f)\n", _Amin.mean(), _Amin.stddev());
if (_Amin.stddev() == judge)
{
sprintf(tmp, "\t\tb_max ~ N(%f, %f)\n", _Amin.mean(), _Amin.stddev() - judge);
}
else
{
sprintf(tmp, "\t\tb_min ~ N(%f, %f)\n", _Amin.mean(), _Amin.stddev());
}
s.append(tmp);
sprintf(tmp, "\t\ta_tau ~ N(%f, %f)\n", _Atau.mean(), _Atau.stddev());
if (_Atau.stddev() == judge)
{
sprintf(tmp, "\t\ta_tau ~ N(%f, %f)\n", _Atau.mean(), _Atau.stddev()-judge);
}
else
{
sprintf(tmp, "\t\ta_tau ~ N(%f, %f)\n", _Atau.mean(), _Atau.stddev());
}
s.append(tmp);
sprintf(tmp, "\t\ttau ~ N(%f, %f)\n", _Tau.mean(), _Tau.stddev());
if (_Tau.stddev() == judge)
{
sprintf(tmp, "\t\ttau ~ N(%f, %f)\n", _Tau.mean(), _Tau.stddev()-judge);
}
else
{
sprintf(tmp, "\t\ttau ~ N(%f, %f)\n", _Tau.mean(), _Tau.stddev());
}
s.append(tmp);
sprintf(tmp, "\t\tT ~ N(%f, %f)\n", _T.mean(), _T.stddev());
if (_T.stddev() == judge)
{
sprintf(tmp, "\t\tT ~ N(%f, %f)\n", _T.mean(), _T.stddev()-judge);
}
else
{
sprintf(tmp, "\t\tT ~ N(%f, %f)\n", _T.mean(), _T.stddev());
}
s.append(tmp);
return s;
}
......
......@@ -258,7 +258,7 @@ private:
double _swayFreqB = 0.35;
double _swayAmpA = -0.14;
double _swayAmpB = 0.21;
const double judge = 10000;
};
#endif /* AGENTSPARAMETERS_H_ */
......@@ -25,7 +25,7 @@
*
**/
#define NOMINMAX
#include <cassert>
#include "../geometry/Building.h"
#include "../geometry/SubRoom.h"
......
......@@ -350,18 +350,33 @@ void StartDistribution::Setbounds(double bounds[4])
void StartDistribution::InitPremovementTime(double mean, double stdv)
{
if (stdv<=0)
{
stdv = judge;
}
_premovementTime = std::normal_distribution<double>(mean,stdv);
}
double StartDistribution::GetPremovementTime() const
{
return _premovementTime(_generator);
if (_premovementTime.stddev() == judge)
{
return _premovementTime.mean();
}
else
{
return _premovementTime(_generator);
}
}
void StartDistribution::InitRiskTolerance(std::string distribution_type, double para1, double para2)
{
_distribution_type = distribution_type;
if(distribution_type=="normal"){
if (para2 <= 0)
{
para2 = judge;
}
_riskTolerance = std::normal_distribution<double>(para1, para2);
}
if(distribution_type=="beta"){
......@@ -373,7 +388,14 @@ double StartDistribution::GetRiskTolerance()
{
if(_distribution_type=="normal"){
//fprintf(stderr, "%f \t %f \n", _generator, _riskTolerance(_generator));
return _riskTolerance(_generator);
if (_riskTolerance.stddev() == judge)
{
return _riskTolerance.mean();
}
else
{
return _riskTolerance(_generator);
}
}
else {
std::uniform_real_distribution<float> normalize(0.0, 1.0);
......
......@@ -84,6 +84,9 @@ private:
//random number generator engine
mutable std::default_random_engine _generator;
//judge whether sigma>0
const double judge = 10000;
public:
StartDistribution(int seed);
virtual ~StartDistribution();
......
//
// Created by arne on 5/9/17.
//
#define NOMINMAX
#include <unordered_set>
#include "UnivFFviaFM.h"
#include "../../geometry/Line.h"
......@@ -381,7 +381,7 @@ void UnivFFviaFM::recreateAllForQuickest() {
#pragma omp parallel
{
#pragma omp for
for (unsigned int i = 0; i < _doors.size(); ++i) {
for (signed int i = 0; i < _doors.size(); ++i) {
auto doorPair = _doors.begin();
std::advance(doorPair, i);
addTarget(doorPair->first, _costFieldWithKey[doorPair->first], _directionFieldWithKey[doorPair->first]);
......@@ -1178,7 +1178,7 @@ void UnivFFviaFM::addAllTargetsParallel() {
#pragma omp parallel
{
#pragma omp for
for (unsigned int i = 0; i < _doors.size(); ++i) {
for (signed int i = 0; i < _doors.size(); ++i) {
auto doorPair = _doors.begin();
std::advance(doorPair, i);
addTarget(doorPair->first, _costFieldWithKey[doorPair->first], _directionFieldWithKey[doorPair->first]);
......@@ -1211,7 +1211,7 @@ void UnivFFviaFM::addTargetsParallel(std::vector<int> wantedDoors) {
#pragma omp parallel
{
#pragma omp for
for (unsigned int i = 0; i < wantedDoors.size(); ++i) {
for (signed int i = 0; i < wantedDoors.size(); ++i) {
auto doorUID = wantedDoors.begin();
std::advance(doorUID, i);
addTarget(*doorUID, _costFieldWithKey[*doorUID], _directionFieldWithKey[*doorUID]);
......
......@@ -6,7 +6,7 @@
*/
#define PLOT_VORONOI_DIAGRAM 0
#define NOMINMAX
static int global_count = 0;
......
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