Skip to content

DefaultScorer getLargestTimeWindow method always return MAX timeWindow #561

@YevgenRiaboshtan

Description

@YevgenRiaboshtan

com.graphhopper.jsprit.core.algorithm.recreate.DefaultScorer -> getLargestTimeWindow method
always return MAX timeWindow for each Activity (return TimeWindow.newInstance(0, Double.MAX_VALUE))

private TimeWindow getLargestTimeWindow(Activity act) {
     TimeWindow timeWindow = null;
     for (TimeWindow tw : act.getTimeWindows()) {
         if (timeWindow == null) timeWindow = tw;
         else if (tw.larger(timeWindow)) timeWindow = tw;
     }
     return TimeWindow.newInstance(0, Double.MAX_VALUE);
 }

and minTimeToOperate is always = Double.MAX_VALUE

If the method must return "TimeWindow.newInstance(0, Double.MAX_VALUE)" for each activity, it could be simplified to static final field,
or method must return timeWindow variable.?

private TimeWindow getLargestTimeWindow(Activity act) {
    TimeWindow timeWindow = null;
    for (TimeWindow tw : act.getTimeWindows()) {
        if (timeWindow == null) timeWindow = tw;
        else if (tw.larger(timeWindow)) timeWindow = tw;
    }
    if (timeWindow != null) {
        return timeWindow;
    }
    return TimeWindow.newInstance(0, Double.MAX_VALUE);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions