Skip to content

Commit

Permalink
rename remaining FreightUtils to CarrierControlerUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
kt86 committed Oct 11, 2023
1 parent 689cc14 commit e214b11
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public static Carriers getCarriers(Scenario scenario) {
// not found. kai, oct'19
if ( scenario.getScenarioElement( CARRIERS ) == null ) {
throw new RuntimeException( "cannot retrieve carriers from scenario; typical ways to resolve that problem are to call " +
"FreightUtils.getOrCreateCarriers(...) or FreightUtils.loadCarriersAccordingToFreightConfig(...) early enough\n") ;
"CarrierControlerUtils.getOrCreateCarriers(...) or CarrierControlerUtils.loadCarriersAccordingToFreightConfig(...) early enough\n") ;
}
return (Carriers) scenario.getScenarioElement(CARRIERS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author kturner
*
*/
public class FreightUtils {
public class CarrierControlerUtils {

public static CarrierStrategyManager createDefaultCarrierStrategyManager() {
return new CarrierStrategyManagerImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static class MyCarrierPlanStrategyManagerProvider implements Provider<Ca

@Override
public CarrierStrategyManager get() {
final CarrierStrategyManager strategyManager = FreightUtils.createDefaultCarrierStrategyManager();
final CarrierStrategyManager strategyManager = CarrierControlerUtils.createDefaultCarrierStrategyManager();
strategyManager.setMaxPlansPerAgent(5);
{
GenericPlanStrategyImpl<CarrierPlan, Carrier> strategy = new GenericPlanStrategyImpl<>( new ExpBetaPlanChanger.Factory<CarrierPlan,Carrier>().build() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public MyCarrierPlanStrategyManagerFactory(CarrierVehicleTypes types) {
final TravelDisutility travelDisutility = CarrierTravelDisutilities.createBaseDisutility(types, modeTravelTimes.get(TransportMode.car ) );
final LeastCostPathCalculator router = leastCostPathCalculatorFactory.createPathCalculator(network, travelDisutility, modeTravelTimes.get(TransportMode.car));

final CarrierStrategyManager carrierStrategyManager = FreightUtils.createDefaultCarrierStrategyManager();
final CarrierStrategyManager carrierStrategyManager = CarrierControlerUtils.createDefaultCarrierStrategyManager();
carrierStrategyManager.setMaxPlansPerAgent(5);

carrierStrategyManager.addStrategy(new GenericPlanStrategyImpl<>(new BestPlanSelector<>()), null, 0.95);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ private VehicleRoutingProblemSolution generateCarrierPlans(Scenario scenario) {
carrier.setSelectedPlan(newPlan);
SolutionPrinter.print(problem, solution, SolutionPrinter.Print.VERBOSE);

// new CarrierPlanXmlWriterV3(FreightUtils.getCarriers(scenario)).write(utils.getOutputDirectory() + "carriers.xml");
// new CarrierPlanXmlWriterV3(CarrierControlerUtils.getCarriers(scenario)).write(utils.getOutputDirectory() + "carriers.xml");
// Scenario scNew = ScenarioUtils.createScenario(ConfigUtils.createConfig());
// new CarrierPlanXmlReaderV3(FreightUtils.getCarriers(scNew)).readFile(utils.getOutputDirectory() + "carriers.xml");
// new CarrierPlanXmlReaderV3(CarrierControlerUtils.getCarriers(scNew)).readFile(utils.getOutputDirectory() + "carriers.xml");
return solution;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import org.matsim.api.core.v01.population.Person;
import org.matsim.contrib.freight.carriers.carrier.Carrier;
import org.matsim.contrib.freight.carriers.carrier.CarrierPlan;
import org.matsim.contrib.freight.carriers.controler.CarrierControlerUtils;
import org.matsim.contrib.freight.carriers.controler.CarrierReRouteVehicles;
import org.matsim.contrib.freight.carriers.controler.CarrierStrategyManager;
import org.matsim.contrib.freight.carriers.controler.FreightUtils;
import org.matsim.core.replanning.GenericPlanStrategyImpl;
import org.matsim.core.replanning.selectors.BestPlanSelector;
import org.matsim.core.router.speedy.SpeedyALTFactory;
Expand Down Expand Up @@ -62,7 +62,7 @@ public CarrierStrategyManager get() {
GenericPlanStrategyImpl<CarrierPlan, Carrier> planStrat_reRoutePlan = new GenericPlanStrategyImpl<>( new BestPlanSelector<>() );
planStrat_reRoutePlan.addStrategyModule(new CarrierReRouteVehicles.Factory(router, network, travelTimes.get(TransportMode.car )).build() );

CarrierStrategyManager stratManager = FreightUtils.createDefaultCarrierStrategyManager();
CarrierStrategyManager stratManager = CarrierControlerUtils.createDefaultCarrierStrategyManager();

stratManager.addStrategy(planStrat_reRoutePlan, null, 1.0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @author kturner
*
*/
public class FreightUtilsIT {
public class CarrierControlerUtilsIT {

private final Id<Carrier> CARRIER_SERVICES_ID = Id.create("CarrierWServices", Carrier.class);
private final Id<Carrier> CARRIER_SHIPMENTS_ID = Id.create("CarrierWShipments", Carrier.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
import java.util.Collection;
import java.util.concurrent.ExecutionException;

public class FreightUtilsTest {
public class CarrierControlerUtilsTest {

@Rule
public MatsimTestUtils utils = new MatsimTestUtils();

private static final Logger log = LogManager.getLogger(FreightUtilsTest.class);
private static final Logger log = LogManager.getLogger(CarrierControlerUtilsTest.class);

private final Id<Carrier> CARRIER_SERVICES_ID = Id.create("CarrierWServices", Carrier.class);
private final Id<Carrier> CARRIER_SHIPMENTS_ID = Id.create("CarrierWShipments", Carrier.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void notifyIterationStarts(IterationStartsEvent event) {
}
String outputdirectory = sc.getConfig().controler().getOutputDirectory();
outputdirectory += outputdirectory.endsWith("/") ? "" : "/";
// new CarrierPlanWriter(FreightUtils.getCarriers(sc)).write(outputdirectory + ReceiverConfigGroup.CARRIERS_FILE);
// new CarrierPlanWriter(CarrierControlerUtils.getCarriers(sc)).write(outputdirectory + ReceiverConfigGroup.CARRIERS_FILE);
new CarrierPlanWriter(CarrierUtils.getCarriers(sc)).write(outputdirectory +receiverConfig.getCarriersFile() );
// new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + ReceiverConfigGroup.RECEIVERS_FILE);
new ReceiversWriter( ReceiverUtils.getReceivers( sc ) ).write(outputdirectory + receiverConfig.getReceiversFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private ReceiverUtils() {
public static final String ATTR_RECEIVER_SCORE = "score";
public static final String ATTR_RECEIVER_TW_COST = "twCost";

//Now using the MATSim-infrastructure to avoid problems if this element is named differently beetween (MATSim) FreightUtils and here.
//Now using the MATSim-infrastructure to avoid problems if this element is named differently beetween (MATSim) CarrierControlerUtils and here.
// I also replaced the usage here by the current MATSim syntax KMT'jan21
// private static final String CARRIERS_SCENARIO_ELEMENT = "carriers";

Expand Down

0 comments on commit e214b11

Please sign in to comment.