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

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kt86 committed Sep 2, 2024
1 parent c60206d commit 134c896
Showing 1 changed file with 1 addition and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.events.*;
import org.matsim.api.core.v01.events.handler.PersonMoneyEventHandler;
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.population.Person;
import org.matsim.core.scoring.ScoringFunction;
Expand All @@ -37,8 +36,6 @@
import org.matsim.freight.carriers.Carrier;
import org.matsim.freight.carriers.Tour;
import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory;
import org.matsim.freight.carriers.events.CarrierServiceEndEvent;
import org.matsim.freight.carriers.events.CarrierServiceStartEvent;
import org.matsim.freight.carriers.events.CarrierTourEndEvent;
import org.matsim.freight.carriers.events.CarrierTourStartEvent;
import org.matsim.freight.logistics.analysis.Driver2VehicleEventHandler;
Expand All @@ -61,8 +58,6 @@ public ScoringFunction createScoringFunction(Carrier carrier) {
this.carrierId = carrier.getId();
SumScoringFunction sf = new SumScoringFunction();
sf.addScoringFunction(new EventBasedScoring());
// sf.addScoringFunction(new FindOtherEventsForDebuggingOnly_NO_Scoring());
// sf.addScoringFunction(new TollMoneyScoringForDebuggingOnly_NO_Scoring());
return sf;
}

Expand Down Expand Up @@ -117,8 +112,7 @@ private void handleEvent(CarrierTourStartEvent event) {
private void handleEvent(CarrierTourEndEvent event) {
v2c.handleEvent(event);
// Fix costs for vehicle usage
final VehicleType vehicleType =
(VehicleUtils.findVehicle(event.getVehicleId(), scenario)).getType();
final VehicleType vehicleType = (VehicleUtils.findVehicle(event.getVehicleId(), scenario)).getType();

double tourDuration = event.getTime() - tourStartTime.get(event.getTourId());

Expand Down Expand Up @@ -163,75 +157,6 @@ private void handleEvent(PersonMoneyEvent event) {
}
}
}

}

/**
* Versuche nur mit dem Debugger die PersonMoneyEvents zu entdecken, die eigentlich da sein sollten.
*/
private class FindOtherEventsForDebuggingOnly_NO_Scoring implements ArbitraryEventScoring {

final Logger log = LogManager.getLogger(FindOtherEventsForDebuggingOnly_NO_Scoring.class);


public FindOtherEventsForDebuggingOnly_NO_Scoring() {
super();
}

@Override
public void finish() {}

@Override
public double getScore() {
return Double.MIN_VALUE;
}

@Override
public void handleEvent(Event event) {
log.debug(event.toString());

switch (event) {
case CarrierTourStartEvent carrierTourStartEvent -> {}
// case CarrierTourEndEvent carrierTourEndEvent -> {}
case CarrierServiceStartEvent carrierServiceStartEvent -> {}
case CarrierServiceEndEvent carrierServiceEndEvent -> {}
case LinkEnterEvent linkEnterEvent ->{}
case LinkLeaveEvent linkLeaveEvent ->{}
// case PersonMoneyEvent personMoneyEvent -> handleEvent(personMoneyEvent);
default -> {handleOtherEvent(event);}
}
}

private void handleOtherEvent(Event event) {
log.info("Found another event: {}", event.toString());
}

}


/**
* Versuche nur mit dem Debugger die Einträge aus den PersonMoneyEvents zu entdecken, die eigentlich da sein sollten.
*/
private static class TollMoneyScoringForDebuggingOnly_NO_Scoring implements SumScoringFunction.MoneyScoring, PersonMoneyEventHandler {

private double score = 0.0;
@Override
public void addMoney(double amount) {
// TODO Auto-generated method stub
}

@Override
public void finish() { }

@Override
public double getScore() {
return this.score;
}

@Override
public void handleEvent(PersonMoneyEvent event) {
// Todo: implement
}
}

}

0 comments on commit 134c896

Please sign in to comment.