Skip to content
Open
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ nexus and to the maven repo (last is only possibly from master).

## Release Notes

### 0.26.0
- include multiGraphAggregationRationalSmoothingFactor in TravelOptions and rationalSmoothingFactor in AggregationConfiguration

### 0.25.0
- Add Snapping Related params to CompetingRouting RoutingOptions.
- Fix central maven deploy
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.targomo</groupId>
<artifactId>java-client</artifactId>
<version>0.25.0-SNAPSHOT</version>
<version>0.26.0-SNAPSHOT</version>
<name>Targomo Java Client Library</name>
<description>Java client library for easy usage of Targomo web services.</description>
<url>https://github.com/targomo/targomo-java</url>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/targomo/client/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public class Constants {
public static final String MULTIGRAPH_AGGREGATION_MAX_RESULT_VALUE_RATIO = "maxResultValueRatio";
public static final String MULTIGRAPH_AGGREGATION_MAX_RESULT_VALUE = "maxResultValue";
public static final String MULTIGRAPH_AGGREGATION_POST_AGGREGATION_FACTOR = "postAggregationFactor";
public static final String MULTIGRAPH_AGGREGATION_RATIONAL_SMOOTHING_FACTOR = "rationalSmoothingFactor";
public static final String MULTIGRAPH_AGGREGATION_GRAVITATION_EXPONENT = "gravitationExponent";
public static final String MULTIGRAPH_AGGREGATION_PROBABILITY_DECAY = "probabilityDecay";
public static final String MULTIGRAPH_AGGREGATION_LOGIT_BETA_ATTRACTION_STRENGTH = "logitBetaAttractionStrength";
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/com/targomo/client/api/TravelOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public class TravelOptions implements Serializable {
@Transient private Float multiGraphAggregationMaxResultValue = null;
@Transient private String multiGraphAggregationMathExpression = null;
@Transient private Set<String> multiGraphAggregationFilterValuesForSourceOrigins = null;
@Transient private Double multiGraphAggregationRationalSmoothingFactor = null;
@Transient private Double multiGraphAggregationGravitationExponent = null;
@Transient private Double multiGraphAggregationProbabilityDecay = null;
@Transient private Double multiGraphAggregationLogitBetaAttractionStrength = null;
Expand Down Expand Up @@ -919,6 +920,7 @@ public boolean equals(Object o) {
Objects.equals(multiGraphAggregationMaxResultValueRatio, that.multiGraphAggregationMaxResultValueRatio) &&
Objects.equals(multiGraphAggregationMaxResultValue, that.multiGraphAggregationMaxResultValue) &&
Objects.equals(multiGraphAggregationFilterValuesForSourceOrigins, that.multiGraphAggregationFilterValuesForSourceOrigins) &&
Objects.equals(multiGraphAggregationRationalSmoothingFactor, that.multiGraphAggregationRationalSmoothingFactor) &&
Objects.equals(multiGraphAggregationGravitationExponent, that.multiGraphAggregationGravitationExponent) &&
Objects.equals(multiGraphAggregationProbabilityDecay, that.multiGraphAggregationProbabilityDecay) &&
Objects.equals(multiGraphAggregationLogitBetaAttractionStrength, that.multiGraphAggregationLogitBetaAttractionStrength) &&
Expand Down Expand Up @@ -988,7 +990,8 @@ public int hashCode() {
multiGraphAggregationSourceValuesLowerBound, multiGraphAggregationSourceValuesUpperBound,
multiGraphAggregationMinResultValueRatio, multiGraphAggregationMinResultValue,
multiGraphAggregationMaxResultValueRatio, multiGraphAggregationMaxResultValue,
multiGraphAggregationGravitationExponent, multiGraphAggregationProbabilityDecay, multiGraphAggregationLogitBetaAttractionStrength,
multiGraphAggregationRationalSmoothingFactor, multiGraphAggregationGravitationExponent,
multiGraphAggregationProbabilityDecay, multiGraphAggregationLogitBetaAttractionStrength,
multiGraphAggregationLogitBetaTravelTime, multiGraphLayerCustomGeometryMergeAggregation,
multiGraphAggregationInputParameters, multiGraphAggregationFilterValuesForSourceOrigins,
multiGraphPreAggregationPipeline, multiGraphAggregationMathExpression, multiGraphLayerType,
Expand Down Expand Up @@ -1132,6 +1135,8 @@ public String toString() {
builder.append(multiGraphLayerCustomGeometryMergeAggregation);
builder.append("\n\tmultiGraphAggregationPostAggregationFactor: ");
builder.append(multiGraphAggregationPostAggregationFactor);
builder.append("\n\tmultiGraphAggregationRationalSmoothingFactor: ");
builder.append(multiGraphAggregationRationalSmoothingFactor);
builder.append("\n\tmultiGraphAggregationGravitationExponent: ");
builder.append(multiGraphAggregationGravitationExponent);
builder.append("\n\tmultiGraphAggregationProbabilityDecay: ");
Expand Down Expand Up @@ -1483,6 +1488,14 @@ public void setMultiGraphAggregationMaxResultValue(Float multiGraphAggregationMa
this.multiGraphAggregationMaxResultValue = multiGraphAggregationMaxResultValue;
}

public Double getMultiGraphAggregationRationalSmoothingFactor() {
return multiGraphAggregationRationalSmoothingFactor;
}

public void setMultiGraphAggregationRationalSmoothingFactor(Double multiGraphAggregationRationalSmoothingFactor) {
this.multiGraphAggregationRationalSmoothingFactor = multiGraphAggregationRationalSmoothingFactor;
}

public Double getMultiGraphAggregationGravitationExponent() {
return multiGraphAggregationGravitationExponent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class AggregationConfiguration {

// The specified type of the aggregation to be used on Multigraph layers. E.g.: mean, min, max, etc.
// for any type of special probability aggregations only minSourcesCount, sourceValuesLowerBound, sourceValuesUpperBound
// and probability specific parameters such as gravitationExponent, probabilityDecay, logitBetaAttractionStrength/TravelTime are considered
// and probability specific parameters such as gravitationExponent, probabilityDecay, rationalSmoothingFactor,
// logitBetaAttractionStrength/TravelTime are considered
private MultiGraphAggregationType type;
// Whether or not layers with no value should be included in the aggregation
private Boolean ignoreOutliers; //specific to some aggregations
Expand Down Expand Up @@ -49,6 +50,7 @@ public class AggregationConfiguration {
// Only elements whose origin (layer with the lowest value for the element id) is in this set
// will be included in the aggregation. If null, the elements are not filtered by source origin.
private Set<String> filterValuesForSourceOrigins;
private Double rationalSmoothingFactor;
private Double gravitationExponent;
private Double probabilityDecay;
private Double logitBetaAttractionStrength;
Expand All @@ -68,6 +70,7 @@ public static class AggregationConfigurationBuilder {
private Float minResultValue;
private Double maxResultValueRatio;
private Float maxResultValue;
private Double rationalSmoothingFactor;
private Double gravitationExponent;
private Double probabilityDecay;
private Double logitBetaAttractionStrength;
Expand All @@ -92,6 +95,7 @@ public AggregationConfigurationBuilder(AggregationConfiguration toCopy) {
this.maxResultValueRatio = toCopy.maxResultValueRatio;
this.maxResultValue = toCopy.maxResultValue;
this.filterValuesForSourceOrigins = Optional.ofNullable(toCopy.filterValuesForSourceOrigins).map(HashSet::new).orElse(null);
this.rationalSmoothingFactor = toCopy.rationalSmoothingFactor;
this.gravitationExponent = toCopy.gravitationExponent;
this.probabilityDecay = toCopy.probabilityDecay;
this.logitBetaAttractionStrength = toCopy.logitBetaAttractionStrength;
Expand Down Expand Up @@ -125,6 +129,7 @@ public AggregationConfigurationBuilder(TravelOptions travelOptions, boolean deep
this.postAggregationFactor = travelOptions.getMultiGraphAggregationPostAggregationFactor();
this.filterValuesForSourceOrigins = !deepCopy ? travelOptions.getMultiGraphAggregationFilterValuesForSourceOrigins() :
Optional.ofNullable(travelOptions.getMultiGraphAggregationFilterValuesForSourceOrigins()).map(HashSet::new).orElse(null);
this.rationalSmoothingFactor = travelOptions.getMultiGraphAggregationRationalSmoothingFactor();
this.gravitationExponent = travelOptions.getMultiGraphAggregationGravitationExponent();
this.probabilityDecay = travelOptions.getMultiGraphAggregationProbabilityDecay();
this.logitBetaAttractionStrength = travelOptions.getMultiGraphAggregationLogitBetaAttractionStrength();
Expand Down Expand Up @@ -202,8 +207,13 @@ public AggregationConfigurationBuilder filterValuesForSourceOrigins(Set<String>
return this;
}

public AggregationConfigurationBuilder gravitationExponent(Double gravitationTravelTimeExponent) {
this.gravitationExponent = gravitationTravelTimeExponent;
public AggregationConfigurationBuilder rationalSmoothingFactor(Double rationalSmoothingFactor) {
this.rationalSmoothingFactor = rationalSmoothingFactor;
return this;
}

public AggregationConfigurationBuilder gravitationExponent(Double gravitationExponent) {
this.gravitationExponent = gravitationExponent;
return this;
}

Expand Down Expand Up @@ -252,6 +262,7 @@ public AggregationConfiguration build() {
maxResultValue,
postAggregationFactor,
filterValuesForSourceOrigins,
rationalSmoothingFactor,
gravitationExponent,
probabilityDecay,
logitBetaAttractionStrength,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class RoutingOptions {

@Override //overriding hash code since the has would change with each execution for enums (travelType)
public int hashCode(){
return Objects.hash(maxEdgeWeight, travelType.getKey(), travelTimeFactors, reverse, rushHour, time, date, frame,
return Objects.hash(maxEdgeWeight, travelType == null ? null : travelType.getKey(), travelTimeFactors, reverse, rushHour, time, date, frame,
elevationEnabled, bikeSpeed, bikeDownhill, bikeUphill, walkSpeed, walkDownhill, walkUphill,
trafficJunctionPenalty, trafficSignalPenalty, trafficLeftTurnPenalty, trafficRightTurnPenalty,
maxTransfers, maxWalkingTimeFromSource, maxWalkingTimeToTarget, avoidTransitRouteTypes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private static String getCommonConfig(final TravelOptions travelOptions) throws
travelOptions.getMultiGraphAggregationMaxResultValue(),
travelOptions.getMultiGraphAggregationMaxResultValueRatio(),
travelOptions.getMultiGraphAggregationFilterValuesForSourceOrigins(),
travelOptions.getMultiGraphAggregationRationalSmoothingFactor(),
travelOptions.getMultiGraphAggregationGravitationExponent(),
travelOptions.getMultiGraphAggregationProbabilityDecay(),
travelOptions.getMultiGraphAggregationInputParameters(),
Expand Down Expand Up @@ -403,6 +404,7 @@ private static void addMultiGraphAggregation(TravelOptions travelOptions, JSONOb
travelOptions.getMultiGraphAggregationSourceValuesLowerBound(), travelOptions.getMultiGraphAggregationSourceValuesUpperBound(),
travelOptions.getMultiGraphAggregationMinSourcesRatio(), travelOptions.getMultiGraphAggregationMaxResultValue(),
travelOptions.getMultiGraphAggregationMaxResultValueRatio(), travelOptions.getMultiGraphAggregationFilterValuesForSourceOrigins(),
travelOptions.getMultiGraphAggregationRationalSmoothingFactor(),
travelOptions.getMultiGraphAggregationGravitationExponent(), travelOptions.getMultiGraphAggregationProbabilityDecay(),
travelOptions.getMultiGraphAggregationLogitBetaAttractionStrength(),
travelOptions.getMultiGraphAggregationLogitBetaTravelTime(), travelOptions.getMultiGraphAggregationPostAggregationFactor())
Expand Down Expand Up @@ -469,6 +471,9 @@ private static void fillJsonAggregationConfig(AggregationConfiguration aggregati
if (aggregationConfiguration.getPostAggregationFactor() != null)
multiGraphAggregation.put(MULTIGRAPH_AGGREGATION_POST_AGGREGATION_FACTOR, aggregationConfiguration.getPostAggregationFactor());

if (aggregationConfiguration.getRationalSmoothingFactor() != null)
multiGraphAggregation.put(MULTIGRAPH_AGGREGATION_RATIONAL_SMOOTHING_FACTOR, aggregationConfiguration.getRationalSmoothingFactor());

if (aggregationConfiguration.getGravitationExponent() != null)
multiGraphAggregation.put(MULTIGRAPH_AGGREGATION_GRAVITATION_EXPONENT, aggregationConfiguration.getGravitationExponent());

Expand Down