annotate DEPENDENCIES/generic/include/boost/geometry/index/detail/rtree/kmeans/split.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Geometry Index
Chris@16 2 //
Chris@16 3 // R-tree kmeans split algorithm implementation
Chris@16 4 //
Chris@16 5 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
Chris@16 6 //
Chris@16 7 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 9 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10
Chris@16 11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
Chris@16 12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
Chris@16 13
Chris@16 14 #include <boost/geometry/index/rtree/node/node.hpp>
Chris@16 15 #include <boost/geometry/index/rtree/visitors/insert.hpp>
Chris@16 16
Chris@16 17 namespace boost { namespace geometry { namespace index {
Chris@16 18
Chris@16 19 namespace detail { namespace rtree {
Chris@16 20
Chris@16 21 namespace kmeans {
Chris@16 22
Chris@16 23 // some details
Chris@16 24
Chris@16 25 } // namespace kmeans
Chris@16 26
Chris@16 27 // split_kmeans_tag
Chris@16 28 // OR
Chris@16 29 // split_clusters_tag and redistribute_kmeans_tag - then redistribute will probably slightly different interface
Chris@16 30 // or some other than "redistribute"
Chris@16 31
Chris@16 32 // 1. for this algorithm one probably MUST USE NON-STATIC NODES with node_default_tag
Chris@16 33 // or the algorithm must be changed somehow - to not store additional nodes in the current node
Chris@16 34 // but return excessive element/elements container instead (possibly pushable_array<1> or std::vector)
Chris@16 35 // this would also cause building of smaller trees since +1 element in nodes wouldn't be needed in different redistributing algorithms
Chris@16 36 // 2. it is probably possible to add e.g. 2 levels of tree in one insert
Chris@16 37
Chris@16 38 // Edge case is that every node split generates M + 1 children, in parent containing M nodes
Chris@16 39 // result is 2M + 1 nodes in parent on this level
Chris@16 40 // On next level the same, next the same and so on.
Chris@16 41 // We have Depth*M+1 nodes in the root
Chris@16 42 // The tree may then gain some > 1 levels in one insert
Chris@16 43 // split::apply() manages this but special attention is required
Chris@16 44
Chris@16 45 // which algorithm should be used to choose current node in traversing while inserting?
Chris@16 46 // some of the currently used ones or some using mean values as well?
Chris@16 47
Chris@16 48 // TODO
Chris@16 49 // 1. Zmienic troche algorytm zeby przekazywal nadmiarowe elementy do split
Chris@16 50 // i pobieral ze split nadmiarowe elementy rodzica
Chris@16 51 // W zaleznosci od algorytmu w rozny sposob - l/q/r* powinny zwracac np pushable_array<1>
Chris@16 52 // wtedy tez is_overerflow (z R* insert?) bedzie nieportrzebne
Chris@16 53 // Dla kmeans zapewne std::vector, jednak w wezlach nadal moglaby byc pushable_array
Chris@16 54 // 2. Fajnie byloby tez uproscic te wszystkie parametry root,parent,index itd. Mozliwe ze okazalyby sie zbedne
Chris@16 55 // 3. Sprawdzyc czasy wykonywania i zajetosc pamieci
Chris@16 56 // 4. Pamietac o parametryzacji kontenera z nadmiarowymi elementami
Chris@16 57 // PS. Z R* reinsertami moze byc masakra
Chris@16 58
Chris@16 59 template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
Chris@16 60 class split<Value, Options, Translator, Box, Allocators, split_kmeans_tag>
Chris@16 61 {
Chris@16 62 protected:
Chris@16 63 typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
Chris@16 64 typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
Chris@16 65 typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
Chris@16 66
Chris@16 67 typedef typename Options::parameters_type parameters_type;
Chris@16 68
Chris@16 69 public:
Chris@16 70 template <typename Node>
Chris@16 71 static inline void apply(node* & root_node,
Chris@16 72 size_t & leafs_level,
Chris@16 73 Node & n,
Chris@16 74 internal_node *parent_node,
Chris@16 75 size_t current_child_index,
Chris@16 76 Translator const& tr,
Chris@16 77 Allocators & allocators)
Chris@16 78 {
Chris@16 79
Chris@16 80 }
Chris@16 81 };
Chris@16 82
Chris@16 83 }} // namespace detail::rtree
Chris@16 84
Chris@16 85 }}} // namespace boost::geometry::index
Chris@16 86
Chris@16 87 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP