Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
T_Earth_mover_distance< VerticesAccessor, DistanceFunctor > Class Template Reference

Earth mover distance algorithm using lp_solve software for solving linear program problems. More...

#include <Earth_mover_distance.hpp>

Public Types

typedef T_Earth_mover_distance< VerticesAccessor, DistanceFunctor > Self
 
typedef VerticesAccessor Vertices_accessor
 
typedef VerticesAccessor::Vertices_container Vertices_container
 
typedef DistanceFunctor Distance_functor
 
typedef VerticesAccessor::Vertex_rep Vertex_rep
 
typedef Distance_functor::FT FT_flow_cost
 
typedef VerticesAccessor::FT FT_mass
 
typedef VerticesAccessor::Index_type Index_type
 
typedef VerticesAccessor::Vertex_value Vertex_value
 
typedef VerticesAccessor::Vertices_iterator Vertices_iterator
 
typedef std::map< Vertex_rep, FT_massVertex_to_corrected_mass_map
 
typedef T_Earth_mover_distance_transportation_plan< Vertex_rep, FT_flow_costTransportation_plan
 
typedef Transportation_plan::EMD_CC_stat_triple EMD_CC_stat_triple
 

Public Member Functions

 T_Earth_mover_distance (const Distance_functor &dist=Distance_functor())
 
Transportation_plan operator() (Vertices_container &source, Vertices_container &demand, const std::string &filename_prefix="linear_program_solver") const
 

Static Public Member Functions

static void set_verbose_mode (unsigned verbose)
 
static void set_log (std::ostream &out)
 
static void set_solver (EMD_LP_solver_enum solver)
 

Static Public Attributes

static std::string s_lp_solver_string = "lp_solve"
 
static EMD_LP_solver_enum s_lp_solver = EMD_LP_solver_LP_SOLVE
 
static EMD_LP_format_enum s_lp_format = EMD_LP_format_MPS
 

Detailed Description

template<class VerticesAccessor, class DistanceFunctor = T_EMD_distance_default<VerticesAccessor>>
class SBL::CADS::T_Earth_mover_distance< VerticesAccessor, DistanceFunctor >

Earth mover distance algorithm using lp_solve software for solving linear program problems.

It is designed as a generic functor implementing the earth mover distance algorithm between two data structures. It is able to handle any type of data structure through the parameter VerticesAccessor that provides the base methods for traversing the set of points of the source and the demand. The distance between points of the source and the demand is also editable and is provided as a template parameter.

Template Parameters
VerticesAccessorBase data structure defining the types and accessors related to the input data structures that are required by this algorithm. See classes SBL::CADS::T_Earth_mover_distance_vertices_accessor_vector and SBL::CADS::T_Earth_mover_distance_vertices_accessor_graph for two examples of use, one where the input data structures are simple containers of weighted points, and the other one where the input data structures are graphs connecting those weighted points.
DistanceFunctorFunctor defining the number type used for representing the distance and returning a distance between two input points. By default, the algorithm is instantiated with the class T_EMD_distance_default which returns a null distance for any pair of points.

Member Typedef Documentation

◆ Distance_functor

typedef DistanceFunctor Distance_functor

◆ EMD_CC_stat_triple

◆ FT_flow_cost

typedef Distance_functor::FT FT_flow_cost

◆ FT_mass

typedef VerticesAccessor::FT FT_mass

◆ Index_type

typedef VerticesAccessor::Index_type Index_type

◆ Self

typedef T_Earth_mover_distance<VerticesAccessor, DistanceFunctor> Self

◆ Transportation_plan

◆ Vertex_rep

typedef VerticesAccessor::Vertex_rep Vertex_rep

◆ Vertex_to_corrected_mass_map

◆ Vertex_value

typedef VerticesAccessor::Vertex_value Vertex_value

◆ Vertices_accessor

typedef VerticesAccessor Vertices_accessor

◆ Vertices_container

typedef VerticesAccessor::Vertices_container Vertices_container

◆ Vertices_iterator

typedef VerticesAccessor::Vertices_iterator Vertices_iterator

Constructor & Destructor Documentation

◆ T_Earth_mover_distance()

Member Function Documentation

◆ operator()()

T_Earth_mover_distance< VerticesAccessor, DistanceFunctor >::Transportation_plan operator() ( Vertices_container source,
Vertices_container demand,
const std::string &  filename_prefix = "linear_program_solver" 
) const
inline

◆ set_log()

static void set_log ( std::ostream &  out)
inlinestatic

◆ set_solver()

static void set_solver ( EMD_LP_solver_enum  solver)
inlinestatic

◆ set_verbose_mode()

static void set_verbose_mode ( unsigned  verbose)
inlinestatic

Member Data Documentation

◆ s_lp_format

EMD_LP_format_enum s_lp_format = EMD_LP_format_MPS
static

◆ s_lp_solver

◆ s_lp_solver_string

std::string s_lp_solver_string = "lp_solve"
static