Skip to content

Commit

Permalink
Merge pull request #3489 from moia-oss/drt-constraints-supplier-pass-…
Browse files Browse the repository at this point in the history
…through

drt: add constructor for optimization constraint supplier in extended config group
  • Loading branch information
nkuehnel authored Sep 18, 2024
2 parents 10d872c + 5bf9eea commit 6faf99e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
package org.matsim.contrib.drt.extension;

import java.util.Optional;
import java.util.function.Supplier;

import javax.annotation.Nullable;

import org.matsim.contrib.drt.extension.companions.DrtCompanionParams;
import org.matsim.contrib.drt.extension.operations.DrtOperationsParams;
import org.matsim.contrib.drt.optimizer.constraints.DefaultDrtOptimizationConstraintsSet;
import org.matsim.contrib.drt.optimizer.constraints.DrtOptimizationConstraintsSet;
import org.matsim.contrib.drt.run.DrtConfigGroup;

/**
Expand All @@ -41,6 +44,11 @@ public class DrtWithExtensionsConfigGroup extends DrtConfigGroup {
private DrtOperationsParams drtOperationsParams;

public DrtWithExtensionsConfigGroup() {
this(DefaultDrtOptimizationConstraintsSet::new);
}

public DrtWithExtensionsConfigGroup(Supplier<DrtOptimizationConstraintsSet> drtOptimizationConstraintsSetSupplier) {
super(drtOptimizationConstraintsSetSupplier);
// Optional
addDefinition(DrtCompanionParams.SET_NAME, DrtCompanionParams::new, () -> drtCompanionParams,
params -> drtCompanionParams = (DrtCompanionParams) params);
Expand Down

0 comments on commit 6faf99e

Please sign in to comment.