Skip to content

Commit

Permalink
The OptimizeWaypoints API now supports 50 waypoints per request (20 w…
Browse files Browse the repository at this point in the history
…ith constraints like AccessHours or AppointmentTime). It adds waypoint clustering via Clustering and ClusteringIndex for better optimization. Also, total distance validation is removed for greater flexibility.
  • Loading branch information
aws-sdk-dotnet-automation committed Jan 31, 2025
1 parent 754c7c7 commit 14e55b0
Show file tree
Hide file tree
Showing 51 changed files with 834 additions and 231 deletions.
35 changes: 33 additions & 2 deletions generator/ServiceModels/geo-routes/geo-routes-2020-11-19.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@
},
"sensitive":true
},
"ClusterIndex":{
"type":"integer",
"box":true,
"min":0
},
"Corridor":{
"type":"structure",
"required":[
Expand Down Expand Up @@ -897,6 +902,7 @@
"required":["Origin"],
"members":{
"Avoid":{"shape":"WaypointOptimizationAvoidanceOptions"},
"Clustering":{"shape":"WaypointOptimizationClusteringOptions"},
"DepartureTime":{"shape":"TimestampWithTimezoneOffset"},
"Destination":{"shape":"Position"},
"DestinationOptions":{"shape":"WaypointOptimizationDestinationOptions"},
Expand Down Expand Up @@ -1455,7 +1461,8 @@
"NoSchedule",
"Other",
"ViolatedAvoidFerry",
"ViolatedAvoidRailFerry"
"ViolatedAvoidRailFerry",
"SeasonalClosure"
]
},
"RouteFerryNoticeList":{
Expand Down Expand Up @@ -1645,7 +1652,8 @@
"Ferry",
"Pedestrian",
"Scooter",
"Truck"
"Truck",
"CarShuttleTrain"
]
},
"RouteLegType":{
Expand Down Expand Up @@ -3692,6 +3700,21 @@
"max":20,
"min":0
},
"WaypointOptimizationClusteringAlgorithm":{
"type":"string",
"enum":[
"DrivingDistance",
"TopologySegment"
]
},
"WaypointOptimizationClusteringOptions":{
"type":"structure",
"required":["Algorithm"],
"members":{
"Algorithm":{"shape":"WaypointOptimizationClusteringAlgorithm"},
"DrivingDistanceOptions":{"shape":"WaypointOptimizationDrivingDistanceOptions"}
}
},
"WaypointOptimizationConnection":{
"type":"structure",
"required":[
Expand Down Expand Up @@ -3745,6 +3768,13 @@
"TreatServiceTimeAs":{"shape":"WaypointOptimizationServiceTimeTreatment"}
}
},
"WaypointOptimizationDrivingDistanceOptions":{
"type":"structure",
"required":["DrivingDistance"],
"members":{
"DrivingDistance":{"shape":"DistanceMeters"}
}
},
"WaypointOptimizationExclusionOptions":{
"type":"structure",
"required":["Countries"],
Expand Down Expand Up @@ -3809,6 +3839,7 @@
],
"members":{
"ArrivalTime":{"shape":"TimestampWithTimezoneOffset"},
"ClusterIndex":{"shape":"ClusterIndex"},
"DepartureTime":{"shape":"TimestampWithTimezoneOffset"},
"Id":{"shape":"WaypointId"},
"Position":{"shape":"Position"}
Expand Down
129 changes: 77 additions & 52 deletions generator/ServiceModels/geo-routes/geo-routes-2020-11-19.docs.json

Large diffs are not rendered by default.

154 changes: 101 additions & 53 deletions generator/ServiceModels/geo-routes/geo-routes-2020-11-19.normal.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{
"version" : 2,
"testCases" : [ {
"id" : "OptimizeWaypointsSuccess",
"operationName" : "OptimizeWaypoints",
"id" : "CalculateRouteMatrixSuccess",
"operationName" : "CalculateRouteMatrix",
"input" : {
"Origin" : [ -123.253374, 49.351673 ],
"Destination" : [ -123.930756, 49.1314 ]
"Origins" : [ {
"Position" : [ -123.11679, 49.28147 ]
} ],
"Destinations" : [ {
"Position" : [ -123.11231, 49.28897192166 ]
} ],
"RoutingBoundary" : {
"Unbounded" : true
}
},
"expectation" : {
"success" : { }
Expand Down Expand Up @@ -33,13 +40,14 @@
"useAccountIdRouting" : true
}
}, {
"id" : "CalculateIsolinesSuccess",
"operationName" : "CalculateIsolines",
"id" : "SnapToRoadsSuccess",
"operationName" : "SnapToRoads",
"input" : {
"Thresholds" : {
"Time" : [ 60 ]
},
"Origin" : [ -123.116796, 49.281476 ]
"TracePoints" : [ {
"Position" : [ 8.53404, 50.16364 ]
}, {
"Position" : [ 8.53379056, 50.16352417 ]
} ]
},
"expectation" : {
"success" : { }
Expand All @@ -51,18 +59,11 @@
"useAccountIdRouting" : true
}
}, {
"id" : "CalculateRouteMatrixSuccess",
"operationName" : "CalculateRouteMatrix",
"id" : "OptimizeWaypointsSuccess",
"operationName" : "OptimizeWaypoints",
"input" : {
"Origins" : [ {
"Position" : [ -123.11679, 49.28147 ]
} ],
"Destinations" : [ {
"Position" : [ -123.11231, 49.28897192166 ]
} ],
"RoutingBoundary" : {
"Unbounded" : true
}
"Origin" : [ -123.253374, 49.351673 ],
"Destination" : [ -123.930756, 49.1314 ]
},
"expectation" : {
"success" : { }
Expand All @@ -74,14 +75,13 @@
"useAccountIdRouting" : true
}
}, {
"id" : "SnapToRoadsSuccess",
"operationName" : "SnapToRoads",
"id" : "CalculateIsolinesSuccess",
"operationName" : "CalculateIsolines",
"input" : {
"TracePoints" : [ {
"Position" : [ 8.53404, 50.16364 ]
}, {
"Position" : [ 8.53379056, 50.16352417 ]
} ]
"Thresholds" : {
"Time" : [ 60 ]
},
"Origin" : [ -123.116796, 49.281476 ]
},
"expectation" : {
"success" : { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,11 @@
<min>0</min>
<max>4294967295</max>
</property-value-rule>
<property-value-rule>
<property>Amazon.GeoRoutes.Model.WaypointOptimizationDrivingDistanceOptions.DrivingDistance</property>
<min>0</min>
<max>4294967295</max>
</property-value-rule>
<property-value-rule>
<property>Amazon.GeoRoutes.Model.WaypointOptimizationImpedingWaypoint.Id</property>
<min>1</min>
Expand All @@ -1134,6 +1139,10 @@
<property>Amazon.GeoRoutes.Model.WaypointOptimizationOptimizedWaypoint.ArrivalTime</property>
<pattern>([1-2][0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]{0,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])</pattern>
</property-value-rule>
<property-value-rule>
<property>Amazon.GeoRoutes.Model.WaypointOptimizationOptimizedWaypoint.ClusterIndex</property>
<min>0</min>
</property-value-rule>
<property-value-rule>
<property>Amazon.GeoRoutes.Model.WaypointOptimizationOptimizedWaypoint.DepartureTime</property>
<pattern>([1-2][0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]{0,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])</pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public partial class CalculateIsolinesRequest : AmazonGeoRoutesRequest
/// <summary>
/// Gets and sets the property Allow.
/// <para>
/// Features that are allowed while calculating. a route
/// Features that are allowed while calculating an isoline.
/// </para>
/// </summary>
public IsolineAllowOptions Allow
Expand Down Expand Up @@ -242,7 +242,7 @@ internal bool IsSetIsolineGeometryFormat()
/// <summary>
/// Gets and sets the property IsolineGranularity.
/// <para>
/// Defines the granularity of the returned Isoline
/// Defines the granularity of the returned Isoline.
/// </para>
/// </summary>
public IsolineGranularityOptions IsolineGranularity
Expand Down Expand Up @@ -368,6 +368,12 @@ internal bool IsSetOriginOptions()
/// Threshold to be used for the isoline calculation. Up to 3 thresholds per provided
/// type can be requested.
/// </para>
///
/// <para>
/// You incur a calculation charge for each threshold. Using a large amount of thresholds
/// in a request can lead you to incur unexpected charges. See <a href="https://docs.aws.amazon.com/location/latest/developerguide/routes-pricing.html`">
/// Amazon Location's pricing page</a> for more information.
/// </para>
/// </summary>
[AWSProperty(Required=true)]
public IsolineThresholds Thresholds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Amazon.GeoRoutes.Model
{
/// <summary>
/// Container for the parameters to the CalculateRouteMatrix operation.
/// Calculates route matrix containing the results for all pairs of Origins to Destinations.
/// Use <c>CalculateRouteMatrix</c> to compute results for all pairs of Origins to Destinations.
/// Each row corresponds to one entry in Origins. Each entry in the row corresponds to
/// the route from that entry in Origins to an entry in Destinations positions.
/// </summary>
Expand All @@ -54,7 +54,7 @@ public partial class CalculateRouteMatrixRequest : AmazonGeoRoutesRequest
/// <summary>
/// Gets and sets the property Allow.
/// <para>
/// Features that are allowed while calculating. a route
/// Features that are allowed while calculating a route.
/// </para>
/// </summary>
public RouteMatrixAllowOptions Allow
Expand Down Expand Up @@ -146,6 +146,13 @@ internal bool IsSetDepartureTime()
/// <para>
/// List of destinations for the route.
/// </para>
/// <note>
/// <para>
/// Route calculations are billed for each origin and destination pair. If you use a large
/// matrix of origins and destinations, your costs will increase accordingly. See <a href="https://docs.aws.amazon.com/location/latest/developerguide/routes-pricing.html`">
/// Amazon Location's pricing page</a> for more information.
/// </para>
/// </note>
/// </summary>
[AWSProperty(Required=true, Min=1)]
public List<RouteMatrixDestination> Destinations
Expand Down Expand Up @@ -225,6 +232,13 @@ internal bool IsSetOptimizeRoutingFor()
/// <para>
/// The position in longitude and latitude for the origin.
/// </para>
/// <note>
/// <para>
/// Route calculations are billed for each origin and destination pair. Using a large
/// amount of Origins in a request can lead you to incur unexpected charges. See <a href="https://docs.aws.amazon.com/location/latest/developerguide/routes-pricing.html`">
/// Amazon Location's pricing page</a> for more information.
/// </para>
/// </note>
/// </summary>
[AWSProperty(Required=true, Min=1)]
public List<RouteMatrixOrigin> Origins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ namespace Amazon.GeoRoutes.Model
{
/// <summary>
/// Container for the parameters to the CalculateRoutes operation.
/// Calculates a route given the following required parameters: <c>Origin</c> and <c>Destination</c>.
/// <c>CalculateRoutes</c> computes routes given the following required parameters: <c>Origin</c>
/// and <c>Destination</c>.
/// </summary>
public partial class CalculateRoutesRequest : AmazonGeoRoutesRequest
{
Expand Down Expand Up @@ -64,7 +65,7 @@ public partial class CalculateRoutesRequest : AmazonGeoRoutesRequest
/// <summary>
/// Gets and sets the property Allow.
/// <para>
/// Features that are allowed while calculating. a route
/// Features that are allowed while calculating a route.
/// </para>
/// </summary>
public RouteAllowOptions Allow
Expand Down Expand Up @@ -590,7 +591,7 @@ internal bool IsSetTravelModeOptions()
/// <para>
/// Type of step returned by the response. Default provides basic steps intended for web
/// based applications. TurnByTurn provides detailed instructions with more granularity
/// intended for a turn based naviagtion system.
/// intended for a turn based navigation system.
/// </para>
/// </summary>
public RouteTravelStepType TravelStepType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ public IRequest Marshall(OptimizeWaypointsRequest publicRequest)
context.Writer.WriteObjectEnd();
}

if(publicRequest.IsSetClustering())
{
context.Writer.WritePropertyName("Clustering");
context.Writer.WriteObjectStart();

var marshaller = WaypointOptimizationClusteringOptionsMarshaller.Instance;
marshaller.Marshall(publicRequest.Clustering, context);

context.Writer.WriteObjectEnd();
}

if(publicRequest.IsSetDepartureTime())
{
context.Writer.WritePropertyName("DepartureTime");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

/*
* Do not modify this file. This file is generated from the geo-routes-2020-11-19.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;

using Amazon.GeoRoutes.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;

#pragma warning disable CS0612,CS0618
namespace Amazon.GeoRoutes.Model.Internal.MarshallTransformations
{
/// <summary>
/// WaypointOptimizationClusteringOptions Marshaller
/// </summary>
public class WaypointOptimizationClusteringOptionsMarshaller : IRequestMarshaller<WaypointOptimizationClusteringOptions, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(WaypointOptimizationClusteringOptions requestObject, JsonMarshallerContext context)
{
if(requestObject == null)
return;
if(requestObject.IsSetAlgorithm())
{
context.Writer.WritePropertyName("Algorithm");
context.Writer.Write(requestObject.Algorithm);
}

if(requestObject.IsSetDrivingDistanceOptions())
{
context.Writer.WritePropertyName("DrivingDistanceOptions");
context.Writer.WriteObjectStart();

var marshaller = WaypointOptimizationDrivingDistanceOptionsMarshaller.Instance;
marshaller.Marshall(requestObject.DrivingDistanceOptions, context);

context.Writer.WriteObjectEnd();
}

}

/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static WaypointOptimizationClusteringOptionsMarshaller Instance = new WaypointOptimizationClusteringOptionsMarshaller();

}
}
Loading

0 comments on commit 14e55b0

Please sign in to comment.