Deprecated: Use top level
BreakRule
instead. Rules to generate time breaks for a vehicle (e.g. lunch
breaks). A break is a contiguous period of time during which the
vehicle remains idle at its current position and cannot perform any
visit. A break may occur:
during the travel between two visits (which includes the time
right before or right after a visit, but not in the middle of a
visit), in which case it extends the corresponding transit time
between the visits
before the vehicle start (the vehicle may not start in the middle
of a break), in which case it does not affect the vehicle start
time.
after the vehicle end (ditto, with the vehicle end time).
The sequence of breaks (i.e. their number and order) that apply to
each vehicle must be known beforehand. The repeated
BreakRequest\ s define that sequence, in the order in which they
must occur. Their time windows (earliest_start_time /
latest_start_time) may overlap, but they must be compatible with
the order (this is checked).
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:
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
[[["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-08-07 UTC."],[],[],null,["# Class BreakRule (1.11.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.11.2 (latest)](/python/docs/reference/optimization/latest/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.11.0](/python/docs/reference/optimization/1.11.0/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.10.0](/python/docs/reference/optimization/1.10.0/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.9.1](/python/docs/reference/optimization/1.9.1/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.8.5](/python/docs/reference/optimization/1.8.5/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.7.0](/python/docs/reference/optimization/1.7.0/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.6.0](/python/docs/reference/optimization/1.6.0/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.5.0](/python/docs/reference/optimization/1.5.0/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.4.3](/python/docs/reference/optimization/1.4.3/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.3.2](/python/docs/reference/optimization/1.3.2/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.2.0](/python/docs/reference/optimization/1.2.0/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.1.3](/python/docs/reference/optimization/1.1.3/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [1.0.1](/python/docs/reference/optimization/1.0.1/google.cloud.optimization_v1.types.ShipmentModel.BreakRule)\n- [0.1.1](/python/docs/reference/optimization/0.1.1/google.cloud.optimization_v1.types.ShipmentModel.BreakRule) \n\n BreakRule(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nDeprecated: Use top level\nBreakRule\ninstead. Rules to generate time breaks for a vehicle (e.g. lunch\nbreaks). A break is a contiguous period of time during which the\nvehicle remains idle at its current position and cannot perform any\nvisit. A break may occur:\n\n- during the travel between two visits (which includes the time right before or right after a visit, but not in the middle of a visit), in which case it extends the corresponding transit time between the visits\n- before the vehicle start (the vehicle may not start in the middle of a break), in which case it does not affect the vehicle start time.\n- after the vehicle end (ditto, with the vehicle end time).\n\nClasses\n-------\n\n### BreakRequest\n\n BreakRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nThe sequence of breaks (i.e. their number and order) that apply to\neach vehicle must be known beforehand. The repeated\n`BreakRequest`\\\\ s define that sequence, in the order in which they\nmust occur. Their time windows (`earliest_start_time` /\n`latest_start_time`) may overlap, but they must be compatible with\nthe order (this is checked).\n\n### FrequencyConstraint\n\n FrequencyConstraint(mapping=None, *, ignore_unknown_fields=False, **kwargs)\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\nthat this can be interpreted as \"Within any sliding time window of\n12h, there must be at least one break of at least one hour\", that\nexample would translate to the following `FrequencyConstraint`:\n\n::\n\n{\nmin_break_duration { seconds: 3600 } # 1 hour.\nmax_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11).\n}\n\nThe timing and duration of the breaks in the solution will respect\nall such constraints, in addition to the time windows and minimum\ndurations already specified in the `BreakRequest`.\n\nA `FrequencyConstraint` may in practice apply to non-consecutive\nbreaks. For example, the following schedule honors the \"1h every\n12h\" example:\n\n:: \n\n 04:00 vehicle start\n .. performing travel and visits ..\n 09:00 1 hour break\n 10:00 end of the break\n .. performing travel and visits ..\n 12:00 20-min lunch break\n 12:20 end of the break\n .. performing travel and visits ..\n 21:00 1 hour break\n 22:00 end of the break\n .. performing travel and visits ..\n 23:59 vehicle end"]]