Hard-coded output matrix type and incomplete MatrixType definition
i-am-sijia opened this issue · 1 comments
i-am-sijia commented
Describe the bug
Failed to write out trip table matrices from CTRAMP, using the latest mtctm2.jar and common-base.jar.
08-Jun-2021 10:55:16:440, ERROR, InvocationTargetException exception making RMI method call: //172.22.78.49:1191/com.pb.mtctm2.abm.ctramp.MatrixDataServer.writeMatrixFile().
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at gnu.cajo.invoke.Remote.invoke(Unknown Source)
at gnu.cajo.invoke.Remote.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$240(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/1876363557.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at gnu.cajo.invoke.Remote_Stub.invoke(Unknown Source)
at gnu.cajo.invoke.Remote.invoke(Unknown Source)
at com.pb.mtctm2.abm.ctramp.UtilRmi.method(UtilRmi.java:123)
at com.pb.mtctm2.abm.ctramp.MatrixDataServerRmi.writeMatrixFile(MatrixDataServerRmi.java:41)
at com.pb.mtctm2.abm.application.MTCTM2TripTables.writeMatricesToFile(MTCTM2TripTables.java:546)
at com.pb.mtctm2.abm.application.MTCTM2TripTables.writeTrips(MTCTM2TripTables.java:503)
at com.pb.mtctm2.abm.application.MTCTM2TripTables.createTripTables(MTCTM2TripTables.java:282)
at com.pb.mtctm2.abm.application.MTCTM2TripTables.main(MTCTM2TripTables.java:717)
Caused by: java.lang.RuntimeException: Could not determine type of matrix file, D:\MTC\travel-model-two\ctramp_output\auto_EA_SOV_GP_EA.mat
at com.pb.common.matrix.MatrixReader.determineMatrixType(MatrixReader.java:193)
at com.pb.common.matrix.MatrixWriter.createWriter(MatrixWriter.java:115)
at com.pb.mtctm2.abm.ctramp.MatrixDataServer.writeMatrixFile(MatrixDataServer.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at gnu.cajo.invoke.Remote.invoke(Unknown Source)
at gnu.cajo.invoke.Remote.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$240(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/1876363557.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
To Reproduce
Steps to reproduce the behavior:
Run CTRAMP/runtime/runMTCTM2ABM.cmd
rem ### create demand matrices in Cube matrix format - must restart mtx manager before running?
java -Xmx200g -cp "%CLASSPATH%" -Dproject.folder=%PROJECT_DIRECTORY% com.pb.mtctm2.abm.application.MTCTM2TripTables mtctm2 -iteration %iteration% -sampleRate %sampleRate%
Triggering line of code
- output matrix file extension is hard-coded as "mat". Matrix writer uses filename extension to determine matrix type:
- ".mat" is not defined in the common-base DetermineMatrixType method
Thoughts on resolution
- Remove the hard-coded matrix file extension, replace it with reading from properties file
- Add if condition for ".mat" in DetermineMatrixType()
Environment
windows 10
java 1.8.0_31
i-am-sijia commented
I see in transit-ccr branch, the hard-coded matrix file extension is changed to omx
, instead of mat
. This is a quick solution to get the omx working, but in the long run, maybe it's better to define the matrix type in properties file.