GMMReducer.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package MemoryX::GaussianMixtureHelpers
17 * @author Alexey Kozlov <kozlov@kit.edu>
18 * @copyright 2013 Alexey Kozlov
19 * @license http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 // boost
26 #include <memory>
27 #include <string>
28 
30 
31 #include "GMMDistance.h"
33 
34 namespace memoryx
35 {
36 
38  {
42  };
43 
44  using GMMCompPairDistance = std::pair<int, float>;
45  using GMMCompPairDistanceVector = std::vector<GMMCompPairDistance>;
46 
47  /**
48  * @class GMMReducer
49  * @ingroup CommonPlacesLearner
50  */
52  {
53  public:
54  /**
55  * Creates a new GMMReducer
56  */
58  {
59  }
60 
61  /**
62  *
63  *
64  */
65  virtual GaussianMixtureDistributionBasePtr
66  reduceByComponentCount(const GaussianMixtureDistributionBasePtr& fullGMM, int countComp);
67 
68  virtual GaussianMixtureDistributionBasePtr
69  reduceByMaxAABB(const GaussianMixtureDistributionBasePtr& fullGMM, float maxSideLength);
70 
71  virtual GaussianMixtureDistributionBasePtr
72  reduceByMaxOrientedBBox(const GaussianMixtureDistributionBasePtr& fullGMM,
73  float maxSideLength);
74 
75  virtual GaussianMixtureDistributionBasePtr
76  reduceByMaxEqualSphere(const GaussianMixtureDistributionBasePtr& fullGMM,
77  float maxSphereRadius);
78 
79  virtual GaussianMixtureDistributionBasePtr
80  reduceByMaxDeviation(const GaussianMixtureDistributionBasePtr& fullGMM,
81  float maxDeviation,
82  DeviationMeasure devMeasure);
83 
84  protected:
86 
87  virtual float getMergingCost(const GaussianMixtureDistributionBasePtr& gmm, int c1, int c2);
88 
89  virtual void fillMergingCostVector(const GaussianMixtureDistributionBasePtr& gmm,
90  GMMCompPairDistanceVector& costVec);
91 
92  void mergeGMMComponents(const GaussianMixtureComponent& comp1,
93  const GaussianMixtureComponent& comp2,
94  GaussianMixtureComponent& mergedComp);
95 
96  void replaceComponentsWithMerged(GaussianMixtureDistributionPtr& gmm,
97  int index1,
98  int index2,
99  const GaussianMixtureComponent& mergedComp);
100 
101  void mergeGMMComponents(GaussianMixtureDistributionPtr& gmm, int index1, int index2);
102  };
103 
104  using GMMReducerPtr = std::shared_ptr<GMMReducer>;
105 
106 } // namespace memoryx
memoryx::eOrientedBBox
@ eOrientedBBox
Definition: GMMReducer.h:40
memoryx::GMMCompPairDistanceVector
std::vector< GMMCompPairDistance > GMMCompPairDistanceVector
Definition: GMMReducer.h:45
memoryx::GMMCompPairDistance
std::pair< int, float > GMMCompPairDistance
Definition: GMMReducer.h:44
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::DeviationMeasure
DeviationMeasure
Definition: GMMReducer.h:37
GMMDistance.h
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::eAABB
@ eAABB
Definition: GMMReducer.h:39
memoryx::GMMReducer
Definition: GMMReducer.h:51
memoryx::eEqualSphere
@ eEqualSphere
Definition: GMMReducer.h:41
ProbabilityMeasures.h
memoryx::GMMDistancePtr
std::shared_ptr< GMMDistance > GMMDistancePtr
Definition: GMMDistance.h:62
ImportExport.h
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition: ImportExport.h:38
memoryx::GMMReducer::gmmDistance
GMMDistancePtr gmmDistance
Definition: GMMReducer.h:85
memoryx::GMMReducerPtr
std::shared_ptr< GMMReducer > GMMReducerPtr
Definition: GMMReducer.h:104
memoryx::GMMReducer::GMMReducer
GMMReducer()
Creates a new GMMReducer.
Definition: GMMReducer.h:57