From 2dad8cd766121adda51d807072bb03983ef4af04 Mon Sep 17 00:00:00 2001 From: nixlaos Date: Thu, 21 Sep 2023 11:55:09 +0200 Subject: [PATCH 1/4] correcting typo --- ...sisEventbased.java => RunFreightAnalysisEventBased.java} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/{RunFreightAnalysisEventbased.java => RunFreightAnalysisEventBased.java} (97%) diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventbased.java b/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java similarity index 97% rename from contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventbased.java rename to contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java index bcc3753f621..d2db6bb2f4c 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventbased.java +++ b/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java @@ -48,9 +48,9 @@ * * @author kturner (Kai Martins-Turner) */ -public class RunFreightAnalysisEventbased { +public class RunFreightAnalysisEventBased { - private static final Logger log = LogManager.getLogger(RunFreightAnalysisEventbased.class); + private static final Logger log = LogManager.getLogger(RunFreightAnalysisEventBased.class); //Were is your simulation output, that should be analysed? private final String SIM_OUTPUT_PATH ; @@ -62,7 +62,7 @@ public class RunFreightAnalysisEventbased { * @param analysisOutputPath The directory where the result of the analysis should go to * @param globalCrs */ - public RunFreightAnalysisEventbased(String simOutputPath, String analysisOutputPath, String globalCrs) { + public RunFreightAnalysisEventBased(String simOutputPath, String analysisOutputPath, String globalCrs) { this.SIM_OUTPUT_PATH = simOutputPath; this.ANALYSIS_OUTPUT_PATH = analysisOutputPath; this.GLOBAL_CRS = globalCrs; From 2c7ca00415f458893d20c31d47d49fb2219f9612 Mon Sep 17 00:00:00 2001 From: nixlaos Date: Thu, 21 Sep 2023 13:03:24 +0200 Subject: [PATCH 2/4] jsprit score added to carrier stats --- .../matsim/contrib/freight/analysis/CarrierPlanAnalysis.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierPlanAnalysis.java b/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierPlanAnalysis.java index 5892430bf81..8de996a9bf0 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierPlanAnalysis.java +++ b/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/CarrierPlanAnalysis.java @@ -40,7 +40,7 @@ public void runAnalysisAndWriteStats(String analysisOutputDirectory) throws IOEx BufferedWriter bw1 = new BufferedWriter(new FileWriter(fileName)); //Write headline: - bw1.write("carrierId \t scoreOfSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfServices(input) "); + bw1.write("carrierId \t MATSimScoreSelectedPlan \t jSpritScoreSelectedPlan \t nuOfTours \t nuOfShipments(input) \t nuOfServices(input) "); bw1.newLine(); final TreeMap, Carrier> sortedCarrierMap = new TreeMap<>(carriers.getCarriers()); @@ -48,6 +48,7 @@ public void runAnalysisAndWriteStats(String analysisOutputDirectory) throws IOEx for (Carrier carrier : sortedCarrierMap.values()) { bw1.write(carrier.getId().toString()); bw1.write("\t" + carrier.getSelectedPlan().getScore()); + bw1.write("\t" + carrier.getSelectedPlan().getJspritScore()); bw1.write("\t" + carrier.getSelectedPlan().getScheduledTours().size()); bw1.write("\t" + carrier.getShipments().size()); bw1.write("\t" + carrier.getServices().size()); From 210f498b3645d0473d1d68e2e886b3906f73953f Mon Sep 17 00:00:00 2001 From: nixlaos Date: Thu, 21 Sep 2023 13:24:17 +0200 Subject: [PATCH 3/4] loading vehicleTypes from allVehicles-file --- .../contrib/freight/analysis/RunFreightAnalysisEventBased.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java b/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java index d2db6bb2f4c..3f5792e8ace 100644 --- a/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java +++ b/contribs/vsp/src/main/java/org/matsim/contrib/freight/analysis/RunFreightAnalysisEventBased.java @@ -81,7 +81,7 @@ public void runAnalysis() throws IOException { //freight settings FreightConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( config, FreightConfigGroup.class ) ; freightConfigGroup.setCarriersFile( SIM_OUTPUT_PATH + "output_carriers.xml.gz"); - freightConfigGroup.setCarriersVehicleTypesFile(SIM_OUTPUT_PATH + "output_carriersVehicleTypes.xml.gz"); + freightConfigGroup.setCarriersVehicleTypesFile(SIM_OUTPUT_PATH + "output_allVehicles.xml.gz"); //Were to store the analysis output? String analysisOutputDirectory = ANALYSIS_OUTPUT_PATH; From 3d48f591901e0b6aa483d2ae054270d072515e81 Mon Sep 17 00:00:00 2001 From: nixlaos Date: Thu, 21 Sep 2023 13:24:47 +0200 Subject: [PATCH 4/4] new test for event based freight analysis --- .../FreightAnalysisEventBasedTest.java | 25 ++++++++++++++++++ .../output_allVehicles.xml.gz | Bin 0 -> 499 bytes .../output_carriers.xml.gz | Bin 0 -> 750 bytes .../output_events.xml.gz | Bin 0 -> 1622 bytes .../output_network.xml.gz | Bin 0 -> 2493 bytes .../Carrier_stats.tsv | 2 ++ .../Load_perVehicle.tsv | 1 + .../TimeDistance_perVehicle.tsv | 1 + .../TimeDistance_perVehicleType.tsv | 2 ++ 9 files changed, 31 insertions(+) create mode 100644 contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_carriers.xml.gz create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv create mode 100644 contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv diff --git a/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java b/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java new file mode 100644 index 00000000000..4974a90d130 --- /dev/null +++ b/contribs/vsp/src/test/java/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest.java @@ -0,0 +1,25 @@ +package org.matsim.contrib.freight.analysis; + +import org.junit.Rule; +import org.junit.Test; +import org.matsim.testcases.MatsimTestUtils; + +import java.io.IOException; + +public class FreightAnalysisEventBasedTest { + + @Rule + public MatsimTestUtils testUtils = new MatsimTestUtils(); + + @Test + public void runFreightAnalysisEventBasedTest() throws IOException { + + RunFreightAnalysisEventBased analysisEventBased = new RunFreightAnalysisEventBased(testUtils.getClassInputDirectory(), testUtils.getOutputDirectory(),null); + analysisEventBased.runAnalysis(); + + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Carrier_stats.tsv", testUtils.getOutputDirectory() + "Carrier_stats.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "Load_perVehicle.tsv", testUtils.getOutputDirectory() + "Load_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicle.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicle.tsv"); + MatsimTestUtils.assertEqualFilesLineByLine(testUtils.getInputDirectory() + "TimeDistance_perVehicleType.tsv", testUtils.getOutputDirectory() + "TimeDistance_perVehicleType.tsv"); + } +} diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_allVehicles.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..199380ef6a00f3cbdf64aa1d06dfc09a60ad7ca5 GIT binary patch literal 499 zcmVr$Diq^u>4LEI;t|1(1$`Lq#{j&Zhebf=Mrv9 zY-XDTzWpvv89}YoZBL2+zWdqtzjJ(ds7h9Yv8YwTM?u6HD5*14MZ%vp55oz+n_XSS zHEdCqFozr!ItsRoGL=pE*16p@44bA2D&Z_vfi^{$V+l6QT*kY&>A~VfZ1c&-T}RO< zd|o}SXnG;i1vhOgPLhU6NE<|a#)!!XS|$G(C5dy zi%WEU^`V#MR0s~!;Cs_>_-umgcZ}3XFQrln{MmziXON{Cq@ zCogDK!2sRRQ9;Z3C@UqKGl8x`FLj&WoAuqj0Kl@MPrTrgveFeV@PcZidHy30Og zkGIHjY}hl;iyEtG@8&SY@wDLcXZgj9A!o)`OZkzP-!hoB=zBvvxJQnBTQSw4=fZwb zQ9y9{AgPcO4)|1`*8WrkbYFhAHP%l)ZLb%Zm+J|sPmK6R0wbZ3$jI2prIA>Px{i2|x@Iwp=mKL) zZe}~1ozLv8?vNRY75T3-!#ME{GE->2AqK%VTvCg9)z;>d%eG) ze~%b-VhqO#KFWBRg#IC8WEn%P$_!6pB^_AD_IUr0b)gv>RDLRI*a;PCER2uc)L4xl zpc1>C1TLr1&}v}Sw@P#_L_NWds$JYMC$N<5{}5$R|F>6RT|(_%wa{s6A;!6gaV}z< zi=0s3em6hzju&_q7a-WQx}In&e@BD*O+mpciCcERg;b|eXN7H@8TGCH gtGk-I>IK%1vHIt%uc>M^4S1-30Br~3G}{aS0KsQ@aR2}S literal 0 HcmV?d00001 diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_events.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..23e96d838a79a1ac748b180e72b12243bb4ce7ec GIT binary patch literal 1622 zcmV-c2C4ZUiwFP!000000L`4=Z`(Ey$Dh}~!thfIbSouNBn2et)800q7>2zXhQlOE zT_;dfZ~N~jJ6V%+#G@j8&(>3$HumT4NFMK(boTk5Z|m7M)DP9&=6s(0qUN)(S>0V$ zo9pxW_vY$nKmUC3?ksG>rg@;hc=7J1$A6zS)wggy&oisk?hBfK@7o`jt0rtN=d=6v zGrNym)uFn+X%?$xU00#b7Ta+1{|}3-T&#Eh`&YQBR_n0H=CgIR`FcLTeXl-dAO4un z+OPX_|Gf{*vTo+H*{1~mGTgVn_`MD=5!T`Q_q)sXtJ{zC5a7$6`s=1?|9tw=;i7CG z|N8b1CdC}JPU`gQ^jd_It&U6{n4&qFT3V^o`P!uob}OS!XK4jbXCEg1baqp7rF3G`qPGu4b}O0-P)j*C z6tiuaa6>yq;nYk!R#5@l5@ffc8c)r0&fkjImLOw_;;D}FMl!Z_NoQp6RBbtDBw|~F zj42AI8pS&!0oxK}cc`$Vf@99yl)N{RFm9RjMg^W)X#YAWT8HH}08^H+D>No3q8dKt zj=$~on^cZZ#oT>#yIjL8pUkii@T=yj8UW%y7a2mmtyZC12CMlCLty(8WcQ)7c&f9! zAC*RSE9&r6uS>G4AO*%Z?I|Jwu*BH=U=aZ(TVkYQN|mlodJlM`*pyKsj3CTd^a8J# z<-X)o42hFoCQ}TLr%kIRi;;d`Yqy2$w8RbcNE zWXy-c!z*nK7t$Sp+3j4c0G9N7QDYr%*;PaU;9N)FgGKn09qXWCLUZGZ+yYK>_qj+2 zL6EV)MZ>Ai3Ek%z&Q*+C%9k2Ww%Sd_gjKt3&v~)~JgnMn4@c@a=j$DRr3-9-f{YzH z1Ew0K_#%xoGNxz&r#cV1&j;=)Dgm(C-S=Qo0VZ4RreZ>G^oiU9t%m$mpFliIna8TS zm`rm8Ly?0{kTLgS(bPQSOTYrQCCFn{T}`^bZPW^l^0!36$rjS6n7~4s>yz&v(1C?C*SF+hjOS-eL^i+gF=T?r+AK9?BFv06 zNAXyvEGY6GxUGl)&`MgrlSTNGt)x*gwDAoAE?-djlS;5~MBKyDS@i-

h34$pjN7Jr`s} zut#`M?Ue7^oEckHbf>E*jd&+!wA`cIC{b{_`4JHlmLEMDKJ7&*9hM$F;(JB0 zHaGB^{RjboVRX+mp!~^3(Ns*SDEfpBqg9Zvj^Uj!MRwnE1-w&WHQW1?M;FC-7LC=);IJV-?_WUscPX^UGOCd zab`@_0**DFfBsCI8B^83u{P(Q`VnWwRMl{-EBNPr#F;TwN4)1Jg7rS-mV}uC0~Xy_ zuX6rv9^y=argj9I75r;1#F+w3?Fcsa9j#LIeEuoljZHP2Y-&Zt1f^E}yK4t{*o1zx UyLR?z&wsf158`1mIN4+X02-?_2LJ#7 literal 0 HcmV?d00001 diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/output_network.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..cb668e2933be9be78d131bab45abf47d9c42a048 GIT binary patch literal 2493 zcmbu6X*iqd8po?ig(9f2jki*zWpuF&J#VhW*4V1kSjsTf+FHhOv_ctzAWSXcpsiLL zK_t^dY^^bur8*);e1FA4TG|^fD-YLgqk9A#K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&I9P<^zo3GE4I_OpKr${1w3b^e!;GE1J?quey3z3z;_(R`*Kd9_ zo61{hj{&pse|ALIVC;5u(z3*)TGg#C)-W=}EXeR?h}k8)KJQyGR)ga;fc=u=#h_UO zjlU7;nN@AXUoxwF(c$2=f65&daZU0_MO<%OAIk=f+R9eVW>lJE$cMArql`=itZnJQ95H<-J58H^gj?#n9RvGk5_Veo`7sCs*ZGN8yi=t87eXd>_-eWVmD} dA#i=8NA|(syIYN~*v^}5%NZYQPRfA;{{;$c&VT>_ literal 0 HcmV?d00001 diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv new file mode 100644 index 00000000000..21421192918 --- /dev/null +++ b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Carrier_stats.tsv @@ -0,0 +1,2 @@ +carrierId MATSimScoreSelectedPlan jSpritScoreSelectedPlan nuOfTours nuOfShipments(input) nuOfServices(input) +carrier1 -263.4 null 2 0 7 diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv new file mode 100644 index 00000000000..8cff896d44c --- /dev/null +++ b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/Load_perVehicle.tsv @@ -0,0 +1 @@ +vehicleId capacity maxLoad load state during tour diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv new file mode 100644 index 00000000000..a3716b50cdc --- /dev/null +++ b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicle.tsv @@ -0,0 +1 @@ +vehicleId carrierId vehicleTypeId tourId tourDuration[s] travelDistance[m] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR] varCostsTime[EUR] varCostsDist[EUR] totalCosts[EUR] diff --git a/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv new file mode 100644 index 00000000000..dacd1779828 --- /dev/null +++ b/contribs/vsp/test/input/org/matsim/contrib/freight/analysis/FreightAnalysisEventBasedTest/runFreightAnalysisEventBasedTest/TimeDistance_perVehicleType.tsv @@ -0,0 +1,2 @@ +vehicleTypeId nuOfVehicles SumOfTourDuration[s] SumOfTravelDistances[m] costPerSecond[EUR/s] costPerMeter[EUR/m] fixedCosts[EUR/veh] varCostsTime[EUR] varCostsDist[EUR] fixedCosts[EUR] totalCosts[EUR] +light 0 0.0 60000.0 0.008 4.7E-4 84.0 0.0 28.2 0.0 28.2