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

Commit

Permalink
Merge remote-tracking branch 'origin/main' into kmt_create_HubHandlin…
Browse files Browse the repository at this point in the history
…gEvents

# Conflicts:
#	src/main/java/org/matsim/freight/logistics/HasLspShipmentId.java
#	src/main/java/org/matsim/freight/logistics/LSPControlerListener.java
#	src/main/java/org/matsim/freight/logistics/LSPRescheduler.java
#	src/main/java/org/matsim/freight/logistics/events/AbstractLspEvent.java
#	src/main/java/org/matsim/freight/logistics/events/HandlingInHubStartsEvent.java
#	src/main/java/org/matsim/freight/logistics/events/HandlingInHubStartsEventCreator.java
#	src/main/java/org/matsim/freight/logistics/events/LspEventAttributes.java
#	src/main/java/org/matsim/freight/logistics/events/LspEventCreator.java
#	src/main/java/org/matsim/freight/logistics/events/LspEventCreatorUtils.java
#	src/main/java/org/matsim/freight/logistics/example/lsp/multipleChains/ExampleThreeChains.java
#	src/main/java/org/matsim/freight/logistics/resourceImplementations/transshipmentHub/TransshipmentHubTourEndEventHandler.java
#	src/test/java/lspMobsimTests/SecondReloadLSPMobsimTest.java
#	src/test/java/org/matsim/freight/logistics/lspMobsimTests/FirstAndSecondReloadLSPMobsimTest.java
#	src/test/java/org/matsim/freight/logistics/lspMobsimTests/SecondReloadLSPMobsimTest.java
#	test/input/example/lsp/initialPlans/ExampleSchedulingOfTransportChainHubsVsDirectTest/testMain1/output_events.xml.gz
#	test/input/lspMobsimTests/CompleteLSPMobsimTest/output_events.xml.gz
#	test/input/lspMobsimTests/MultipleIterationsCompleteLSPMobsimTest/output_events.xml.gz
#	test/input/lspMobsimTests/MultipleShipmentsCompleteLSPMobsimTest/output_events.xml.gz
#	test/input/lspMobsimTests/RepeatedMultipleShipmentsCompleteLSPMobsimTest/output_events.xml.gz
#	test/input/org/matsim/freight/logistics/lspMobsimTests/SecondReloadLSPMobsimTest/output_events.xml.gz
  • Loading branch information
kt86 committed Nov 14, 2023
2 parents 5fd5b31 + 485d24c commit e0603b8
Show file tree
Hide file tree
Showing 216 changed files with 2,515 additions and 2,549 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<parent>
<groupId>org.matsim</groupId>
<artifactId>matsim-all</artifactId>
<!-- <version>16.0-2023w24</version>-->
<version>16.0-2023w39</version>
<version>16.0-2023w46</version>
<!-- <version>16.0-2023w41</version>-->
<!-- <version>16.0-2023w23</version>-->
<!-- <version>16.0-SNAPSHOT</version>-->
<relativePath/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* * ***********************************************************************
*/

package lsp;
package org.matsim.freight.logistics;

import lsp.shipment.LSPShipment;
import org.matsim.freight.logistics.shipment.LSPShipment;
import org.matsim.api.core.v01.Id;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lsp;
package org.matsim.freight.logistics;

@SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
public interface HasBackpointer<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
* See also COPYING, LICENSE and WARRANTY file *
* *
* *********************************************************************** */
package lsp;
package org.matsim.freight.logistics;


import lsp.shipment.LSPShipment;
import org.matsim.api.core.v01.Id;
import org.matsim.freight.logistics.shipment.LSPShipment;

/**
* @author Kai Martins-Turner (kturner)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lsp;
package org.matsim.freight.logistics;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lsp;
package org.matsim.freight.logistics;

interface KnowsLSP {
void setLSP(LSP lsp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* * ***********************************************************************
*/

package lsp;
package org.matsim.freight.logistics;

import lsp.shipment.LSPShipment;
import org.matsim.freight.logistics.shipment.LSPShipment;
import org.matsim.api.core.v01.population.HasPlansAndId;

import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* * ***********************************************************************
*/

package lsp;
package org.matsim.freight.logistics;

import org.matsim.contrib.freight.carrier.Carrier;
import org.matsim.freight.carriers.Carrier;

public interface LSPCarrierResource extends LSPResource {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lsp;
package org.matsim.freight.logistics;

public abstract class LSPConstants {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,26 @@
* * ***********************************************************************
*/

package lsp;
package org.matsim.freight.logistics;


import jakarta.inject.Inject;
import lsp.io.LSPPlanXmlWriter;
import lsp.shipment.LSPShipment;
import lsp.shipment.ShipmentUtils;
import org.matsim.freight.logistics.io.LSPPlanXmlWriter;
import org.matsim.freight.logistics.shipment.LSPShipment;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.Scenario;
import org.matsim.contrib.freight.carrier.Carrier;
import org.matsim.contrib.freight.carrier.CarrierPlanWriter;
import org.matsim.contrib.freight.carrier.Carriers;
import org.matsim.contrib.freight.controler.CarrierAgentTracker;
import org.matsim.contrib.freight.controler.FreightUtils;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.controler.MatsimServices;
import org.matsim.core.controler.OutputDirectoryHierarchy;
import org.matsim.core.controler.events.*;
import org.matsim.core.controler.listener.*;
import org.matsim.core.events.handler.EventHandler;
import org.matsim.freight.carriers.Carrier;
import org.matsim.freight.carriers.CarrierPlanWriter;
import org.matsim.freight.carriers.CarriersUtils;
import org.matsim.freight.carriers.Carriers;
import org.matsim.freight.carriers.controler.CarrierAgentTracker;

import javax.annotation.Nullable;
import java.util.ArrayList;
Expand Down Expand Up @@ -135,7 +134,7 @@ public void notifyReplanning(ReplanningEvent event) {
//Update carriers in scenario and CarrierAgentTracker
carrierAgentTracker.getCarriers().getCarriers().clear();
for (Carrier carrier : getCarriersFromLSP().getCarriers().values()) {
FreightUtils.getCarriers(scenario).addCarrier(carrier);
CarriersUtils.getCarriers(scenario).addCarrier(carrier);
carrierAgentTracker.getCarriers().addCarrier(carrier);
}

Expand Down Expand Up @@ -187,7 +186,7 @@ public void notifyIterationEnds(IterationEndsEvent event) {
@Override
public void notifyShutdown(ShutdownEvent event) {
new LSPPlanXmlWriter(LSPUtils.getLSPs(scenario)).write(controlerIO.getOutputPath() + "/output_lsps.xml.gz");
new CarrierPlanWriter(FreightUtils.getCarriers(scenario)).write(controlerIO.getOutputPath() + "/output_carriers.xml.gz");
new CarrierPlanWriter(CarriersUtils.getCarriers(scenario)).write(controlerIO.getOutputPath() + "/output_carriers.xml.gz");
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lsp;
package org.matsim.freight.logistics;

import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Identifiable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* * ***********************************************************************
*/

package lsp;
package org.matsim.freight.logistics;

import lsp.shipment.LSPShipment;
import org.matsim.freight.logistics.shipment.LSPShipment;
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 @@ -18,7 +18,7 @@
* * ***********************************************************************
*/

package lsp;
package org.matsim.freight.logistics;

import com.google.inject.Provides;
import jakarta.inject.Inject;
Expand All @@ -30,10 +30,6 @@
import org.matsim.api.core.v01.population.Activity;
import org.matsim.api.core.v01.population.HasPlansAndId;
import org.matsim.api.core.v01.population.Leg;
import org.matsim.contrib.freight.FreightConfigGroup;
import org.matsim.contrib.freight.carrier.Carrier;
import org.matsim.contrib.freight.carrier.Carriers;
import org.matsim.contrib.freight.controler.*;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.events.BeforeMobsimEvent;
Expand All @@ -44,18 +40,22 @@
import org.matsim.core.replanning.ReplanningContext;
import org.matsim.core.replanning.selectors.PlanSelector;
import org.matsim.core.scoring.ScoringFunction;
import org.matsim.freight.carriers.FreightCarriersConfigGroup;
import org.matsim.freight.carriers.Carrier;
import org.matsim.freight.carriers.Carriers;
import org.matsim.freight.carriers.controler.*;

import java.util.List;


public class LSPModule extends AbstractModule {
private static final Logger log = LogManager.getLogger(LSPModule.class);

// private final FreightConfigGroup carrierConfig = new FreightConfigGroup();
// private final FreightCarriersConfigGroup carrierConfig = new FreightCarriersConfigGroup();

@Override
public void install() {
FreightConfigGroup freightConfig = ConfigUtils.addOrGetModule(getConfig(), FreightConfigGroup.class);
FreightCarriersConfigGroup freightConfig = ConfigUtils.addOrGetModule(getConfig(), FreightCarriersConfigGroup.class);

bind(LSPControlerListener.class).in(Singleton.class);
addControlerListenerBinding().to(LSPControlerListener.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
/*
* *********************************************************************** *
* * project: org.matsim.*
* * *********************************************************************** *
* * *
* * copyright : (C) 2022 by the members listed in the COPYING, *
* * LICENSE and WARRANTY file. *
* * email : info at matsim dot org *
* * *
* * *********************************************************************** *
* * *
* * This program is free software; you can redistribute it and/or modify *
* * it under the terms of the GNU General Public License as published by *
* * the Free Software Foundation; either version 2 of the License, or *
* * (at your option) any later version. *
* * See also COPYING, LICENSE and WARRANTY file *
* * *
* * ***********************************************************************
*/

package lsp;

import lsp.shipment.LSPShipment;
import lsp.shipment.ShipmentPlan;
import org.matsim.api.core.v01.population.BasicPlan;

import java.util.Collection;

/**
* This interface has the following properties:<ul>
* <li> As a {@link BasicPlan} it has a score, so it can be used for evolutionary learning. kai, may'22 </li>
* <li> An {@link LSPShipment} is added via lspPlan#getAssigner().assignToSolution(shipment). The {@link ShipmentAssigner} assigns it deterministically to a {@link LogisticChain}. </li>
* </ul>
*/
public interface LSPPlan extends BasicPlan, KnowsLSP {

LSPPlan addLogisticChain(LogisticChain solution);

Collection<LogisticChain> getLogisticChains();

/**
* yy My intuition would be to replace lspPlan#getAssigner().assignToSolution( shipment ) by lspPlan.addShipment( shipment ). kai, may'22
*/
ShipmentAssigner getAssigner();

LSPPlan setAssigner(ShipmentAssigner assigner);

Collection<ShipmentPlan> getShipmentPlans();
LSPPlan addShipmentPlan(ShipmentPlan shipmentPlan);

String getType();

void setType(final String type);

}
/*
* *********************************************************************** *
* * project: org.matsim.*
* * *********************************************************************** *
* * *
* * copyright : (C) 2022 by the members listed in the COPYING, *
* * LICENSE and WARRANTY file. *
* * email : info at matsim dot org *
* * *
* * *********************************************************************** *
* * *
* * This program is free software; you can redistribute it and/or modify *
* * it under the terms of the GNU General Public License as published by *
* * the Free Software Foundation; either version 2 of the License, or *
* * (at your option) any later version. *
* * See also COPYING, LICENSE and WARRANTY file *
* * *
* * ***********************************************************************
*/

package org.matsim.freight.logistics;

import org.matsim.freight.logistics.shipment.LSPShipment;
import org.matsim.freight.logistics.shipment.ShipmentPlan;
import org.matsim.api.core.v01.population.BasicPlan;

import java.util.Collection;

/**
* This interface has the following properties:<ul>
* <li> As a {@link BasicPlan} it has a score, so it can be used for evolutionary learning. kai, may'22 </li>
* <li> An {@link LSPShipment} is added via lspPlan#getAssigner().assignToSolution(shipment). The {@link ShipmentAssigner} assigns it deterministically to a {@link LogisticChain}. </li>
* </ul>
*/
public interface LSPPlan extends BasicPlan, KnowsLSP {

LSPPlan addLogisticChain(LogisticChain solution);

Collection<LogisticChain> getLogisticChains();

/**
* yy My intuition would be to replace lspPlan#getAssigner().assignToSolution( shipment ) by lspPlan.addShipment( shipment ). kai, may'22
*/
ShipmentAssigner getAssigner();

LSPPlan setAssigner(ShipmentAssigner assigner);

Collection<ShipmentPlan> getShipmentPlans();
LSPPlan addShipmentPlan(ShipmentPlan shipmentPlan);

String getType();

void setType(final String type);

}
Loading

0 comments on commit e0603b8

Please sign in to comment.