Aikido
aikido::distance::CartesianProductWeighted Class Reference

Implements a distance metric on a CartesianProduct. More...

#include <aikido/distance/CartesianProductWeighted.hpp>

Inheritance diagram for aikido::distance::CartesianProductWeighted:
aikido::distance::DistanceMetric

Public Member Functions

 CartesianProductWeighted (std::shared_ptr< const statespace::CartesianProduct > _space, std::vector< DistanceMetricPtr > _metrics)
 Constructor. More...
 
 CartesianProductWeighted (std::shared_ptr< statespace::CartesianProduct > _space, std::vector< std::pair< DistanceMetricPtr, double >> _metrics)
 Constructor. More...
 
statespace::ConstStateSpacePtr getStateSpace () const override
 Get the StateSpace associated with this metric. More...
 
double distance (const statespace::StateSpace::State *_state1, const statespace::StateSpace::State *_state2) const override
 Computes distance between two states as the weighted sum of distances between their matching subcomponents. More...
 
- Public Member Functions inherited from aikido::distance::DistanceMetric
virtual ~DistanceMetric ()=default
 Destructor. More...
 

Private Attributes

std::shared_ptr< const statespace::CartesianProductmStateSpace
 
std::vector< std::pair< DistanceMetricPtr, double > > mMetrics
 

Detailed Description

Implements a distance metric on a CartesianProduct.

This metric computes the weighted sum of distances on the individual components of the statespace.

Constructor & Destructor Documentation

◆ CartesianProductWeighted() [1/2]

aikido::distance::CartesianProductWeighted::CartesianProductWeighted ( std::shared_ptr< const statespace::CartesianProduct _space,
std::vector< DistanceMetricPtr _metrics 
)

Constructor.

Default the weights applied to each subspace to 1.

Parameters
_spaceThe state space
_metricsA vector containing one element for every component of the CartesianProduct

◆ CartesianProductWeighted() [2/2]

aikido::distance::CartesianProductWeighted::CartesianProductWeighted ( std::shared_ptr< statespace::CartesianProduct _space,
std::vector< std::pair< DistanceMetricPtr, double >>  _metrics 
)

Constructor.

CartesianProduct. The first element of every pair in the vector is the metric and the second is the weight to be applied to the metric. The weights must all be positive.

Parameters
_spaceThe state space
_metricsA vector containing one element for every component of the

Member Function Documentation

◆ distance()

double aikido::distance::CartesianProductWeighted::distance ( const statespace::StateSpace::State _state1,
const statespace::StateSpace::State _state2 
) const
overridevirtual

Computes distance between two states as the weighted sum of distances between their matching subcomponents.

Parameters
_state1The first state (type CartesianProduct::State)
_state2The second state (type CartesianProduct::State)

Implements aikido::distance::DistanceMetric.

◆ getStateSpace()

statespace::ConstStateSpacePtr aikido::distance::CartesianProductWeighted::getStateSpace ( ) const
overridevirtual

Get the StateSpace associated with this metric.

Implements aikido::distance::DistanceMetric.

Member Data Documentation

◆ mMetrics

std::vector<std::pair<DistanceMetricPtr, double> > aikido::distance::CartesianProductWeighted::mMetrics
private

◆ mStateSpace

std::shared_ptr<const statespace::CartesianProduct> aikido::distance::CartesianProductWeighted::mStateSpace
private