Reference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::DistanceLimit.
A limit defining a maximum distance which can be traveled. It can be either
hard or soft.
If a soft limit is defined, both soft_max_meters and
cost_per_kilometer_above_soft_max must be defined and be nonnegative.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#cost_per_kilometer_above_soft_max
defcost_per_kilometer_above_soft_max()->::Float
Returns
(::Float) — Cost per kilometer incurred if distance is above soft_max_meters limit.
The additional cost is 0 if the distance is under the limit, otherwise the
formula used to compute the cost is the following:
(distance_meters - soft_max_meters) / 1000.0 *
cost_per_kilometer_above_soft_max.
The cost must be nonnegative.
value (::Float) — Cost per kilometer incurred if distance is above soft_max_meters limit.
The additional cost is 0 if the distance is under the limit, otherwise the
formula used to compute the cost is the following:
(distance_meters - soft_max_meters) / 1000.0 *
cost_per_kilometer_above_soft_max.
The cost must be nonnegative.
Returns
(::Float) — Cost per kilometer incurred if distance is above soft_max_meters limit.
The additional cost is 0 if the distance is under the limit, otherwise the
formula used to compute the cost is the following:
(distance_meters - soft_max_meters) / 1000.0 *
cost_per_kilometer_above_soft_max.
The cost must be nonnegative.
#cost_per_kilometer_below_soft_max
defcost_per_kilometer_below_soft_max()->::Float
Returns
(::Float) — Cost per kilometer incurred, increasing up to soft_max_meters, with
formula:
min(distance_meters, soft_max_meters) / 1000.0 *
cost_per_kilometer_below_soft_max.
This cost is not supported in route_distance_limit.
value (::Float) — Cost per kilometer incurred, increasing up to soft_max_meters, with
formula:
min(distance_meters, soft_max_meters) / 1000.0 *
cost_per_kilometer_below_soft_max.
This cost is not supported in route_distance_limit.
Returns
(::Float) — Cost per kilometer incurred, increasing up to soft_max_meters, with
formula:
min(distance_meters, soft_max_meters) / 1000.0 *
cost_per_kilometer_below_soft_max.
This cost is not supported in route_distance_limit.
#max_meters
defmax_meters()->::Integer
Returns
(::Integer) — A hard limit constraining the distance to be at most max_meters. The limit
must be nonnegative.
#max_meters=
defmax_meters=(value)->::Integer
Parameter
value (::Integer) — A hard limit constraining the distance to be at most max_meters. The limit
must be nonnegative.
Returns
(::Integer) — A hard limit constraining the distance to be at most max_meters. The limit
must be nonnegative.
#soft_max_meters
defsoft_max_meters()->::Integer
Returns
(::Integer) — A soft limit not enforcing a maximum distance limit, but when violated
results in a cost which adds up to other costs defined in the model,
with the same unit.
If defined soft_max_meters must be less than max_meters and must be
nonnegative.
#soft_max_meters=
defsoft_max_meters=(value)->::Integer
Parameter
value (::Integer) — A soft limit not enforcing a maximum distance limit, but when violated
results in a cost which adds up to other costs defined in the model,
with the same unit.
If defined soft_max_meters must be less than max_meters and must be
nonnegative.
Returns
(::Integer) — A soft limit not enforcing a maximum distance limit, but when violated
results in a cost which adds up to other costs defined in the model,
with the same unit.
If defined soft_max_meters must be less than max_meters and must be
nonnegative.
[[["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::DistanceLimit (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-DistanceLimit)\n- [0.11.1](/ruby/docs/reference/google-cloud-optimization-v1/0.11.1/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.10.0](/ruby/docs/reference/google-cloud-optimization-v1/0.10.0/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.9.2](/ruby/docs/reference/google-cloud-optimization-v1/0.9.2/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.8.2](/ruby/docs/reference/google-cloud-optimization-v1/0.8.2/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.7.0](/ruby/docs/reference/google-cloud-optimization-v1/0.7.0/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.6.0](/ruby/docs/reference/google-cloud-optimization-v1/0.6.0/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.5.0](/ruby/docs/reference/google-cloud-optimization-v1/0.5.0/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.4.1](/ruby/docs/reference/google-cloud-optimization-v1/0.4.1/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.3.0](/ruby/docs/reference/google-cloud-optimization-v1/0.3.0/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.2.1](/ruby/docs/reference/google-cloud-optimization-v1/0.2.1/Google-Cloud-Optimization-V1-DistanceLimit)\n- [0.1.1](/ruby/docs/reference/google-cloud-optimization-v1/0.1.1/Google-Cloud-Optimization-V1-DistanceLimit) \nReference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::DistanceLimit.\n\nA limit defining a maximum distance which can be traveled. It can be either\nhard or soft.\n\n\n\u003cbr /\u003e\n\nIf a soft limit is defined, both `soft_max_meters` and\n`cost_per_kilometer_above_soft_max` must be defined and be nonnegative. \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_kilometer_above_soft_max\n\n def cost_per_kilometer_above_soft_max() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- Cost per kilometer incurred if distance is above `soft_max_meters` limit. The additional cost is 0 if the distance is under the limit, otherwise the formula used to compute the cost is the following: `\n (distance_meters - soft_max_meters) / 1000.0 *\n cost_per_kilometer_above_soft_max.\n ` The cost must be nonnegative.\n\n### #cost_per_kilometer_above_soft_max=\n\n def cost_per_kilometer_above_soft_max=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- Cost per kilometer incurred if distance is above `soft_max_meters` limit. The additional cost is 0 if the distance is under the limit, otherwise the formula used to compute the cost is the following: `\n (distance_meters - soft_max_meters) / 1000.0 *\n cost_per_kilometer_above_soft_max.\n` The cost must be nonnegative. \n**Returns**\n\n- (::Float) --- Cost per kilometer incurred if distance is above `soft_max_meters` limit. The additional cost is 0 if the distance is under the limit, otherwise the formula used to compute the cost is the following: `\n (distance_meters - soft_max_meters) / 1000.0 *\n cost_per_kilometer_above_soft_max.\n ` The cost must be nonnegative.\n\n### #cost_per_kilometer_below_soft_max\n\n def cost_per_kilometer_below_soft_max() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- Cost per kilometer incurred, increasing up to `soft_max_meters`, with formula: `\n min(distance_meters, soft_max_meters) / 1000.0 *\n cost_per_kilometer_below_soft_max.\n ` This cost is not supported in `route_distance_limit`.\n\n### #cost_per_kilometer_below_soft_max=\n\n def cost_per_kilometer_below_soft_max=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- Cost per kilometer incurred, increasing up to `soft_max_meters`, with formula: `\n min(distance_meters, soft_max_meters) / 1000.0 *\n cost_per_kilometer_below_soft_max.\n` This cost is not supported in `route_distance_limit`. \n**Returns**\n\n- (::Float) --- Cost per kilometer incurred, increasing up to `soft_max_meters`, with formula: `\n min(distance_meters, soft_max_meters) / 1000.0 *\n cost_per_kilometer_below_soft_max.\n ` This cost is not supported in `route_distance_limit`.\n\n### #max_meters\n\n def max_meters() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- A hard limit constraining the distance to be at most max_meters. The limit must be nonnegative.\n\n### #max_meters=\n\n def max_meters=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- A hard limit constraining the distance to be at most max_meters. The limit must be nonnegative. \n**Returns**\n\n- (::Integer) --- A hard limit constraining the distance to be at most max_meters. The limit must be nonnegative.\n\n### #soft_max_meters\n\n def soft_max_meters() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- A soft limit not enforcing a maximum distance limit, but when violated results in a cost which adds up to other costs defined in the model, with the same unit.\n\n If defined soft_max_meters must be less than max_meters and must be\n nonnegative.\n\n### #soft_max_meters=\n\n def soft_max_meters=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- A soft limit not enforcing a maximum distance limit, but when violated results in a cost which adds up to other costs defined in the model, with the same unit.\n\n\n If defined soft_max_meters must be less than max_meters and must be\nnonnegative. \n**Returns**\n\n- (::Integer) --- A soft limit not enforcing a maximum distance limit, but when violated results in a cost which adds up to other costs defined in the model, with the same unit.\n\n If defined soft_max_meters must be less than max_meters and must be\n nonnegative."]]