diff --git a/Utest/test_1/master_ini.xml b/Utest/test_1/master_ini.xml index c7e7f681ea2ae2460ae86a3819f670020591491e..e234ec45bde3a52ac7740787a7c8660072bb340b 100644 --- a/Utest/test_1/master_ini.xml +++ b/Utest/test_1/master_ini.xml @@ -82,12 +82,12 @@ <force_wall nu="10" b="0.70" c="3.0"/> </model_parameters> <agent_parameters agent_parameter_id="0"> - <v0 mu="1" sigma="0.0" /> + <v0 mu="1.0" sigma="0.0" /> <bmax mu="0.25" sigma="0.001" /> - <bmin mu="0.20" sigma="0.001" /> + <bmin mu="0.40" sigma="0.001" /> <amin mu="0.18" sigma="0.001" /> <tau mu="0.01" sigma="0.001" /> - <atau mu="0.5" sigma="0.001" /> + <atau mu="0.2" sigma="0.001" /> </agent_parameters> </model> </operational_models> diff --git a/Utest/test_1/runtest_1.py b/Utest/test_1/runtest_1.py index 0446f113784744052610eb417d50c10524fe86b2..c7c7018455f1d6fd52834630c76f0ec6f139050d 100755 --- a/Utest/test_1/runtest_1.py +++ b/Utest/test_1/runtest_1.py @@ -1,14 +1,15 @@ #! /usr/bin/env python import numpy as np -from xml.dom import minidom -import os, argparse, logging, time +import os, argparse, logging, time, sys from os import path, system from sys import argv ,exit import subprocess, glob import multiprocessing import matplotlib.pyplot as plt import re - +lib_path = os.path.abspath('..') +sys.path.append(lib_path) +from utils import * #========================= testnr = 1 #======================== @@ -29,54 +30,6 @@ DIR= os.path.dirname(os.path.realpath(argv[0])) CWD = os.getcwd() #-------------------------------------------------------- -def get_maxtime(filename): - """ - get max sim time - """ - logging.info("parsing <%s>"%filename) - try: - xmldoc = minidom.parse(filename) - except: - logging.critical('could not parse file. exit') - exit(FAILURE) - maxtime = float(xmldoc.getElementsByTagName('max_sim_time')[0].firstChild.nodeValue) - return maxtime - -def parse_file(filename): - """ - parse trajectories in Travisto-format and output results - in the following format: id frame x y - (no sorting of the data is performed) - returns - N: number of pedestrians - data: trajectories - """ - logging.info("parsing <%s>"%filename) - try: - xmldoc = minidom.parse(filename) - except: - logging.critical('could not parse file. exit') - exit(FAILURE) - N = int(xmldoc.getElementsByTagName('agents')[0].childNodes[0].data) - fps= xmldoc.getElementsByTagName('frameRate')[0].childNodes[0].data #type unicode - fps = float(fps) - fps = int(fps) - print "fps=", fps - #fps = int(xmldoc.getElementsByTagName('frameRate')[0].childNodes[0].data) - logging.info ("Npeds = %d, fps = %d"%(N, fps)) - frames = xmldoc.childNodes[0].getElementsByTagName('frame') - data = [] - for frame in frames: - frame_number = int(frame.attributes["ID"].value) - for agent in frame.getElementsByTagName("agent"): - agent_id = int(agent.attributes["ID"].value) - x = float(agent.attributes["xPos"].value) - y = float(agent.attributes["yPos"].value) - data += [agent_id, frame_number, x, y] - data = np.array(data).reshape((-1,4)) - return fps, N, data - - if __name__ == "__main__": if CWD != DIR: diff --git a/Utest/test_2/master_ini.xml b/Utest/test_2/master_ini.xml index 9e56f805e617f7d34d2adba976542acb7146664e..6096a8b40bc148ee6fbf6c8464e7fa72c289a9d7 100644 --- a/Utest/test_2/master_ini.xml +++ b/Utest/test_2/master_ini.xml @@ -86,10 +86,10 @@ <agent_parameters agent_parameter_id="0"> <v0 mu="1" sigma="0.0" /> <bmax mu="0.25" sigma="0.001" /> - <bmin mu="0.20" sigma="0.001" /> + <bmin mu="0.40" sigma="0.001" /> <amin mu="0.18" sigma="0.001" /> <tau mu="0.01" sigma="0.001" /> - <atau mu="0.5" sigma="0.001" /> + <atau mu="0.2" sigma="0.001" /> </agent_parameters> </model> </operational_models> diff --git a/Utest/test_2/runtest_2.py b/Utest/test_2/runtest_2.py index e6daef188d26f71b314b5c87059e505cfc73638f..6eaca88c95e72c6f3186fd7a31d3e4479f0255d2 100755 --- a/Utest/test_2/runtest_2.py +++ b/Utest/test_2/runtest_2.py @@ -7,8 +7,10 @@ from sys import argv ,exit import subprocess, glob import multiprocessing import matplotlib.pyplot as plt -import re - +import re, sys +lib_path = os.path.abspath('..') +sys.path.append(lib_path) +from utils import * #========================= testnr = 2 #======================== @@ -28,55 +30,6 @@ CWD = os.getcwd() DIR= os.path.dirname(os.path.realpath(argv[0])) #-------------------------------------------------------- -def get_maxtime(filename): - """ - get max sim time - """ - logging.info("parsing <%s>"%filename) - try: - xmldoc = minidom.parse(filename) - except: - logging.critical('could not parse file. exit') - exit(FAILURE) - maxtime = float(xmldoc.getElementsByTagName('max_sim_time')[0].firstChild.nodeValue) - return maxtime - -def parse_file(filename): - """ - parse trajectories in Travisto-format and output results - in the following format: id frame x y - (no sorting of the data is performed) - returns - N: number of pedestrians - data: trajectories - """ - logging.info("parsing <%s>"%filename) - try: - xmldoc = minidom.parse(filename) - except: - logging.critical('could not parse file. exit') - exit(FAILURE) - N = int(xmldoc.getElementsByTagName('agents')[0].childNodes[0].data) - fps= xmldoc.getElementsByTagName('frameRate')[0].childNodes[0].data #type unicode - fps = float(fps) - fps = int(fps) - print "fps=", fps - #fps = int(xmldoc.getElementsByTagName('frameRate')[0].childNodes[0].data) - logging.info ("Npeds = %d, fps = %d"%(N, fps)) - frames = xmldoc.childNodes[0].getElementsByTagName('frame') - data = [] - for frame in frames: - frame_number = int(frame.attributes["ID"].value) - for agent in frame.getElementsByTagName("agent"): - agent_id = int(agent.attributes["ID"].value) - x = float(agent.attributes["xPos"].value) - y = float(agent.attributes["yPos"].value) - data += [agent_id, frame_number, x, y] - data = np.array(data).reshape((-1,4)) - return fps, N, data - - - if __name__ == "__main__": if CWD != DIR: logging.info("working dir is %s. Change to %s"%(os.getcwd(), DIR)) diff --git a/Utest/utils.py b/Utest/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..88ae62a8d4fb77e9750721203d772803193f8139 --- /dev/null +++ b/Utest/utils.py @@ -0,0 +1,54 @@ +from xml.dom import minidom +import logging +import numpy as np + +SUCCESS = 0 +FAILURE = 1 + +def get_maxtime(filename): + """ + get max sim time + """ + logging.info("parsing <%s>"%filename) + try: + xmldoc = minidom.parse(filename) + except: + logging.critical('could not parse file. exit') + exit(FAILURE) + maxtime = float(xmldoc.getElementsByTagName('max_sim_time')[0].firstChild.nodeValue) + return maxtime + + +def parse_file(filename): + """ + parse trajectories in Travisto-format and output results + in the following format: id frame x y + (no sorting of the data is performed) + returns + N: number of pedestrians + data: trajectories + """ + logging.info("parsing <%s>"%filename) + try: + xmldoc = minidom.parse(filename) + except: + logging.critical('could not parse file. exit') + exit(FAILURE) + N = int(xmldoc.getElementsByTagName('agents')[0].childNodes[0].data) + fps= xmldoc.getElementsByTagName('frameRate')[0].childNodes[0].data #type unicode + fps = float(fps) + fps = int(fps) + print "fps=", fps + #fps = int(xmldoc.getElementsByTagName('frameRate')[0].childNodes[0].data) + logging.info ("Npeds = %d, fps = %d"%(N, fps)) + frames = xmldoc.childNodes[0].getElementsByTagName('frame') + data = [] + for frame in frames: + frame_number = int(frame.attributes["ID"].value) + for agent in frame.getElementsByTagName("agent"): + agent_id = int(agent.attributes["ID"].value) + x = float(agent.attributes["x"].value) + y = float(agent.attributes["y"].value) + data += [agent_id, frame_number, x, y] + data = np.array(data).reshape((-1,4)) + return fps, N, data diff --git a/general/ArgumentParser.cpp b/general/ArgumentParser.cpp index aff7bc63f5fd48fb7aef06629b5f7fa8c91a7b9f..f831c091c0aba18c4a26c2b76068ef6669b796f9 100644 --- a/general/ArgumentParser.cpp +++ b/general/ArgumentParser.cpp @@ -1099,12 +1099,14 @@ void ArgumentParser::ParseAgentParameters(TiXmlElement* operativModel) agentParameters->InitAtau(mu,sigma); Log->Write("INFO: \ttAtau mu=%f , sigma=%f",mu,sigma); } - double beta_c = 2; /// @todo quick and dirty - double max_Ea = agentParameters->GetAmin() + agentParameters->GetAtau()*agentParameters->GetV0(); - double max_Eb = 0.5*(agentParameters->GetBmin() + 0.49) ; /// @todo hard-coded value should be the same as in pedestrians GetEB - double max_Ea_Eb = (max_Ea>max_Eb)?max_Ea:max_Eb; - pDistEffMaxPed = 2 * beta_c * max_Ea_Eb; - pDistEffMaxWall = pDistEffMaxPed; + if(pModel == 2) { // Gompertz + double beta_c = 2; /// @todo quick and dirty + double max_Ea = agentParameters->GetAmin() + agentParameters->GetAtau()*agentParameters->GetV0(); + double max_Eb = 0.5*(agentParameters->GetBmin() + 0.49) ; /// @todo hard-coded value should be the same as in pedestrians GetEB + double max_Ea_Eb = (max_Ea>max_Eb)?max_Ea:max_Eb; + pDistEffMaxPed = 2 * beta_c * max_Ea_Eb; + pDistEffMaxWall = pDistEffMaxPed; + } } }