diff --git a/README.md b/README.md index 0f6b554a..0faad1d4 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pom.xml b/pom.xml index 45d3ee89..c54686f8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.targomo java-client - 0.25.0-SNAPSHOT + 0.26.0-SNAPSHOT Targomo Java Client Library Java client library for easy usage of Targomo web services. https://github.com/targomo/targomo-java diff --git a/src/main/java/com/targomo/client/Constants.java b/src/main/java/com/targomo/client/Constants.java index 6f3aad4a..409471d4 100644 --- a/src/main/java/com/targomo/client/Constants.java +++ b/src/main/java/com/targomo/client/Constants.java @@ -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"; diff --git a/src/main/java/com/targomo/client/api/TravelOptions.java b/src/main/java/com/targomo/client/api/TravelOptions.java index afb1f7b4..999665dc 100644 --- a/src/main/java/com/targomo/client/api/TravelOptions.java +++ b/src/main/java/com/targomo/client/api/TravelOptions.java @@ -157,6 +157,7 @@ public class TravelOptions implements Serializable { @Transient private Float multiGraphAggregationMaxResultValue = null; @Transient private String multiGraphAggregationMathExpression = null; @Transient private Set multiGraphAggregationFilterValuesForSourceOrigins = null; + @Transient private Double multiGraphAggregationRationalSmoothingFactor = null; @Transient private Double multiGraphAggregationGravitationExponent = null; @Transient private Double multiGraphAggregationProbabilityDecay = null; @Transient private Double multiGraphAggregationLogitBetaAttractionStrength = null; @@ -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) && @@ -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, @@ -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: "); @@ -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; } diff --git a/src/main/java/com/targomo/client/api/pojo/AggregationConfiguration.java b/src/main/java/com/targomo/client/api/pojo/AggregationConfiguration.java index 1f5bd401..37ee4764 100644 --- a/src/main/java/com/targomo/client/api/pojo/AggregationConfiguration.java +++ b/src/main/java/com/targomo/client/api/pojo/AggregationConfiguration.java @@ -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 @@ -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 filterValuesForSourceOrigins; + private Double rationalSmoothingFactor; private Double gravitationExponent; private Double probabilityDecay; private Double logitBetaAttractionStrength; @@ -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; @@ -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; @@ -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(); @@ -202,8 +207,13 @@ public AggregationConfigurationBuilder filterValuesForSourceOrigins(Set 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; } @@ -252,6 +262,7 @@ public AggregationConfiguration build() { maxResultValue, postAggregationFactor, filterValuesForSourceOrigins, + rationalSmoothingFactor, gravitationExponent, probabilityDecay, logitBetaAttractionStrength, diff --git a/src/main/java/com/targomo/client/api/pojo/RoutingOptions.java b/src/main/java/com/targomo/client/api/pojo/RoutingOptions.java index 95f372f8..e1278618 100644 --- a/src/main/java/com/targomo/client/api/pojo/RoutingOptions.java +++ b/src/main/java/com/targomo/client/api/pojo/RoutingOptions.java @@ -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, diff --git a/src/main/java/com/targomo/client/api/request/config/RequestConfigurator.java b/src/main/java/com/targomo/client/api/request/config/RequestConfigurator.java index 60572ba4..ae30d47b 100644 --- a/src/main/java/com/targomo/client/api/request/config/RequestConfigurator.java +++ b/src/main/java/com/targomo/client/api/request/config/RequestConfigurator.java @@ -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(), @@ -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()) @@ -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());