14 #ifndef OR_TOOLS_ALGORITHMS_DYNAMIC_PERMUTATION_H_
15 #define OR_TOOLS_ALGORITHMS_DYNAMIC_PERMUTATION_H_
26 class SparsePermutation;
39 int Size()
const {
return image_.size(); }
48 void AddMappings(
const std::vector<int>& src,
const std::vector<int>& dst);
68 const std::vector<int>&
AllMappingsSrc()
const {
return mapping_src_stack_; }
84 const std::set<int>&
LooseEnds()
const {
return loose_ends_; }
95 std::vector<int> image_;
98 std::vector<int> ancestor_;
103 std::vector<int> mapping_src_stack_;
104 std::vector<int> mapping_src_size_stack_;
107 std::set<int> loose_ends_;
111 mutable std::vector<bool> tmp_mask_;
117 DCHECK_LT(i,
Size());
124 DCHECK_LT(i,
Size());
126 const int j = ancestor_[i];
127 if (j == i)
return i;
DynamicPermutation(int n)
std::unique_ptr< SparsePermutation > CreateSparsePermutation() const
std::string DebugString() const
const std::set< int > & LooseEnds() const
const std::vector< int > & AllMappingsSrc() const
void UndoLastMappings(std::vector< int > *undone_mapping_src)
void AddMappings(const std::vector< int > &src, const std::vector< int > &dst)
Collection of objects used to extend the Constraint Solver library.