Skip to content

Commit

Permalink
move carrier analysis in vsp contrib accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
kt86 committed Oct 11, 2023
1 parent 2cd1d09 commit d9be120
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.events.Event;
import org.matsim.contrib.freight.carriers.carrier.Carriers;
import org.matsim.contrib.freight.carriers.events.CarrierEventAttributes;
import org.matsim.contrib.freight.carriers.events.CarrierShipmentDeliveryStartEvent;
import org.matsim.contrib.freight.carriers.events.CarrierShipmentPickupStartEvent;
import org.matsim.core.events.handler.BasicEventHandler;
import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.VehicleType;
Expand Down Expand Up @@ -44,7 +47,7 @@ public CarrierLoadAnalysis(Carriers carriers) {

private void handlePickup(Event event) {
Id<Vehicle> vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle"));
Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND));
Integer demand = Integer.valueOf(event.getAttributes().get(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND));

LinkedList<Integer> list;
if (! vehicle2Load.containsKey(vehicleId)){
Expand All @@ -60,7 +63,7 @@ private void handlePickup(Event event) {

private void handleDelivery(Event event) {
Id<Vehicle> vehicleId = Id.createVehicleId(event.getAttributes().get("vehicle"));
Integer demand = Integer.valueOf(event.getAttributes().get(ATTRIBUTE_CAPACITYDEMAND));
Integer demand = Integer.valueOf(event.getAttributes().get(CarrierEventAttributes.ATTRIBUTE_CAPACITYDEMAND));

var list = vehicle2Load.get(vehicleId);
list.add(list.getLast() - demand);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.events.ActivityStartEvent;
import org.matsim.api.core.v01.population.Person;
import org.matsim.contrib.freight.carriers.carrier.*;
import org.matsim.contrib.freight.carriers.events.CarrierServiceEndEvent;
import org.matsim.contrib.freight.carriers.events.CarrierServiceStartEvent;

import java.util.LinkedHashMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.events.ActivityStartEvent;
import org.matsim.api.core.v01.network.Link;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -8,6 +8,9 @@
import org.matsim.api.core.v01.events.LinkEnterEvent;
import org.matsim.contrib.freight.carriers.carrier.Carrier;
import org.matsim.contrib.freight.carriers.carrier.Tour;
import org.matsim.contrib.freight.carriers.controler.FreightUtils;
import org.matsim.contrib.freight.carriers.events.CarrierTourEndEvent;
import org.matsim.contrib.freight.carriers.events.CarrierTourStartEvent;
import org.matsim.core.events.handler.BasicEventHandler;
import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.VehicleType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.matsim.api.core.v01.network.Network;
import org.matsim.contrib.freight.carriers.carrier.CarrierPlanXmlReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.Scenario;
import org.matsim.contrib.freight.carriers.FreightConfigGroup;
import org.matsim.contrib.freight.carriers.controler.FreightUtils;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.events.MatsimEventsReader;
import org.matsim.core.scenario.ScenarioUtils;
import org.matsim.contrib.freight.carriers.events.CarrierEventsReaders;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.junit.Rule;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.matsim.api.core.v01.events.*;
import org.matsim.api.core.v01.events.handler.*;
import org.matsim.api.core.v01.network.Network;
import org.matsim.contrib.freight.carriers.analysis.FreightAnalysisVehicleTracking;
import org.matsim.contrib.freight.carriers.carrier.Carriers;
import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.Vehicles;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.matsim.api.core.v01.events.ActivityStartEvent;
import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler;
import org.matsim.api.core.v01.network.Network;
import org.matsim.contrib.freight.carriers.analysis.FreightAnalysisServiceTracking;
import org.matsim.contrib.freight.carriers.carrier.Carrier;
import org.matsim.contrib.freight.carriers.carrier.CarrierService;
import org.matsim.contrib.freight.carriers.carrier.Carriers;
import org.matsim.contrib.freight.carriers.events.CarrierServiceEndEvent;
import org.matsim.contrib.freight.carriers.events.CarrierServiceStartEvent;
import org.matsim.contrib.freight.carriers.events.eventhandler.FreightServiceEndEventHandler;
import org.matsim.contrib.freight.carriers.events.eventhandler.FreightServiceStartEventHandler;
import org.matsim.vehicles.Vehicles;

class MyServiceTrackerEventHandler implements ActivityStartEventHandler, FreightServiceStartEventHandler, FreightServiceEndEventHandler {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.matsim.api.core.v01.events.ActivityStartEvent;
import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler;
import org.matsim.api.core.v01.network.Network;
import org.matsim.contrib.freight.carriers.analysis.FreightAnalysisShipmentTracking;
import org.matsim.contrib.freight.carriers.carrier.Carrier;
import org.matsim.contrib.freight.carriers.carrier.CarrierShipment;
import org.matsim.contrib.freight.carriers.carrier.Carriers;
import org.matsim.contrib.freight.carriers.events.CarrierShipmentDeliveryEndEvent;
import org.matsim.contrib.freight.carriers.events.CarrierShipmentPickupEndEvent;
import org.matsim.contrib.freight.carriers.events.eventhandler.FreightShipmentDeliveryEventHandler;
import org.matsim.contrib.freight.carriers.events.eventhandler.FreightShipmentPickupEventHandler;
import org.matsim.vehicles.Vehicles;

public class MyShipmentTrackerEventHandler implements ActivityStartEventHandler, FreightShipmentPickupEventHandler, FreightShipmentDeliveryEventHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
*
*/

package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.junit.*;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.population.Person;
Expand All @@ -33,7 +36,7 @@
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.vehicles.*;

import java.io.*;
import java.io.File;
import java.util.*;

public class RunFreightAnalysisIT {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.contrib.freight.analysis;
package org.matsim.contrib.freight.carriers.analysis;

import org.junit.Assert;
import org.junit.Rule;
Expand All @@ -15,7 +15,10 @@
import org.matsim.core.events.MatsimEventsReader;
import org.matsim.core.network.NetworkUtils;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.vehicles.*;
import org.matsim.vehicles.MatsimVehicleReader;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;
import org.matsim.vehicles.Vehicles;

import java.io.File;
import java.util.Iterator;
Expand Down

0 comments on commit d9be120

Please sign in to comment.