public sealed class Shipment.Types.VisitRequest : IMessage<Shipment.Types.VisitRequest>, IEquatable<Shipment.Types.VisitRequest>, IDeepCloneable<Shipment.Types.VisitRequest>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Optimization v1 API class Shipment.Types.VisitRequest.
Request for a visit which can be done by a vehicle: it has a geo-location
(or two, see below), opening and closing times represented by time windows,
and a service duration time (time spent by the vehicle once it has arrived
to pickup or drop off goods).
The geo-location where the vehicle arrives when performing this
VisitRequest. If the shipment model has duration distance matrices,
arrival_location must not be specified.
The waypoint where the vehicle arrives when performing this
VisitRequest. If the shipment model has duration distance matrices,
arrival_waypoint must not be specified.
Cost to service this visit request on a vehicle route. This can be used
to pay different costs for each alternative pickup or delivery of a
shipment. This cost must be in the same unit as Shipment.penalty_cost
and must not be negative.
The geo-location where the vehicle departs after completing this
VisitRequest. Can be omitted if it is the same as arrival_location.
If the shipment model has duration distance matrices,
departure_location must not be specified.
The waypoint where the vehicle departs after completing this
VisitRequest. Can be omitted if it is the same as arrival_waypoint.
If the shipment model has duration distance matrices,
departure_waypoint must not be specified.
Specifies a label for this VisitRequest. This label is reported in the
response as visit_label in the corresponding
[ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit].
public MapField<string, Shipment.Types.Load> LoadDemands { get; }
Load demands of this visit request. This is just like
[Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]
field, except that it only applies to this
[VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest]
instead of the whole [Shipment][google.cloud.optimization.v1.Shipment].
The demands listed here are added to the demands listed in
[Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands].
public RepeatedField<TimeWindow> TimeWindows { get; }
Time windows which constrain the arrival time at a visit.
Note that a vehicle may depart outside of the arrival time window, i.e.
arrival time + duration do not need to be inside a time window. This can
result in waiting time if the vehicle arrives before
[TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time].
The absence of TimeWindow means that the vehicle can perform this visit
at any time.
Time windows must be disjoint, i.e. no time window must overlap with or
be adjacent to another, and they must be in increasing order.
cost_per_hour_after_soft_end_time and soft_end_time can only
be set if there is a single time window.
Specifies the types of the visit. This may be used to allocate additional
time required for a vehicle to complete this visit (see
[Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eShipment.Types.VisitRequest\u003c/code\u003e class represents a request for a vehicle visit, including information like geo-location, time windows, and service duration.\u003c/p\u003e\n"],["\u003cp\u003eThis class allows for specifying arrival and departure locations or waypoints, and it supports defining costs associated with servicing the visit request.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eVisitRequest\u003c/code\u003e can have associated load demands, which are added to the shipment's overall load demands, and it also includes deprecated fields such as Demands.\u003c/p\u003e\n"],["\u003cp\u003eTime windows can be set to constrain the arrival time, with an absence of time windows meaning the visit can occur at any time, and it also supports tags and visit types for further specification.\u003c/p\u003e\n"],["\u003cp\u003eMultiple versions of the class documentation are available, ranging from version 1.0.0-beta01 to the latest version 2.6.0, allowing developers to access different API iterations.\u003c/p\u003e\n"]]],[],null,["# Cloud Optimization v1 API - Class Shipment.Types.VisitRequest (2.6.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.6.0 (latest)](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Optimization.V1/2.5.0/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Optimization.V1/2.4.0/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Optimization.V1/2.3.0/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Optimization.V1/2.2.0/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Optimization.V1/2.1.0/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Optimization.V1/2.0.0/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest)\n- [1.0.0-beta01](/dotnet/docs/reference/Google.Cloud.Optimization.V1/1.0.0-beta01/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest) \n\n public sealed class Shipment.Types.VisitRequest : IMessage\u003cShipment.Types.VisitRequest\u003e, IEquatable\u003cShipment.Types.VisitRequest\u003e, IDeepCloneable\u003cShipment.Types.VisitRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Optimization v1 API class Shipment.Types.VisitRequest.\n\nRequest for a visit which can be done by a vehicle: it has a geo-location\n(or two, see below), opening and closing times represented by time windows,\nand a service duration time (time spent by the vehicle once it has arrived\nto pickup or drop off goods). \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Shipment.Types.VisitRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Shipment](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment)[Types](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment.Types)[VisitRequest](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Shipment](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment)[Types](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment.Types)[VisitRequest](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Shipment](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment)[Types](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment.Types)[VisitRequest](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1.Shipment.Types.VisitRequest), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Optimization.V1](/dotnet/docs/reference/Google.Cloud.Optimization.V1/latest/Google.Cloud.Optimization.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Optimization.V1.dll\n\nConstructors\n------------\n\n### VisitRequest()\n\n public VisitRequest()\n\n### VisitRequest(VisitRequest)\n\n public VisitRequest(Shipment.Types.VisitRequest other)\n\nProperties\n----------\n\n### ArrivalLocation\n\n public LatLng ArrivalLocation { get; set; }\n\nThe geo-location where the vehicle arrives when performing this\n`VisitRequest`. If the shipment model has duration distance matrices,\n`arrival_location` must not be specified.\n\n### ArrivalWaypoint\n\n public Waypoint ArrivalWaypoint { get; set; }\n\nThe waypoint where the vehicle arrives when performing this\n`VisitRequest`. If the shipment model has duration distance matrices,\n`arrival_waypoint` must not be specified.\n\n### Cost\n\n public double Cost { get; set; }\n\nCost to service this visit request on a vehicle route. This can be used\nto pay different costs for each alternative pickup or delivery of a\nshipment. This cost must be in the same unit as `Shipment.penalty_cost`\nand must not be negative.\n\n### Demands\n\n [Obsolete]\n public RepeatedField\u003cCapacityQuantity\u003e Demands { get; }\n\nDeprecated: Use\n\\[VisitRequest.load_demands\\]\\[google.cloud.optimization.v1.Shipment.VisitRequest.load_demands\\]\ninstead.\n\n### DepartureLocation\n\n public LatLng DepartureLocation { get; set; }\n\nThe geo-location where the vehicle departs after completing this\n`VisitRequest`. Can be omitted if it is the same as `arrival_location`.\nIf the shipment model has duration distance matrices,\n`departure_location` must not be specified.\n\n### DepartureWaypoint\n\n public Waypoint DepartureWaypoint { get; set; }\n\nThe waypoint where the vehicle departs after completing this\n`VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`.\nIf the shipment model has duration distance matrices,\n`departure_waypoint` must not be specified.\n\n### Duration\n\n public Duration Duration { get; set; }\n\nDuration of the visit, i.e. time spent by the vehicle between arrival\nand departure (to be added to the possible waiting time; see\n`time_windows`).\n\n### Label\n\n public string Label { get; set; }\n\nSpecifies a label for this `VisitRequest`. This label is reported in the\nresponse as `visit_label` in the corresponding\n\\[ShipmentRoute.Visit\\]\\[google.cloud.optimization.v1.ShipmentRoute.Visit\\].\n\n### LoadDemands\n\n public MapField\u003cstring, Shipment.Types.Load\u003e LoadDemands { get; }\n\nLoad demands of this visit request. This is just like\n\\[Shipment.load_demands\\]\\[google.cloud.optimization.v1.Shipment.load_demands\\]\nfield, except that it only applies to this\n\\[VisitRequest\\]\\[google.cloud.optimization.v1.Shipment.VisitRequest\\]\ninstead of the whole \\[Shipment\\]\\[google.cloud.optimization.v1.Shipment\\].\nThe demands listed here are added to the demands listed in\n\\[Shipment.load_demands\\]\\[google.cloud.optimization.v1.Shipment.load_demands\\].\n\n### Tags\n\n public RepeatedField\u003cstring\u003e Tags { get; }\n\nSpecifies tags attached to the visit request.\nEmpty or duplicate strings are not allowed.\n\n### TimeWindows\n\n public RepeatedField\u003cTimeWindow\u003e TimeWindows { get; }\n\nTime windows which constrain the arrival time at a visit.\nNote that a vehicle may depart outside of the arrival time window, i.e.\narrival time + duration do not need to be inside a time window. This can\nresult in waiting time if the vehicle arrives before\n\\[TimeWindow.start_time\\]\\[google.cloud.optimization.v1.TimeWindow.start_time\\].\n\nThe absence of `TimeWindow` means that the vehicle can perform this visit\nat any time.\n\nTime windows must be disjoint, i.e. no time window must overlap with or\nbe adjacent to another, and they must be in increasing order.\n\n`cost_per_hour_after_soft_end_time` and `soft_end_time` can only\nbe set if there is a single time window.\n\n### VisitTypes\n\n public RepeatedField\u003cstring\u003e VisitTypes { get; }\n\nSpecifies the types of the visit. This may be used to allocate additional\ntime required for a vehicle to complete this visit (see\n\\[Vehicle.extra_visit_duration_for_visit_type\\]\\[google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type\\]).\n\nA type can only appear once."]]