Reference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::Vehicle::DurationLimit.
A limit defining a maximum duration of the route of a vehicle. It can be
either hard or soft.
When a soft limit field is defined, both the soft max threshold and its
associated cost must be defined together.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#cost_per_hour_after_soft_max
defcost_per_hour_after_soft_max()->::Float
Returns
(::Float) — Cost per hour incurred if the soft_max_duration threshold is violated.
The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:
cost_per_hour_after_soft_max * (duration - soft_max_duration)
The cost must be nonnegative.
#cost_per_hour_after_soft_max=
defcost_per_hour_after_soft_max=(value)->::Float
Parameter
value (::Float) — Cost per hour incurred if the soft_max_duration threshold is violated.
The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:
cost_per_hour_after_soft_max * (duration - soft_max_duration)
The cost must be nonnegative.
Returns
(::Float) — Cost per hour incurred if the soft_max_duration threshold is violated.
The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:
cost_per_hour_after_soft_max * (duration - soft_max_duration)
The cost must be nonnegative.
(::Google::Protobuf::Duration) — A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost, quadratic in the duration. This cost adds
up to other costs defined in the model, with the same unit.
If defined, quadratic_soft_max_duration must be nonnegative. If
max_duration is also defined, quadratic_soft_max_duration must be
less than max_duration, and the difference must be no larger than one
day:
value (::Google::Protobuf::Duration) — A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost, quadratic in the duration. This cost adds
up to other costs defined in the model, with the same unit.
If defined, quadratic_soft_max_duration must be nonnegative. If
max_duration is also defined, quadratic_soft_max_duration must be
less than max_duration, and the difference must be no larger than one
day:
(::Google::Protobuf::Duration) — A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost, quadratic in the duration. This cost adds
up to other costs defined in the model, with the same unit.
If defined, quadratic_soft_max_duration must be nonnegative. If
max_duration is also defined, quadratic_soft_max_duration must be
less than max_duration, and the difference must be no larger than one
day:
(::Google::Protobuf::Duration) — A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost. This cost adds up to other costs defined in
the model, with the same unit.
If defined, soft_max_duration must be nonnegative. If max_duration is
also defined, soft_max_duration must be less than max_duration.
value (::Google::Protobuf::Duration) — A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost. This cost adds up to other costs defined in
the model, with the same unit.
If defined, soft_max_duration must be nonnegative. If max_duration is
also defined, soft_max_duration must be less than max_duration.
Returns
(::Google::Protobuf::Duration) — A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost. This cost adds up to other costs defined in
the model, with the same unit.
If defined, soft_max_duration must be nonnegative. If max_duration is
also defined, soft_max_duration must be less than max_duration.
[[["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-09 UTC."],[],[],null,["# Cloud Optimization V1 API - Class Google::Cloud::Optimization::V1::Vehicle::DurationLimit (v0.12.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.12.0 (latest)](/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.11.1](/ruby/docs/reference/google-cloud-optimization-v1/0.11.1/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.10.0](/ruby/docs/reference/google-cloud-optimization-v1/0.10.0/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.9.2](/ruby/docs/reference/google-cloud-optimization-v1/0.9.2/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.8.2](/ruby/docs/reference/google-cloud-optimization-v1/0.8.2/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.7.0](/ruby/docs/reference/google-cloud-optimization-v1/0.7.0/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.6.0](/ruby/docs/reference/google-cloud-optimization-v1/0.6.0/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.5.0](/ruby/docs/reference/google-cloud-optimization-v1/0.5.0/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.4.1](/ruby/docs/reference/google-cloud-optimization-v1/0.4.1/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.3.0](/ruby/docs/reference/google-cloud-optimization-v1/0.3.0/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.2.1](/ruby/docs/reference/google-cloud-optimization-v1/0.2.1/Google-Cloud-Optimization-V1-Vehicle-DurationLimit)\n- [0.1.1](/ruby/docs/reference/google-cloud-optimization-v1/0.1.1/Google-Cloud-Optimization-V1-Vehicle-DurationLimit) \nReference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::Vehicle::DurationLimit.\n\nA limit defining a maximum duration of the route of a vehicle. It can be\neither hard or soft.\n\n\n\u003cbr /\u003e\n\nWhen a soft limit field is defined, both the soft max threshold and its\nassociated cost must be defined together. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #cost_per_hour_after_soft_max\n\n def cost_per_hour_after_soft_max() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- Cost per hour incurred if the `soft_max_duration` threshold is violated. The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows: `\n cost_per_hour_after_soft_max * (duration - soft_max_duration)\n ` The cost must be nonnegative.\n\n### #cost_per_hour_after_soft_max=\n\n def cost_per_hour_after_soft_max=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- Cost per hour incurred if the `soft_max_duration` threshold is violated. The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows: `\n cost_per_hour_after_soft_max * (duration - soft_max_duration)\n` The cost must be nonnegative. \n**Returns**\n\n- (::Float) --- Cost per hour incurred if the `soft_max_duration` threshold is violated. The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows: `\n cost_per_hour_after_soft_max * (duration - soft_max_duration)\n ` The cost must be nonnegative.\n\n### #cost_per_square_hour_after_quadratic_soft_max\n\n def cost_per_square_hour_after_quadratic_soft_max() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- Cost per square hour incurred if the `quadratic_soft_max_duration` threshold is violated.\n\n\n The additional cost is 0 if the duration is under the threshold,\n otherwise the cost depends on the duration as follows:\n\n `\n cost_per_square_hour_after_quadratic_soft_max *\n (duration - quadratic_soft_max_duration)^2\n `\n\n The cost must be nonnegative.\n\n### #cost_per_square_hour_after_quadratic_soft_max=\n\n def cost_per_square_hour_after_quadratic_soft_max=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- Cost per square hour incurred if the `quadratic_soft_max_duration` threshold is violated.\n\n\n The additional cost is 0 if the duration is under the threshold,\n otherwise the cost depends on the duration as follows:\n\n `\n cost_per_square_hour_after_quadratic_soft_max *\n (duration - quadratic_soft_max_duration)^2\n `\n\nThe cost must be nonnegative. \n**Returns**\n\n- (::Float) --- Cost per square hour incurred if the `quadratic_soft_max_duration` threshold is violated.\n\n\n The additional cost is 0 if the duration is under the threshold,\n otherwise the cost depends on the duration as follows:\n\n `\n cost_per_square_hour_after_quadratic_soft_max *\n (duration - quadratic_soft_max_duration)^2\n `\n\n The cost must be nonnegative.\n\n### #max_duration\n\n def max_duration() -\u003e ::Google::Protobuf::Duration\n\n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A hard limit constraining the duration to be at most max_duration.\n\n### #max_duration=\n\n def max_duration=(value) -\u003e ::Google::Protobuf::Duration\n\n**Parameter**\n\n- **value** ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A hard limit constraining the duration to be at most max_duration. \n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A hard limit constraining the duration to be at most max_duration.\n\n### #quadratic_soft_max_duration\n\n def quadratic_soft_max_duration() -\u003e ::Google::Protobuf::Duration\n\n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit.\n\n\n If defined, `quadratic_soft_max_duration` must be nonnegative. If\n `max_duration` is also defined, `quadratic_soft_max_duration` must be\n less than `max_duration`, and the difference must be no larger than one\n day:\n\n `max_duration - quadratic_soft_max_duration \u003c= 86400 seconds`\n\n### #quadratic_soft_max_duration=\n\n def quadratic_soft_max_duration=(value) -\u003e ::Google::Protobuf::Duration\n\n**Parameter**\n\n- **value** ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit.\n\n\n If defined, `quadratic_soft_max_duration` must be nonnegative. If\n `max_duration` is also defined, `quadratic_soft_max_duration` must be\n less than `max_duration`, and the difference must be no larger than one\n day:\n\n`max_duration - quadratic_soft_max_duration \u003c= 86400 seconds` \n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit.\n\n\n If defined, `quadratic_soft_max_duration` must be nonnegative. If\n `max_duration` is also defined, `quadratic_soft_max_duration` must be\n less than `max_duration`, and the difference must be no larger than one\n day:\n\n `max_duration - quadratic_soft_max_duration \u003c= 86400 seconds`\n\n### #soft_max_duration\n\n def soft_max_duration() -\u003e ::Google::Protobuf::Duration\n\n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit.\n\n\n If defined, `soft_max_duration` must be nonnegative. If max_duration is\n also defined, `soft_max_duration` must be less than max_duration.\n\n### #soft_max_duration=\n\n def soft_max_duration=(value) -\u003e ::Google::Protobuf::Duration\n\n**Parameter**\n\n- **value** ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit.\n\n\n If defined, `soft_max_duration` must be nonnegative. If max_duration is\nalso defined, `soft_max_duration` must be less than max_duration. \n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit.\n\n\n If defined, `soft_max_duration` must be nonnegative. If max_duration is\n also defined, `soft_max_duration` must be less than max_duration."]]