Skip to content

Commit

Permalink
all model changes with emme integration with old network
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensle committed Mar 26, 2021
1 parent 04366d1 commit 8f582db
Show file tree
Hide file tree
Showing 9 changed files with 442 additions and 87 deletions.
89 changes: 71 additions & 18 deletions model-files/RunModel.bat
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ SET /A MAX_ITERATION=3
SET /A MAX_INNER_ITERATION=1

:: Set choice model household sample rate
SET SAMPLERATE_ITERATION1=0.01
SET SAMPLERATE_ITERATION2=0.01
SET SAMPLERATE_ITERATION3=0.02
SET SAMPLERATE_ITERATION1=0.3
SET SAMPLERATE_ITERATION2=0.5
SET SAMPLERATE_ITERATION3=1
SET SAMPLERATE_ITERATION4=0.02
SET SAMPLERATE_ITERATION5=0.02

Expand All @@ -71,13 +71,19 @@ set PATH=%CD%\CTRAMP\runtime;C:\Windows\System32;%JAVA_PATH%\bin;%TPP_PATH%;%CUB
CALL conda activate mtc_py2




:: --------- restart block ------------------------------------------------------------------------------
:: Use these only if restarting
:: SET /A ITERATION=3
:: SET /A INNER_ITERATION=1
:: IF %ITERATION% EQU 3 SET SAMPLERATE=%SAMPLERATE_ITERATION3%
:: call zoneSystem.bat
::goto starthere
SET /A ITERATION=3
SET /A INNER_ITERATION=1
IF %ITERATION% EQU 1 SET SAMPLERATE=%SAMPLERATE_ITERATION1%
IF %ITERATION% EQU 2 SET SAMPLERATE=%SAMPLERATE_ITERATION2%
IF %ITERATION% EQU 3 SET SAMPLERATE=%SAMPLERATE_ITERATION3%
IF %ITERATION% EQU 4 SET SAMPLERATE=%SAMPLERATE_ITERATION4%
IF %ITERATION% EQU 5 SET SAMPLERATE=%SAMPLERATE_ITERATION5%
REM call zoneSystem.bat
REM goto core
:: ------------------------------------------------------------------------------------------------------


Expand Down Expand Up @@ -292,14 +298,35 @@ if ERRORLEVEL 2 goto done
runtpp %BASE_SCRIPTS%\skims\BuildTransitNetworks.job
if ERRORLEVEL 2 goto done

:transitskimsprep
runtpp %BASE_SCRIPTS%\skims\TransitSkimsPrep.job
if ERRORLEVEL 2 goto done

runtpp %BASE_SCRIPTS%\skims\TransitSkims.job
if ERRORLEVEL 2 goto done
:createemmenetwork
:: changing to python 3 environment for emme
CALL conda deactivate
CALL conda activate mtc

runtpp %BASE_SCRIPTS%\skims\SkimSetsAdjustment.job
if ERRORLEVEL 2 goto done
:: Create emme project from scratch since it's the first iteration
python cube_to_emme_network_conversion.py -p "trn" --first_iteration "yes"
IF ERRORLEVEL 1 goto done

%EMME_PYTHON_PATH%\python create_emme_network.py -p "trn" --name "mtc_emme_full_run_no_ccr" --first_iteration "yes"
IF ERRORLEVEL 1 goto done

%EMME_PYTHON_PATH%\python skim_transit_network.py -p "trn" --first_iteration "yes"
IF ERRORLEVEL 1 goto done

CALL conda deactivate
CALL conda activate mtc_py2
REM goto done
:afteremmeskims

REM runtpp %BASE_SCRIPTS%\skims\TransitSkims.job
REM if ERRORLEVEL 2 goto done

REM runtpp %BASE_SCRIPTS%\skims\SkimSetsAdjustment.job
REM if ERRORLEVEL 2 goto done


::Step X: Main model iteration setup
Expand Down Expand Up @@ -375,6 +402,7 @@ copy CTRAMP\runtime\mtctm2.properties mtctm2.properties /Y
call CTRAMP\runtime\runMTCTM2ABM.cmd %SAMPLERATE% %ITERATION% "%JAVA_PATH%"
if ERRORLEVEL 2 goto done
del mtctm2.properties
goto done

taskkill /im "java.exe" /F

Expand All @@ -393,8 +421,9 @@ IF NOT %HH_SERVER%==localhost (

:: copy results back over here
ROBOCOPY "%MATRIX_SERVER_BASE_DIR%\ctramp_output" ctramp_output *.mat /NDL /NFL
ROBOCOPY "%MATRIX_SERVER_BASE_DIR%\ctramp_output" ctramp_output *.omx /NDL /NFL


:afterrobocopy
runtpp CTRAMP\scripts\assign\merge_auto_matrices.s
if ERRORLEVEL 2 goto done

Expand Down Expand Up @@ -468,14 +497,27 @@ IF %ITERATION% LSS %MAX_ITERATION% (

)

:here

runtpp %BASE_SCRIPTS%\skims\BuildTransitNetworks.job
if ERRORLEVEL 2 goto done

runtpp %BASE_SCRIPTS%\skims\TransitSkimsPrep.job
if ERRORLEVEL 2 goto done

:emmeseconditeration
:: changing to python 3 environment for emme
CALL conda deactivate
CALL conda activate mtc
:: Emme project already created, just updating congested link times
python cube_to_emme_network_conversion.py -p "trn" --first_iteration "no"
IF ERRORLEVEL 1 goto done
%EMME_PYTHON_PATH%\python create_emme_network.py -p "trn" --first_iteration "no"
IF ERRORLEVEL 1 goto done
:: changing back to python 2 environment
CALL conda deactivate
CALL conda activate mtc_py2
REM goto done

:: Create the block file that controls whether the crowding functions are called during transit assignment.
python %BASE_SCRIPTS%\assign\transit_assign_set_type.py CTRAMP\runtime\mtctm2.properties CTRAMP\scripts\block\transit_assign_type.block

Expand All @@ -487,13 +529,24 @@ SET /A INNER_ITERATION+=1
runtpp CTRAMP\scripts\assign\merge_transit_matrices.s
if ERRORLEVEL 2 goto done

:innerskim
CALL conda deactivate
CALL conda activate mtc

%EMME_PYTHON_PATH%\python skim_transit_network.py -p "trn" --first_iteration "no"
IF ERRORLEVEL 1 goto done

:: changing back to python 2 environment
CALL conda deactivate
CALL conda activate mtc_py2
:afterinnerskim

:: Run Transit Assignment
runtpp CTRAMP\scripts\assign\TransitAssign.job
if ERRORLEVEL 2 goto done
REM runtpp CTRAMP\scripts\assign\TransitAssign.job
REM if ERRORLEVEL 2 goto done

runtpp %BASE_SCRIPTS%\skims\SkimSetsAdjustment.job
if ERRORLEVEL 2 goto done
REM runtpp %BASE_SCRIPTS%\skims\SkimSetsAdjustment.job
REM if ERRORLEVEL 2 goto done

:: Start Matrix Server remotely or locally
IF %RUNTYPE%==LOCAL (
Expand Down
9 changes: 7 additions & 2 deletions model-files/runtime/CTRampEnv.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rem this file has environment variables for CT-RAMP batch files

:: The location of the 64-bit java development kit or runtime environment
set JAVA_PATH=C:\Program Files\Java\jre1.8.0_261
set JAVA_PATH="C:\Program Files\Java\jre1.8.0_261"

:: The location of the RUNTPP executable from Citilabs
set TPP_PATH=C:\Program Files\Citilabs\CubeVoyager
Expand All @@ -10,7 +10,12 @@ set TPP_PATH=C:\Program Files\Citilabs\CubeVoyager
set CUBE_PATH=C:\Program Files (x86)\Citilabs\Cube

:: Location of Emme python executable
SET EMME_PYTHON_PATH="C:\Program Files\INRO\Emme\Emme 4\Emme-4.4.2\Python27"
::SET EMME_PYTHON_PATH="C:\Program Files\INRO\Emme\Emme 4\Emme-4.4.2\Python27"
SET EMMEPATH=C:\Program Files\INRO\Emme\Emme 4\Emme-test-4.4.5-v1
SET EMME_PYTHON_PATH="C:\Program Files\INRO\Emme\Emme 4\Emme-test-4.4.5-v1\Python27"
:: BEWARE path issues with other python installs
path=%EMMEPATH%\programs;%EMMEPATH%\Python27;%EMMEPATH%\Python27\Scripts\;%PATH%
SET NUMBER_OF_PROCESSORS=56

:: The location of the Python executable
:: set PYTHON_PATH=C:\Program Files\anaconda2
Expand Down
14 changes: 7 additions & 7 deletions model-files/runtime/mtctm2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ HouseholdManager.HH.ValueOfTime.Multiplier.Under18 = 0.66667
# AV.ProbabilityBoost: The increased probability (multiplicative) for using AVs for tours, based on autos to drivers. The highest
# this should go is equal to ...
# AV.IVTFactor: The auto in-vehicle time factor to apply to AVs
#
#
Mobility.AV.Share = 0.0
Mobility.AV.ProbabilityBoost.AutosLTDrivers = 1.2
Mobility.AV.ProbabilityBoost.AutosGEDrivers = 1.1
Expand All @@ -100,12 +100,12 @@ WaitTimeDistribution.EndPopEmpPerSqMi = 500,2000,5000,15000,9999999999
############################################################################################################################################################################
#
# TRANSIT ASSIGNMENT PARAMETERS: Toggle and controls for managing Cube PT transit crowding assignments
#
#
# These properties are used to generate the Cube PT Assignment script, and are not used in the Java code.
# A python script, transit_assign_type_set.py, reads these flags and builds a Cube block script that is read
# in dynamically during the PT assignment process.
#
# transit.crowding: Master toggle to enable adjustlink and adjustwait.
#
# transit.crowding: Master toggle to enable adjustlink and adjustwait.
# transit.crowding.adjustlink: Toggle to enable link travel-time adjustment based on crowding
# transit.crowding.adjustwait: Toggle to enable wait adjusted travel times and bump boardings from crowding
#
Expand Down Expand Up @@ -144,7 +144,7 @@ occ3plus.purpose.WorkBased = 3.33
#
# CORE MODEL RUN PROPERTIES: CONTROL STEPS RUN IN CORE MODEL
#
#############################################################################################################################################################################
#############################################################################################################################################################################
Model.Random.Seed = 1

# Set to true if read the accessibilities from an input file instead of calculating them prior to running CTRAMP
Expand All @@ -154,7 +154,7 @@ acc.read.input.file = false
# Then copy shadow price output files to input directory, set maximum iterations to 1 for any subsequent runs with the same land-use file.
#UsualWorkLocationChoice.ShadowPrice.Input.File = /ctramp_output/ShadowPricingOutput_work_9.csv
#UsualSchoolLocationChoice.ShadowPrice.Input.File = /ctramp_output/ShadowPricingOutput_school_9.csv
uwsl.ShadowPricing.Work.MaximumIterations = 10
uwsl.ShadowPricing.Work.MaximumIterations = 1
uwsl.ShadowPricing.School.MaximumIterations = 1
uwsl.ShadowPricing.OutputFile = /ctramp_output/ShadowPricingOutput.csv

Expand Down Expand Up @@ -263,7 +263,7 @@ Results.MatrixType = OMX
#
# If IntrazonalOnly = False, then both intrazonal trips and trips whose distance is less than TripMaxDistance
# get put into one of the CountySets based on the origin MAZ county code, so long as both origin and dest MAZ
# are within the same CountySet.
# are within the same CountySet.
#
# Note tha the output trip tables for each set are sequentially numbered from 1 to N where N is the total
# number of MAZs in each county set.
Expand Down
2 changes: 1 addition & 1 deletion model-files/runtime/runHhMgr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set PATH=%JAVA_PATH%\bin;%OLDPATH%

rem ### Change current directory to RUNTIME, and issue the java command to run the model.
ECHO ***calling: java -server -Xmx35000m -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_hh.xml com.pb.mtctm2.abm.application.SandagHouseholdDataManager2 -hostname %HOST_IP_ADDRESS% -port %HOST_PORT%
START "Household Manager" %JAVA_PATH%\bin\java -server -Xmx35000m -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_hh.xml com.pb.mtctm2.abm.application.SandagHouseholdDataManager2 -hostname %HOST_IP_ADDRESS% -port %HOST_PORT%
START "Household Manager" java -server -Xmx35000m -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_hh.xml com.pb.mtctm2.abm.application.SandagHouseholdDataManager2 -hostname %HOST_IP_ADDRESS% -port %HOST_PORT%
rem java -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y -server -Xms40000m -Xmx40000m -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_hh.xml com.pb.mtctm2.abm.application.SandagHouseholdDataManager2 -hostname %HOST_IP_ADDRESS% -port %HOST_PORT%

rem ### restore saved environment variable values, and change back to original current directory
Expand Down
6 changes: 4 additions & 2 deletions model-files/runtime/runMTCTM2ABM.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ rem ### Change the PATH environment variable so that JAVA_HOME is listed first i
rem ### Doing this ensures that the JAVA_HOME path we defined above is the on that gets used in case other java paths are in PATH.
set PATH=%JAVA_PATH%\bin;%OLDPATH%

rem ### Run ABM LOCAL
rem java -server -Xmx130g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j.xml -Dproject.folder=%PROJECT_DIRECTORY% -Djppf.config=jppf-clientLocal.properties com.pb.mtctm2.abm.application.MTCTM2TourBasedModel mtctm2 -iteration %iteration% -sampleRate %sampleRate% -sampleSeed 0
rem ### Run ABM LOCAL
java -server -Xmx130g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j.xml -Dproject.folder=%PROJECT_DIRECTORY% -Djppf.config=jppf-clientLocal.properties com.pb.mtctm2.abm.application.MTCTM2TourBasedModel mtctm2 -iteration %iteration% -sampleRate %sampleRate% -sampleSeed 0
rem java -Xdebug -Xrunjdwp:transport=dt_socket,address=1045,server=y,suspend=y -server -Xmx130g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j.xml -Dproject.folder=%PROJECT_DIRECTORY% -Djppf.config=jppf-clientLocal.properties com.pb.mtctm2.abm.application.MTCTM2TourBasedModel mtctm2 -iteration 1 -sampleRate %sampleRate% -sampleSeed 0
rem java -agentlib:jdwp=transport=dt_socket,address=1045,server=y,suspend=y -server Xmx130g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j.xml -Dproject.folder=%PROJECT_DIRECTORY% -Djppf.config=jppf-clientLocal.properties com.pb.mtctm2.abm.application.MTCTM2TourBasedModel mtctm2 -iteration 1 -sampleRate %sampleRate% -sampleSeed 0

Expand All @@ -42,6 +42,8 @@ rem java -Xdebug -Xrunjdwp:transport=dt_socket,address=1045,server=y,suspend=y -
rem java -server -Xmx130g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j.xml -Dproject.folder=%PROJECT_DIRECTORY% -Djppf.config=jppf-clientDistributed.properties com.pb.mtctm2.abm.application.MTCTM2TourBasedModel mtctm2 -iteration 1 -sampleRate %sampleRate% -sampleSeed 0

rem ### create demand matrices in Cube matrix format - must restart mtx manager before running?
del %PROJECT_DIRECTORY%\ctramp_output\*.omx
del %PROJECT_DIRECTORY%\ctramp_output\*.mat
java -Xmx100g -cp "%CLASSPATH%" -Dproject.folder=%PROJECT_DIRECTORY% com.pb.mtctm2.abm.application.MTCTM2TripTables mtctm2 -iteration %iteration% -sampleRate %sampleRate%
rem java -Xdebug -Xrunjdwp:transport=dt_socket,address=1045,server=y,suspend=y -server -Xmx80g -cp "%CLASSPATH%" -Dproject.folder=%PROJECT_DIRECTORY% com.pb.mtctm2.abm.application.MTCTM2TripTables mtctm2 -iteration %iteration% -sampleRate %sampleRate%

Expand Down
2 changes: 1 addition & 1 deletion model-files/runtime/runMtxMgr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ set PATH=%LIB_JAR_PATH%;%OLDPATH%

rem java -Dname=p%HOST_MATRIX_PORT% -Xdebug -Xrunjdwp:transport=dt_socket,address=1049,server=y,suspend=y -server -Xmx64g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_mtx.xml com.pb.mtctm2.abm.ctramp.MatrixDataServer -hostname %HOST_IP_ADDRESS% -port %HOST_MATRIX_PORT% -label "MTCTM2 Matrix Sever"
ECHO ***calling: %JAVA_PATH%\bin\java -Dname=p%HOST_MATRIX_PORT% -Xmx75g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_mtx.xml com.pb.mtctm2.abm.ctramp.MatrixDataServer -hostname %HOST_IP_ADDRESS% -port %HOST_MATRIX_PORT% -label "MTCTM2 Matrix Server"
START "Matrix Manager" %JAVA_PATH%\bin\java -Djava.library.path=%LIB_JAR_PATH% -Dname=p%HOST_MATRIX_PORT% -Xmx64g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_mtx.xml com.pb.mtctm2.abm.ctramp.MatrixDataServer -hostname %HOST_IP_ADDRESS% -port %HOST_MATRIX_PORT% -label "MTCTM2 Matrix Server"
START "Matrix Manager" java -Djava.library.path=%LIB_JAR_PATH% -Dname=p%HOST_MATRIX_PORT% -Xmx64g -cp "%CLASSPATH%" -Dlog4j.configuration=log4j_mtx.xml com.pb.mtctm2.abm.ctramp.MatrixDataServer -hostname %HOST_IP_ADDRESS% -port %HOST_MATRIX_PORT% -label "MTCTM2 Matrix Server"

rem ### restore saved environment variable values, and change back to original current directory
set JAVA_PATH=%OLDJAVAPATH%
Expand Down
Loading

0 comments on commit 8f582db

Please sign in to comment.