Skip to content

Commit

Permalink
add consistency check for minimum/maximum allowed detour
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuehnel committed Dec 2, 2024
1 parent 883ad57 commit 8aa7e7f
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.matsim.contrib.drt.optimizer.constraints;

import com.google.common.base.Verify;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.PositiveOrZero;
import org.matsim.core.config.Config;

public class DefaultDrtOptimizationConstraintsSet extends DrtOptimizationConstraintsSet {

Expand Down Expand Up @@ -45,4 +47,11 @@ public class DefaultDrtOptimizationConstraintsSet extends DrtOptimizationConstra
"Defines the minimum allowed absolute detour in seconds. By default, this bound is disabled (i.e. set to 0.)")
@PositiveOrZero
public double minimumAllowedDetour = 0;

@Override
protected void checkConsistency(Config config) {
super.checkConsistency(config);
Verify.verify(maxAbsoluteDetour > minimumAllowedDetour, "The minimum allowed detour must" +
"be lower than the maximum allowed detour.");
}
}

0 comments on commit 8aa7e7f

Please sign in to comment.