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

Moia deployment #3592

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
11c8cfb
add moia deployment files
nkuehnel May 2, 2024
a041bf7
update matsim (#91)
nkuehnel May 3, 2024
6f9a62f
Merge pull request #93 from matsim-org/master
mfrawley-moia May 7, 2024
463b59d
Merge pull request #94 from moia-oss/master
mfrawley-moia May 7, 2024
5e51e26
update deployment (#95)
mfrawley-moia May 7, 2024
0ab3a61
Update MATSim CW20 (#97)
nkuehnel May 27, 2024
03877e8
Update MATSim (#100)
nkuehnel Jun 7, 2024
83c13ec
fix version conflict
nkuehnel Jun 7, 2024
ab3aa0d
Merge branch 'master' into moia-deployment
nkuehnel Jun 19, 2024
039d209
Update MATSim CW26 (#104)
nkuehnel Jun 24, 2024
c920b08
update dispatch link (#103)
nkuehnel Jun 24, 2024
1627fbc
Update MATSim CW27 (#105)
nkuehnel Jul 4, 2024
90cedbe
Update MATSim CW30 (#106)
nkuehnel Jul 23, 2024
2c35ab2
Update MATSim CW31 (#107)
nkuehnel Jul 31, 2024
edb9f45
Update MATSim CW31 2nd (#108)
nkuehnel Aug 1, 2024
93b4961
Update MATSim CW33 (#109)
nkuehnel Aug 13, 2024
f6df55b
merge
nkuehnel Aug 20, 2024
aea1f51
Merge pull request #111 from moia-oss/moia-deployment-pre
nkuehnel Aug 20, 2024
8b61506
Merge pull request #112 from moia-oss/master
mfrawley-moia Aug 29, 2024
15cb17f
Merge branch 'feat/improve-prebooking-stop-activity' of github.com:ma…
mfrawley-moia Aug 30, 2024
d16ca05
Merge branch 'moia-deployment' into prebooking-fix
mfrawley-moia Aug 30, 2024
c5002ce
Merge pull request #113 from moia-oss/prebooking-fix
nkuehnel Aug 30, 2024
c520f0b
Merge pull request #114 from moia-oss/update-matsim-02-09
nkuehnel Sep 2, 2024
815d3bd
Merge pull request #115 from moia-oss/master
mfrawley-moia Sep 2, 2024
fb9d02c
Merge branch 'updatePrebookingStopActivity' into moia-deployment-fix
nkuehnel Sep 4, 2024
dac8f06
Merge pull request #117 from moia-oss/moia-deployment-fix
mfrawley-moia Sep 4, 2024
a92bd23
Merge pull request #118 from moia-oss/master
nkuehnel Sep 11, 2024
9a5f465
Merge pull request #119 from moia-oss/master
mfrawley-moia Nov 5, 2024
fd3d3a2
Merge pull request #120 from moia-oss/master
mfrawley-moia Nov 26, 2024
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
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://help.github.com/articles/about-codeowners/
#
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# mentioned account names will be requested for
# review when someone opens a pull request.
* @mfrawley-moia @nkuehnel @fzwick @TomE168
33 changes: 33 additions & 0 deletions .github/workflows/moia-deploy-on-pr-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: deploy-on-pr-merge

on:
push: # snapshot deployment
branches:
- moia-deployment

jobs:
deploy-snapshot:
name: deploy MOIA
# for PR-labelled deployment -- only if closed by merging
if: github.event_name == 'push' || github.event.pull_request.merged == true

runs-on: ubuntu-latest

environment: prd
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: 'zulu'
- name: Set version
run: mvn versions:set -DnewVersion=moia-latest-SNAPSHOT
- name: Deploy with Maven
env:
USERNAME: ${{github.actor}}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: mvn -pl org.matsim.contrib:sbb-extensions,org.matsim.contrib:drt,org.matsim.contrib:drt-extensions,org.matsim.contrib:discrete_mode_choice,org.matsim.contrib:simulatedannealing deploy -am --settings settings.xml -DskipTests=true -DaltSnapshotDeploymentRepository=github::default::https://maven.pkg.github.com/moia-oss/matsim-libs -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/moia-oss/matsim-libs
- name: Trigger external development build
run: |
curl -XPOST -u "${{ secrets.PAT_USERNAME}}:${{secrets.PAT_TOKEN}}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/moia-dev/transport-modeling/dispatches --data '{"event_type": "build_application"}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package org.matsim.contrib.drt.optimizer;

import com.google.common.base.Verify;
import org.matsim.core.config.Config;
import org.matsim.core.config.ReflectiveConfigGroup;

import java.util.List;
import java.util.Optional;

/**
* @author nkuehnel / MOIA
*/
public class DrtOptimizationConstraintsParams extends ReflectiveConfigGroup {

public static final String SET_NAME = "drtOptimizationConstraints";

public static String defaultConstraintSet = DrtOptimizationConstraintsSet.DEFAULT_PARAMS_NAME;


public DrtOptimizationConstraintsParams() {
super(SET_NAME);
}

@Override
protected void checkConsistency(Config config) {
super.checkConsistency(config);
List<DrtOptimizationConstraintsSet> drtOptimizationConstraintsSets = getDrtOptimizationConstraintsSets();

Verify.verify(!drtOptimizationConstraintsSets.isEmpty(),
"At least one DrtOptimizationConstraintsParams is required.");
Verify.verify(drtOptimizationConstraintsSets.stream()
.anyMatch(params -> params.name.equals(defaultConstraintSet)),
"Default DrtOptimizationConstraintsParams is required.");
Verify.verify(drtOptimizationConstraintsSets.stream()
.map(params -> params.name)
.distinct()
.count() == drtOptimizationConstraintsSets.size(),
"Cannot have DrtOptimizationConstraintsParams with identical names.");
}

public List<DrtOptimizationConstraintsSet> getDrtOptimizationConstraintsSets() {
return getParameterSets(DrtOptimizationConstraintsSet.SET_NAME).stream()
.filter(DrtOptimizationConstraintsSet.class::isInstance)
.map(DrtOptimizationConstraintsSet.class::cast)
.toList();
}

public DrtOptimizationConstraintsSet addOrGetDefaultDrtOptimizationConstraintsSet() {
Optional<DrtOptimizationConstraintsSet> drtOptParams = getDrtOptimizationConstraintsSets().stream()
.filter(params -> params.name.equals(defaultConstraintSet))
.findAny();
if (drtOptParams.isEmpty()) {
addParameterSet(new DrtOptimizationConstraintsSet());
}
return getDrtOptimizationConstraintsSets().stream()
.filter(params -> params.name.equals(defaultConstraintSet))
.findAny().orElseThrow();
}

/**
* for backwards compatibility with old drt config groups
*/
public void handleAddUnknownParam(final String paramName, final String value) {
switch (paramName) {
case "maxWaitTime":
case "maxTravelTimeAlpha":
case "maxTravelTimeBeta":
case "maxAbsoluteDetour":
case "maxDetourAlpha":
case "maxDetourBeta":
case "maxAllowedPickupDelay":
case "rejectRequestIfMaxWaitOrTravelTimeViolated":
case "maxWalkDistance":
addOrGetDefaultDrtOptimizationConstraintsSet().addParam(paramName, value);
break;
default:
super.handleAddUnknownParam(paramName, value);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package org.matsim.contrib.drt.optimizer;

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

public class DrtOptimizationConstraintsSet extends ReflectiveConfigGroup {

public static final String SET_NAME = "drtOptimizationConstraintsSet";
public static final String DEFAULT_PARAMS_NAME = "default";

public DrtOptimizationConstraintsSet() {
super(SET_NAME);
}

@Parameter
@Comment("name of optimization params")
@NotBlank
public String name = DEFAULT_PARAMS_NAME;

@Parameter
@Comment("Max wait time for the bus to come (optimisation constraint).")
@PositiveOrZero
public double maxWaitTime = Double.NaN;// seconds

@Parameter
@Comment("Defines the slope of the maxTravelTime estimation function (optimisation constraint), i.e. "
+ "min(unsharedRideTime + maxAbsoluteDetour, maxTravelTimeAlpha * unsharedRideTime + maxTravelTimeBeta). "
+ "Alpha should not be smaller than 1.")
@DecimalMin("1.0")
public double maxTravelTimeAlpha = Double.NaN;// [-]

@Parameter
@Comment("Defines the shift of the maxTravelTime estimation function (optimisation constraint), i.e. "
+ "min(unsharedRideTime + maxAbsoluteDetour, maxTravelTimeAlpha * unsharedRideTime + maxTravelTimeBeta). "
+ "Beta should not be smaller than 0.")
@PositiveOrZero
public double maxTravelTimeBeta = Double.NaN;// [s]

@Parameter
@Comment(
"Defines the maximum allowed absolute detour in seconds. Note that the detour is computed from the latest promised pickup time. " +
"To enable the max detour constraint, maxAllowedPickupDelay has to be specified. maxAbsoluteDetour should not be smaller than 0, "
+ "and should be higher than the offset maxDetourBeta. By default, this limit is disabled (i.e. set to Inf)")
@PositiveOrZero
public double maxAbsoluteDetour = Double.POSITIVE_INFINITY;// [s]

@Parameter
@Comment(
"Defines the maximum allowed absolute detour based on the unsharedRideTime. Note that the detour is computed from the latest promised "
+ "pickup time. To enable the max detour constraint, maxAllowedPickupDelay has to be specified. A linear combination similar to travel "
+ "time constrain is used. This is the ratio part. By default, this limit is disabled (i.e. set to Inf, together with maxDetourBeta).")
@DecimalMin("1.0")
public double maxDetourAlpha = Double.POSITIVE_INFINITY;

@Parameter
@Comment(
"Defines the maximum allowed absolute detour based on the unsharedRideTime. Note that the detour is computed from the latest promised "
+ "pickup time. To enable the max detour constraint, maxAllowedPickupDelay has to be specified. A linear combination similar to travel "
+ "time constrain is used. This is the constant part. By default, this limit is disabled (i.e. set to Inf, together with maxDetourAlpha).")
@PositiveOrZero
public double maxDetourBeta = Double.POSITIVE_INFINITY;// [s]

@Parameter
@Comment(
"Defines the maximum delay allowed from the initial scheduled pick up time. Once the initial pickup time is offered, the latest promised"
+ "pickup time is calculated based on initial scheduled pickup time + maxAllowedPickupDelay. "
+ "By default, this limit is disabled. If enabled, a value between 0 and 240 is a good choice.")
@PositiveOrZero
public double maxAllowedPickupDelay = Double.POSITIVE_INFINITY;// [s]

@Parameter
@Comment("If true, the max travel and wait times of a submitted request"
+ " are considered hard constraints (the request gets rejected if one of the constraints is violated)."
+ " If false, the max travel and wait times are considered soft constraints (insertion of a request that"
+ " violates one of the constraints is allowed, but its cost is increased by additional penalty to make"
+ " it relatively less attractive). Penalisation of insertions can be customised by injecting a customised"
+ " InsertionCostCalculator.PenaltyCalculator")
public boolean rejectRequestIfMaxWaitOrTravelTimeViolated = true;//TODO consider renaming maxWalkDistance to max access/egress distance (or even have 2 separate params)

@Parameter
@Comment(
"Maximum beeline distance (in meters) to next stop location in stopbased system for access/egress walk leg to/from drt."
+ " If no stop can be found within this maximum distance will return null (in most cases caught by fallback routing module).")
@PositiveOrZero // used only for stopbased DRT scheme
public double maxWalkDistance = Double.MAX_VALUE;// [m];


@Parameter
@Comment(
"Time before reaching a planned dropoff from which it is not allowed to insert new detours for new requests. I.e.," +
" if set to 180, then a vehicle will not divert to pickup or dropoff a new passenger once a boarded passenger is only " +
"3 minutes away from her destination, even though her time window would allow it." +
" Delayed detours just before arrival are usually perceived very negatively.")
@PositiveOrZero
public double lateDiversionthreshold = 0; // [s];


@Override
protected void checkConsistency(Config config) {
super.checkConsistency(config);
if ((maxDetourAlpha != Double.POSITIVE_INFINITY && maxDetourBeta != Double.POSITIVE_INFINITY) || maxAbsoluteDetour != Double.POSITIVE_INFINITY) {
Verify.verify(maxAllowedPickupDelay != Double.POSITIVE_INFINITY, "Detour constraints are activated, " +
"maxAllowedPickupDelay must be specified! A value between 0 and 240 seconds can be a good choice for maxAllowedPickupDelay.");
}
}
}
36 changes: 36 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">

<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>

<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/moia-oss/matsim-libs</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>${env.USERNAME}</username>
<password>${env.PASSWORD}</password>
</server>
</servers>
</settings>