Reference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint.
One may further constrain the frequency and duration of the breaks
specified above, by enforcing a minimum break frequency, such as
"There must be a break of at least 1 hour every 12 hours". Assuming that
this can be interpreted as "Within any sliding time window of 12h, there
must be at least one break of at least one hour", that example would
translate to the following FrequencyConstraint:
{
min_break_duration { seconds: 3600 } # 1 hour.
max_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11).
}
The timing and duration of the breaks in the solution will respect all
such constraints, in addition to the time windows and minimum durations
already specified in the BreakRequest.
A FrequencyConstraint may in practice apply to non-consecutive breaks.
For example, the following schedule honors the "1h every 12h" example:
04:00 vehicle start
.. performing travel and visits ..
09:00 1 hour break
10:00 end of the break
.. performing travel and visits ..
12:00 20-min lunch break
12:20 end of the break
.. performing travel and visits ..
21:00 1 hour break
22:00 end of the break
.. performing travel and visits ..
23:59 vehicle end
(::Google::Protobuf::Duration) — Required. Maximum allowed span of any interval of time in the route
that does not include at least partially a break of duration >=
min_break_duration. Must be positive.
value (::Google::Protobuf::Duration) — Required. Maximum allowed span of any interval of time in the route
that does not include at least partially a break of duration >=
min_break_duration. Must be positive.
Returns
(::Google::Protobuf::Duration) — Required. Maximum allowed span of any interval of time in the route
that does not include at least partially a break of duration >=
min_break_duration. Must be positive.
[[["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::ShipmentModel::BreakRule::FrequencyConstraint (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-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.11.1](/ruby/docs/reference/google-cloud-optimization-v1/0.11.1/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.10.0](/ruby/docs/reference/google-cloud-optimization-v1/0.10.0/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.9.2](/ruby/docs/reference/google-cloud-optimization-v1/0.9.2/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.8.2](/ruby/docs/reference/google-cloud-optimization-v1/0.8.2/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.7.0](/ruby/docs/reference/google-cloud-optimization-v1/0.7.0/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.6.0](/ruby/docs/reference/google-cloud-optimization-v1/0.6.0/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.5.0](/ruby/docs/reference/google-cloud-optimization-v1/0.5.0/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.4.1](/ruby/docs/reference/google-cloud-optimization-v1/0.4.1/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.3.0](/ruby/docs/reference/google-cloud-optimization-v1/0.3.0/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.2.1](/ruby/docs/reference/google-cloud-optimization-v1/0.2.1/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint)\n- [0.1.1](/ruby/docs/reference/google-cloud-optimization-v1/0.1.1/Google-Cloud-Optimization-V1-ShipmentModel-BreakRule-FrequencyConstraint) \nReference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint.\n\nOne may further constrain the frequency and duration of the breaks\nspecified above, by enforcing a minimum break frequency, such as\n\"There must be a break of at least 1 hour every 12 hours\". Assuming that\nthis can be interpreted as \"Within any sliding time window of 12h, there\nmust be at least one break of at least one hour\", that example would\ntranslate to the following `FrequencyConstraint`:\n`\n{\nmin_break_duration { seconds: 3600 } # 1 hour.\nmax_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11).\n}\n`\n\n\nThe timing and duration of the breaks in the solution will respect all\nsuch constraints, in addition to the time windows and minimum durations\nalready specified in the `BreakRequest`.\n\n\u003cbr /\u003e\n\nA `FrequencyConstraint` may in practice apply to non-consecutive breaks.\nFor example, the following schedule honors the \"1h every 12h\" example:\n`\n04:00 vehicle start\n.. performing travel and visits ..\n09:00 1 hour break\n10:00 end of the break\n.. performing travel and visits ..\n12:00 20-min lunch break\n12:20 end of the break\n.. performing travel and visits ..\n21:00 1 hour break\n22:00 end of the break\n.. performing travel and visits ..\n23:59 vehicle end\n` \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### #max_inter_break_duration\n\n def max_inter_break_duration() -\u003e ::Google::Protobuf::Duration\n\n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- Required. Maximum allowed span of any interval of time in the route that does not include at least partially a break of `duration \u003e=\n min_break_duration`. Must be positive.\n\n### #max_inter_break_duration=\n\n def max_inter_break_duration=(value) -\u003e ::Google::Protobuf::Duration\n\n**Parameter**\n\n- **value** ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- Required. Maximum allowed span of any interval of time in the route that does not include at least partially a break of `duration \u003e=\nmin_break_duration`. Must be positive. \n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- Required. Maximum allowed span of any interval of time in the route that does not include at least partially a break of `duration \u003e=\n min_break_duration`. Must be positive.\n\n### #min_break_duration\n\n def min_break_duration() -\u003e ::Google::Protobuf::Duration\n\n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- Required. Minimum break duration for this constraint. Nonnegative. See description of `FrequencyConstraint`.\n\n### #min_break_duration=\n\n def min_break_duration=(value) -\u003e ::Google::Protobuf::Duration\n\n**Parameter**\n\n- **value** ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- Required. Minimum break duration for this constraint. Nonnegative. See description of `FrequencyConstraint`. \n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- Required. Minimum break duration for this constraint. Nonnegative. See description of `FrequencyConstraint`."]]