Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #325 from matsim-vsp/dependabot/maven/org.matsim-m…
Browse files Browse the repository at this point in the history
…atsim-all-2025.0-2024w46

Bump org.matsim:matsim-all from 2025.0-2024w42 to 2025.0-2024w46
  • Loading branch information
kt86 authored Nov 12, 2024
2 parents 28fd588 + af4fe05 commit 38d2f47
Show file tree
Hide file tree
Showing 65 changed files with 1,059 additions and 940 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.matsim</groupId>
<artifactId>matsim-all</artifactId>
<version>2025.0-2024w42</version>
<version>2025.0-PR3560</version>
<!-- <version>2025.0-PR3390</version>-->
<!-- <version>2025.0-2024w36</version>-->
<!-- <version>2025.0-SNAPSHOT</version>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Random;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.core.config.Config;
Expand All @@ -41,6 +42,7 @@
import org.matsim.freight.logistics.shipment.LspShipmentUtils;
import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;

/*package-private*/ class ExampleSchedulingOfInitialPlan {

Expand All @@ -49,19 +51,17 @@ private static LSP createInitialLSP(Scenario scenario) {
// The Carrier for the resource of the sole LogisticsSolutionElement of the LSP is created
Id<Carrier> carrierId = Id.create("CollectionCarrier", Carrier.class);
Id<VehicleType> vehicleTypeId = Id.create("CollectionCarrierVehicleType", VehicleType.class);
CarrierVehicleType.Builder vehicleTypeBuilder =
CarrierVehicleType.Builder.newInstance(vehicleTypeId);
vehicleTypeBuilder.setCapacity(10);
vehicleTypeBuilder.setCostPerDistanceUnit(0.0004);
vehicleTypeBuilder.setCostPerTimeUnit(0.38);
vehicleTypeBuilder.setFixCost(49);
vehicleTypeBuilder.setMaxVelocity(50 / 3.6);
org.matsim.vehicles.VehicleType collectionType = vehicleTypeBuilder.build();
VehicleType collectionVehType = VehicleUtils.createVehicleType(vehicleTypeId, TransportMode.car);
collectionVehType.getCapacity().setOther(10);
collectionVehType.getCostInformation().setCostsPerMeter(0.0004);
collectionVehType.getCostInformation().setCostsPerSecond(0.38);
collectionVehType.getCostInformation().setFixedCost(49.);
collectionVehType.setMaximumVelocity(50 / 3.6);

Id<Link> collectionLinkId = Id.createLinkId("(4 2) (4 3)");
Id<Vehicle> vollectionVehicleId = Id.createVehicleId("CollectionVehicle");
CarrierVehicle carrierVehicle =
CarrierVehicle.newInstance(vollectionVehicleId, collectionLinkId, collectionType);
CarrierVehicle.newInstance(vollectionVehicleId, collectionLinkId, collectionVehType);

CarrierCapabilities capabilities = CarrierCapabilities.Builder.newInstance()
.addVehicle(carrierVehicle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Random;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.core.config.Config;
Expand All @@ -43,6 +44,7 @@
import org.matsim.freight.logistics.shipment.LspShipmentUtils;
import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;

/*A transport chain with five elements (collection-> reloading -> main run -> reloading -> delivery) is created and scheduled
*
Expand All @@ -57,19 +59,17 @@ private static LSP createInitialLSP(Scenario scenario) {
// The Carrier for collection is created
Id<Carrier> collectionCarrierId = Id.create("CollectionCarrier", Carrier.class);
Id<VehicleType> vehicleTypeId = Id.create("CollectionCarrierVehicleType", VehicleType.class);
CarrierVehicleType.Builder vehicleTypeBuilder =
CarrierVehicleType.Builder.newInstance(vehicleTypeId);
vehicleTypeBuilder.setCapacity(10);
vehicleTypeBuilder.setCostPerDistanceUnit(0.0004);
vehicleTypeBuilder.setCostPerTimeUnit(0.38);
vehicleTypeBuilder.setFixCost(49);
vehicleTypeBuilder.setMaxVelocity(50 / 3.6);
VehicleType collectionType = vehicleTypeBuilder.build();
VehicleType collectionVehType = VehicleUtils.createVehicleType(vehicleTypeId, TransportMode.car);
collectionVehType.getCapacity().setOther(10);
collectionVehType.getCostInformation().setCostsPerMeter(0.0004);
collectionVehType.getCostInformation().setCostsPerSecond(0.38);
collectionVehType.getCostInformation().setFixedCost(49.);
collectionVehType.setMaximumVelocity(50 / 3.6);

Id<Link> collectionLinkId = Id.createLinkId("(4 2) (4 3)");
Id<Vehicle> vollectionVehicleId = Id.createVehicleId("CollectionVehicle");
CarrierVehicle carrierVehicle =
CarrierVehicle.newInstance(vollectionVehicleId, collectionLinkId, collectionType);
CarrierVehicle.newInstance(vollectionVehicleId, collectionLinkId, collectionVehType);

CarrierCapabilities.Builder capabilitiesBuilder = CarrierCapabilities.Builder.newInstance();
capabilitiesBuilder.addVehicle(carrierVehicle);
Expand Down Expand Up @@ -124,20 +124,20 @@ private static LSP createInitialLSP(Scenario scenario) {

// The Carrier for the main run Resource is created
Id<Carrier> mainRunCarrierId = Id.create("MainRunCarrier", Carrier.class);
final VehicleType mainRunType =
CarrierVehicleType.Builder.newInstance(
Id.create("MainRunCarrierVehicleType", VehicleType.class))
.setCapacity(30)
.setCostPerDistanceUnit(0.0002)
.setCostPerTimeUnit(0.38)
.setFixCost(120)
.setMaxVelocity(50 / 3.6)
.build();
Id<VehicleType> mainRunVehTypeId = Id.create("MainRunCarrierVehicleType", VehicleType.class);
final VehicleType mainRunVehType = VehicleUtils.createVehicleType(mainRunVehTypeId, TransportMode.car);
mainRunVehType.getCapacity().setOther(30);
mainRunVehType.getCostInformation().setCostsPerMeter(0.0002);
mainRunVehType.getCostInformation().setCostsPerSecond(0.38);
mainRunVehType.getCostInformation().setFixedCost(120.);
mainRunVehType.setMaximumVelocity(50 / 3.6);
mainRunVehType.setNetworkMode(TransportMode.car);


Id<Link> fromLinkId = Id.createLinkId("(4 2) (4 3)");
Id<Vehicle> mainRunVehicleId = Id.createVehicleId("MainRunVehicle");
CarrierVehicle mainRunCarrierVehicle =
CarrierVehicle.newInstance(mainRunVehicleId, fromLinkId, mainRunType);
CarrierVehicle.newInstance(mainRunVehicleId, fromLinkId, mainRunVehType);

CarrierCapabilities mainRunCapabilities =
CarrierCapabilities.Builder.newInstance()
Expand Down Expand Up @@ -190,21 +190,20 @@ private static LSP createInitialLSP(Scenario scenario) {

// The Carrier for distribution is created
Id<Carrier> distributionCarrierId = Id.create("DistributionCarrier", Carrier.class);
Id<VehicleType> distributionVehicleTypeId =
Id.create("DistributionCarrierVehicleType", VehicleType.class);
VehicleType distributionType =
CarrierVehicleType.Builder.newInstance(distributionVehicleTypeId)
.setCapacity(10)
.setCostPerDistanceUnit(0.0004)
.setCostPerTimeUnit(0.38)
.setFixCost(49)
.setMaxVelocity(50 / 3.6)
.build();
Id<VehicleType> distributionVehTypeId = Id.create("DistributionCarrierVehicleType", VehicleType.class);
final VehicleType distributionVehType = VehicleUtils.createVehicleType(distributionVehTypeId, TransportMode.car);
distributionVehType.getCapacity().setOther(10);
distributionVehType.getCostInformation().setCostsPerMeter(0.0004);
distributionVehType.getCostInformation().setCostsPerSecond(0.38);
distributionVehType.getCostInformation().setFixedCost(49.);
distributionVehType.setMaximumVelocity(50 / 3.6);
distributionVehType.setNetworkMode(TransportMode.car);


Id<Link> distributionLinkId = Id.createLinkId("(14 2) (14 3)");
Id<Vehicle> distributionVehicleId = Id.createVehicleId("DistributionVehicle");
CarrierVehicle distributionCarrierVehicle =
CarrierVehicle.newInstance(distributionVehicleId, distributionLinkId, distributionType);
CarrierVehicle.newInstance(distributionVehicleId, distributionLinkId, distributionVehType);

CarrierCapabilities.Builder distributionCapabilitiesBuilder =
CarrierCapabilities.Builder.newInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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.TransportMode;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.core.config.CommandLine;
Expand All @@ -52,6 +53,7 @@
import org.matsim.freight.logistics.shipment.LspShipment;
import org.matsim.freight.logistics.shipment.LspShipmentUtils;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;

/**
* The LSP have to possibilities to send the goods from the first depot to the recipients: A) via
Expand Down Expand Up @@ -240,19 +242,18 @@ private static LSP createInitialLSP(Scenario scenario, SolutionType solutionType
Carrier mainRunCarrier =
CarriersUtils.createCarrier(Id.create("MainRunCarrier", Carrier.class));

VehicleType mainRunVehicleType =
CarrierVehicleType.Builder.newInstance(
Id.create("MainRunCarrierVehicleType", VehicleType.class))
.setCapacity(30)
.setCostPerDistanceUnit(0.0002)
.setCostPerTimeUnit(0.38)
.setFixCost(120)
.setMaxVelocity(50 / 3.6)
.build();
Id<VehicleType> mainRunCarrierVehicleType = Id.create("MainRunCarrierVehicleType", VehicleType.class);
VehicleType mainRunVehType = VehicleUtils.createVehicleType(mainRunCarrierVehicleType, TransportMode.car);
mainRunVehType.getCapacity().setOther(30);
mainRunVehType.getCostInformation().setCostsPerMeter(0.0002);
mainRunVehType.getCostInformation().setCostsPerSecond(0.38);
mainRunVehType.getCostInformation().setFixedCost(120.);
mainRunVehType.setMaximumVelocity(50 / 3.6);
mainRunVehType.setNetworkMode(TransportMode.car);

CarrierVehicle mainRunCarrierVehicle =
CarrierVehicle.Builder.newInstance(
Id.createVehicleId("MainRunVehicle"), depotLinkId, mainRunVehicleType)
Id.createVehicleId("MainRunVehicle"), depotLinkId, mainRunVehType)
.build();

mainRunCarrier.setCarrierCapabilities(
Expand Down Expand Up @@ -309,12 +310,12 @@ private static LSP createInitialLSP(Scenario scenario, SolutionType solutionType
LogisticChainElement distributionElement;
{
// The Carrier for distribution from reloading Point is created
VehicleType distributionVehicleType =
VehicleType distributionVehType =
createCarrierVehicleType("DistributionCarrierVehicleType");

CarrierVehicle distributionCarrierVehicle =
CarrierVehicle.Builder.newInstance(
Id.createVehicleId("DistributionVehicle"), hubLinkId, distributionVehicleType)
Id.createVehicleId("DistributionVehicle"), hubLinkId, distributionVehType)
.build();

Carrier distributionCarrier =
Expand Down Expand Up @@ -349,14 +350,14 @@ private static LSP createInitialLSP(Scenario scenario, SolutionType solutionType
LogisticChainElement directDistributionElement;
{
// The Carrier for distribution from reloading Point is created
VehicleType directDistributionVehicleType =
VehicleType directdistributionVehType =
createCarrierVehicleType("DirectDistributionCarrierVehicleType");

CarrierVehicle directDistributionCarrierVehicle =
CarrierVehicle.Builder.newInstance(
Id.createVehicleId("DirectDistributionVehicle"),
depotLinkId,
directDistributionVehicleType)
directdistributionVehType)
.build();

CarrierCapabilities directDistributionCarrierCapabilities =
Expand Down Expand Up @@ -533,13 +534,15 @@ private static LSPPlan createLSPPlan_reloading(
}

private static VehicleType createCarrierVehicleType(String vehicleTypeId) {
return CarrierVehicleType.Builder.newInstance(Id.create(vehicleTypeId, VehicleType.class))
.setCapacity(10)
.setCostPerDistanceUnit(0.0004)
.setCostPerTimeUnit(0.38)
.setFixCost(49)
.setMaxVelocity(50 / 3.6)
.build();
VehicleType vehicleType = VehicleUtils.createVehicleType(Id.create(vehicleTypeId, VehicleType.class), TransportMode.car);
vehicleType.getCapacity().setOther(10);
vehicleType.getCostInformation().setCostsPerMeter(0.0004);
vehicleType.getCostInformation().setCostsPerSecond(0.38);
vehicleType.getCostInformation().setFixedCost(49.);
vehicleType.setMaximumVelocity(50 / 3.6);
vehicleType.setNetworkMode(TransportMode.car);

return vehicleType;
}

private static Collection<LspShipment> createInitialLSPShipments(Network network) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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.TransportMode;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.core.config.CommandLine;
Expand All @@ -50,6 +51,7 @@
import org.matsim.freight.logistics.shipment.LspShipment;
import org.matsim.freight.logistics.shipment.LspShipmentUtils;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;

/**
* This is an academic example for the 2-echelon problem. It uses the 9x9-grid network from the
Expand Down Expand Up @@ -81,22 +83,9 @@ final class ExampleTwoEchelonGrid {

private static final Id<Link> DEPOT_LINK_ID = Id.createLinkId("i(5,0)");
private static final Id<Link> HUB_LINK_ID = Id.createLinkId("j(5,3)");
private static final VehicleType VEH_TYPE_LARGE_50 =
CarrierVehicleType.Builder.newInstance(Id.create("large50", VehicleType.class))
.setCapacity(50)
.setMaxVelocity(10)
.setFixCost(150)
.setCostPerDistanceUnit(0.01)
.setCostPerTimeUnit(0.01)
.build();
private static final VehicleType VEH_TYPE_SMALL_05 =
CarrierVehicleType.Builder.newInstance(Id.create("small05", VehicleType.class))
.setCapacity(5)
.setMaxVelocity(10)
.setFixCost(25)
.setCostPerDistanceUnit(0.001)
.setCostPerTimeUnit(0.005)
.build();
private static final VehicleType VEH_TYPE_LARGE_50 = createVehTypeLarge50();
private static final VehicleType VEH_TYPE_SMALL_05 = createVehTypeSmall05();


private ExampleTwoEchelonGrid() {} // so it cannot be instantiated

Expand Down Expand Up @@ -490,6 +479,31 @@ enum CarrierCostSetting {
lowerCost4LastMile
}


private static VehicleType createVehTypeLarge50() {
VehicleType vehicleType = VehicleUtils.createVehicleType(Id.create("large50", VehicleType.class), TransportMode.car);
vehicleType.getCapacity().setOther(50);
vehicleType.getCostInformation().setCostsPerMeter(0.01);
vehicleType.getCostInformation().setCostsPerSecond(0.01);
vehicleType.getCostInformation().setFixedCost(150.);
vehicleType.setMaximumVelocity(10);
vehicleType.setNetworkMode(TransportMode.car);

return vehicleType;
}

private static VehicleType createVehTypeSmall05() {
VehicleType vehicleType = VehicleUtils.createVehicleType(Id.create("small05", VehicleType.class), TransportMode.car);
vehicleType.getCapacity().setOther(5);
vehicleType.getCostInformation().setCostsPerMeter(0.001);
vehicleType.getCostInformation().setCostsPerSecond(0.005);
vehicleType.getCostInformation().setFixedCost(25.);
vehicleType.setMaximumVelocity(10);
vehicleType.setNetworkMode(TransportMode.car);

return vehicleType;
}

// @Override public ScoringFunction createScoringFunction(Carrier carrier ){
//
// return new ScoringFunction(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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.TransportMode;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.core.config.CommandLine;
Expand All @@ -52,6 +53,7 @@
import org.matsim.freight.logistics.shipment.LspShipment;
import org.matsim.freight.logistics.shipment.LspShipmentUtils;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;

/**
* This is an academic example for the 2-echelon problem. It uses the 9x9-grid network from the
Expand Down Expand Up @@ -83,22 +85,33 @@ final class ExampleTwoEchelonGrid_NR {

private static final Id<Link> DEPOT_LINK_ID = Id.createLinkId("i(5,0)");
private static final Id<Link> HUB_LINK_ID = Id.createLinkId("j(5,3)");
private static final VehicleType VEH_TYPE_LARGE_50 =
CarrierVehicleType.Builder.newInstance(Id.create("large50", VehicleType.class))
.setCapacity(50)
.setMaxVelocity(10)
.setFixCost(150)
.setCostPerDistanceUnit(0.01)
.setCostPerTimeUnit(0.01)
.build();
private static final VehicleType VEH_TYPE_SMALL_05 =
CarrierVehicleType.Builder.newInstance(Id.create("small05", VehicleType.class))
.setCapacity(5)
.setMaxVelocity(10)
.setFixCost(25)
.setCostPerDistanceUnit(0.001)
.setCostPerTimeUnit(0.005)
.build();

private static final VehicleType VEH_TYPE_LARGE_50 = createVehTypeLarge50();
private static final VehicleType VEH_TYPE_SMALL_05 = createVehTypeSmall05();

private static VehicleType createVehTypeLarge50() {
VehicleType vehicleType = VehicleUtils.createVehicleType(Id.create("large50", VehicleType.class), TransportMode.car);
vehicleType.getCapacity().setOther(50);
vehicleType.getCostInformation().setCostsPerMeter(0.01);
vehicleType.getCostInformation().setCostsPerSecond(0.01);
vehicleType.getCostInformation().setFixedCost(150.);
vehicleType.setMaximumVelocity(10);
vehicleType.setNetworkMode(TransportMode.car);

return vehicleType;
}

private static VehicleType createVehTypeSmall05() {
VehicleType vehicleType = VehicleUtils.createVehicleType(Id.create("small05", VehicleType.class), TransportMode.car);
vehicleType.getCapacity().setOther(5);
vehicleType.getCostInformation().setCostsPerMeter(0.001);
vehicleType.getCostInformation().setCostsPerSecond(0.005);
vehicleType.getCostInformation().setFixedCost(25.);
vehicleType.setMaximumVelocity(10);
vehicleType.setNetworkMode(TransportMode.car);

return vehicleType;
}

private ExampleTwoEchelonGrid_NR() {} // so it cannot be instantiated

Expand Down
Loading

0 comments on commit 38d2f47

Please sign in to comment.