Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRT: add maxShiftStartDelay and log message when a shift is deleted due to… #3021

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.matsim.core.config.ConfigGroup;

import java.net.URL;
import java.util.Map;

/**
* @author nkuehnel / MOIA
Expand All @@ -30,6 +29,10 @@ public class ShiftsParams extends ReflectiveConfigGroupWithConfigurableParameter
@Comment("changeover duration in [seconds]")
public double changeoverDuration = 900;

@Parameter
@Comment("maximum delay of shift assignment after start time has passed in [seconds]. If a shift can not be assigned to a vehicle until the planned start of the shift plus the defined max delay, the shift is discarded. Defaults to 0")
public double maxUnscheduledShiftDelay = 0;

@Parameter
@Comment("Time of shift assignment (i.e. which vehicle carries out a specific shift) before start of shift in [seconds]")
public double shiftScheduleLookAhead = 1800;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ private void startShifts(double timeStep) {

private void assignShifts(double timeStep) {
// Remove elapsed shifts
unscheduledShifts.removeIf(shift -> shift.getStartTime() < timeStep);
unscheduledShifts.removeIf(shift -> {
if (shift.getStartTime() + drtShiftParams.maxUnscheduledShiftDelay < timeStep ) {
logger.warn("Shift with ID " + shift.getId() + " could not be assigned and is being removed as start time is longer in the past than defined by maxUnscheduledShiftDelay.");
return true;
}
return false;
});

// Assign shifts
Set<DrtShift> assignableShifts = new LinkedHashSet<>();
Expand Down
Loading