Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::InsertionSequenceContainer Class Reference

#include <routing_search.h>

Classes

struct  Insertion
 
class  InsertionSequence
 
class  InsertionSequenceIterator
 

Public Member Functions

InsertionSequenceIterator begin ()
 InsertionSequenceContainer is a range over insertion sequences.
 
InsertionSequenceIterator end ()
 
size_t Size () const
 Returns the number of sequences of this container.
 
void AddInsertionSequence (int vehicle, std::initializer_list< Insertion > insertion_sequence)
 
void AddInsertionSequence (int vehicle, absl::Span< const Insertion > insertion_sequence)
 Adds an insertion sequence to the container.
 
void RemoveIf (const std::function< bool(const InsertionSequence &)> &p)
 
void Sort ()
 
void Clear ()
 Removes all sequences.
 

Detailed Description

Holds sequences of insertions. A sequence of insertions must be in the same path, each insertion must take place either after the previously inserted node or further down the path, never before.

Definition at line 870 of file routing_search.h.

Member Function Documentation

◆ AddInsertionSequence() [1/2]

void operations_research::InsertionSequenceContainer::AddInsertionSequence ( int vehicle,
absl::Span< const Insertion > insertion_sequence )
inline

Adds an insertion sequence to the container.

Definition at line 969 of file routing_search.h.

◆ AddInsertionSequence() [2/2]

void operations_research::InsertionSequenceContainer::AddInsertionSequence ( int vehicle,
std::initializer_list< Insertion > insertion_sequence )
inline

Adds an insertion sequence to the container. Passing an initializer_list allows deeper optimizations by the compiler for cases where the sequence has a compile-time fixed size.

Definition at line 957 of file routing_search.h.

◆ begin()

InsertionSequenceIterator operations_research::InsertionSequenceContainer::begin ( )
inline

InsertionSequenceContainer is a range over insertion sequences.

Definition at line 944 of file routing_search.h.

◆ Clear()

void operations_research::InsertionSequenceContainer::Clear ( )
inline

Removes all sequences.

Definition at line 1000 of file routing_search.h.

◆ end()

InsertionSequenceIterator operations_research::InsertionSequenceContainer::end ( )
inline

Definition at line 947 of file routing_search.h.

◆ RemoveIf()

void operations_research::InsertionSequenceContainer::RemoveIf ( const std::function< bool(const InsertionSequence &)> & p)
inline

Similar to std::remove_if(), removes all sequences that match a predicate. This keeps original order, and removes selected sequences.

Todo
(user): Benchmark this against std::swap().

Definition at line 982 of file routing_search.h.

◆ Size()

size_t operations_research::InsertionSequenceContainer::Size ( ) const
inline

Returns the number of sequences of this container.

Definition at line 952 of file routing_search.h.

◆ Sort()

void operations_research::InsertionSequenceContainer::Sort ( )
inline

Sorts sequences according to (cost, vehicle).

Todo
(user): benchmark this against other ways to get insertion sequence in order, for instance sorting by index, separating {cost, index}, making a heap.

Definition at line 997 of file routing_search.h.


The documentation for this class was generated from the following file: