Class: Google::Cloud::Optimization::V1::ShipmentModel

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/optimization/v1/fleet_routing.rb

Overview

A shipment model contains a set of shipments which must be performed by a set of vehicles, while minimizing the overall cost, which is the sum of:

  • the cost of routing the vehicles (sum of cost per total time, cost per travel time, and fixed cost over all vehicles).
  • the unperformed shipment penalties.
  • the cost of the global duration of the shipments

Defined Under Namespace

Classes: BreakRule, DurationDistanceMatrix, PrecedenceRule

Instance Attribute Summary collapse

Instance Attribute Details

#break_rules::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule>

Deprecated.

This field is deprecated and may be removed in the next major version update.

Returns Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#duration_distance_matrices::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix>

Returns Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.
model {
  vehicles { start_tags: "locA"  end_tags: "locA" }
  shipments { pickups { tags: "locB" } }
  duration_distance_matrix_src_tags: "locA"
  duration_distance_matrix_src_tags: "locB"
  duration_distance_matrix_dst_tags: "locA"
  duration_distance_matrix_dst_tags: "locB"
  duration_distance_matrices {
    rows {  # from: locA
      durations { seconds: 0 }   meters: 0    # to: locA
      durations { seconds: 100 } meters: 1000 # to: locB
    }
    rows {  # from: locB
      durations { seconds: 102 } meters: 990 # to: locA
      durations { seconds: 0 }   meters: 0   # to: locB
    }
  }
}
  • There are three locations: locA, locB and locC.
  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.
model {
  vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" }
  vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" }
  vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" }
  shipments { pickups { tags: "locC" } }
  duration_distance_matrix_src_tags: "locA"
  duration_distance_matrix_src_tags: "locB"
  duration_distance_matrix_src_tags: "locC"
  duration_distance_matrix_dst_tags: "locB"
  duration_distance_matrix_dst_tags: "locC"
  duration_distance_matrices {
    vehicle_start_tag: "fast"
    rows {  # from: locA
      durations { seconds: 1000 } meters: 2000 # to: locB
      durations { seconds: 600 }  meters: 1000 # to: locC
    }
    rows {  # from: locB
      durations { seconds: 0 }   meters: 0    # to: locB
      durations { seconds: 700 } meters: 1200 # to: locC
    }
    rows {  # from: locC
      durations { seconds: 702 } meters: 1190 # to: locB
      durations { seconds: 0 }   meters: 0    # to: locC
    }
  }
  duration_distance_matrices {
    vehicle_start_tag: "slow"
    rows {  # from: locA
      durations { seconds: 1800 } meters: 2001 # to: locB
      durations { seconds: 900 }  meters: 1002 # to: locC
    }
    rows {  # from: locB
      durations { seconds: 0 }    meters: 0    # to: locB
      durations { seconds: 1000 } meters: 1202 # to: locC
    }
    rows {  # from: locC
      durations { seconds: 1001 } meters: 1195 # to: locB
      durations { seconds: 0 }    meters: 0    # to: locC
    }
  }
}
```.

Returns:

  • (::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix>)

    Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

    Usage examples:

    • There are two locations: locA and locB.
    • 1 vehicle starting its route at locA and ending it at locA.
    • 1 pickup visit request at locB.
    model {
      vehicles { start_tags: "locA"  end_tags: "locA" }
      shipments { pickups { tags: "locB" } }
      duration_distance_matrix_src_tags: "locA"
      duration_distance_matrix_src_tags: "locB"
      duration_distance_matrix_dst_tags: "locA"
      duration_distance_matrix_dst_tags: "locB"
      duration_distance_matrices {
        rows {  # from: locA
          durations { seconds: 0 }   meters: 0    # to: locA
          durations { seconds: 100 } meters: 1000 # to: locB
        }
        rows {  # from: locB
          durations { seconds: 102 } meters: 990 # to: locA
          durations { seconds: 0 }   meters: 0   # to: locB
        }
      }
    }
    
    • There are three locations: locA, locB and locC.
    • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
    • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
    • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
    • 1 pickup visit request at locC.
    model {
      vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" }
      vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" }
      vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" }
      shipments { pickups { tags: "locC" } }
      duration_distance_matrix_src_tags: "locA"
      duration_distance_matrix_src_tags: "locB"
      duration_distance_matrix_src_tags: "locC"
      duration_distance_matrix_dst_tags: "locB"
      duration_distance_matrix_dst_tags: "locC"
      duration_distance_matrices {
        vehicle_start_tag: "fast"
        rows {  # from: locA
          durations { seconds: 1000 } meters: 2000 # to: locB
          durations { seconds: 600 }  meters: 1000 # to: locC
        }
        rows {  # from: locB
          durations { seconds: 0 }   meters: 0    # to: locB
          durations { seconds: 700 } meters: 1200 # to: locC
        }
        rows {  # from: locC
          durations { seconds: 702 } meters: 1190 # to: locB
          durations { seconds: 0 }   meters: 0    # to: locC
        }
      }
      duration_distance_matrices {
        vehicle_start_tag: "slow"
        rows {  # from: locA
          durations { seconds: 1800 } meters: 2001 # to: locB
          durations { seconds: 900 }  meters: 1002 # to: locC
        }
        rows {  # from: locB
          durations { seconds: 0 }    meters: 0    # to: locB
          durations { seconds: 1000 } meters: 1202 # to: locC
        }
        rows {  # from: locC
          durations { seconds: 1001 } meters: 1195 # to: locB
          durations { seconds: 0 }    meters: 0    # to: locC
        }
      }
    }
    


615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#duration_distance_matrix_dst_tags::Array<::String>

Returns Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

Returns:

  • (::Array<::String>)

    Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

    Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#duration_distance_matrix_src_tags::Array<::String>

Returns Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

Returns:

  • (::Array<::String>)

    Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

    Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#global_duration_cost_per_hour::Float

Returns The "global duration" of the overall plan is the difference between the earliest effective start time and the latest effective end time of all vehicles. Users can assign a cost per hour to that quantity to try and optimize for earliest job completion, for example. This cost must be in the same unit as Shipment.penalty_cost.

Returns:

  • (::Float)

    The "global duration" of the overall plan is the difference between the earliest effective start time and the latest effective end time of all vehicles. Users can assign a cost per hour to that quantity to try and optimize for earliest job completion, for example. This cost must be in the same unit as Shipment.penalty_cost.



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#global_end_time::Google::Protobuf::Timestamp

Returns If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#global_start_time::Google::Protobuf::Timestamp

Returns Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

Returns:

  • (::Google::Protobuf::Timestamp)

    Global start and end time of the model: no times outside of this range can be considered valid.

    The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

    When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#max_active_vehicles::Integer

Returns Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive.

Returns:

  • (::Integer)

    Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive.



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#precedence_rules::Array<::Google::Cloud::Optimization::V1::ShipmentModel::PrecedenceRule>

Returns Set of precedence rules which must be enforced in the model.

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#shipment_type_incompatibilities::Array<::Google::Cloud::Optimization::V1::ShipmentTypeIncompatibility>

Returns Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#shipment_type_requirements::Array<::Google::Cloud::Optimization::V1::ShipmentTypeRequirement>

Returns Sets of shipment_type requirements (see ShipmentTypeRequirement).

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#shipments::Array<::Google::Cloud::Optimization::V1::Shipment>

Returns Set of shipments which must be performed in the model.

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#transition_attributes::Array<::Google::Cloud::Optimization::V1::TransitionAttributes>

Returns Transition attributes added to the model.

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#vehicles::Array<::Google::Cloud::Optimization::V1::Vehicle>

Returns Set of vehicles which can be used to perform visits.

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'proto_docs/google/cloud/optimization/v1/fleet_routing.rb', line 615

class ShipmentModel
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Specifies a duration and distance matrix from visit and vehicle start
  # locations to visit and vehicle end locations.
  # @!attribute [rw] rows
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
  #     Specifies the rows of the duration and distance matrix. It must have as
  #     many elements as
  #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
  # @!attribute [rw] vehicle_start_tag
  #   @return [::String]
  #     Tag defining to which vehicles this duration and distance matrix applies.
  #     If empty, this applies to all vehicles, and there can only be a single
  #     matrix.
  #
  #     Each vehicle start must match exactly one matrix, i.e. exactly one of
  #     their `start_tags` field must match the `vehicle_start_tag` of a matrix
  #     (and of that matrix only).
  #
  #     All matrices must have a different `vehicle_start_tag`.
  class DurationDistanceMatrix
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies a row of the duration and distance matrix.
    # @!attribute [rw] durations
    #   @return [::Array<::Google::Protobuf::Duration>]
    #     Duration values for a given row. It must have as many elements as
    #     {::Google::Cloud::Optimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
    # @!attribute [rw] meters
    #   @return [::Array<::Float>]
    #     Distance values for a given row. If no costs or constraints refer to
    #     distances in the model, this can be left empty; otherwise it must have
    #     as many elements as `durations`.
    class Row
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A precedence rule between two events (each event is the pickup or the
  # delivery of a shipment): the "second" event has to start at least
  # `offset_duration` after "first" has started.
  #
  # Several precedences can refer to the same (or related) events, e.g.,
  # "pickup of B happens after delivery of A" and "pickup of C happens after
  # pickup of B".
  #
  # Furthermore, precedences only apply when both shipments are performed and
  # are otherwise ignored.
  # @!attribute [rw] first_index
  #   @return [::Integer]
  #     Shipment index of the "first" event. This field must be specified.
  # @!attribute [rw] first_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "first" event is a delivery.
  # @!attribute [rw] second_index
  #   @return [::Integer]
  #     Shipment index of the "second" event. This field must be specified.
  # @!attribute [rw] second_is_delivery
  #   @return [::Boolean]
  #     Indicates if the "second" event is a delivery.
  # @!attribute [rw] offset_duration
  #   @return [::Google::Protobuf::Duration]
  #     The offset between the "first" and "second" event. It can be negative.
  class PrecedenceRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Deprecated: Use top level
  # {::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule 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).
  # @deprecated This message is deprecated and may be removed in the next major version update.
  # @!attribute [rw] break_requests
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::BreakRequest>]
  #     Sequence of breaks. See the `BreakRequest` message.
  # @!attribute [rw] frequency_constraints
  #   @return [::Array<::Google::Cloud::Optimization::V1::ShipmentModel::BreakRule::FrequencyConstraint>]
  #     Several `FrequencyConstraint` may apply. They must all be satisfied by
  #     the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
  class BreakRule
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # 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).
    # @!attribute [rw] earliest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Lower bound (inclusive) on the start of the break.
    # @!attribute [rw] latest_start_time
    #   @return [::Google::Protobuf::Timestamp]
    #     Required. Upper bound (inclusive) on the start of the break.
    # @!attribute [rw] min_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum duration of the break. Must be positive.
    class BreakRequest
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # 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
    # ```
    # @!attribute [rw] min_break_duration
    #   @return [::Google::Protobuf::Duration]
    #     Required. Minimum break duration for this constraint. Nonnegative.
    #     See description of `FrequencyConstraint`.
    # @!attribute [rw] max_inter_break_duration
    #   @return [::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.
    class FrequencyConstraint
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end