PaGMO  1.1.5
Public Member Functions | Protected Member Functions | Friends
pagmo::topology::hypercube Class Reference

Hypercube topology. More...

#include <hypercube.h>

Inheritance diagram for pagmo::topology::hypercube:
Inheritance graph
[legend]

Public Member Functions

 hypercube ()
 Default constructor.
 
base_ptr clone () const
 Clone method. More...
 
std::string get_name () const
 Get name of the topology. More...
 
- Public Member Functions inherited from pagmo::topology::base
 base ()
 Default constructor. More...
 
 base (const base &)
 Copy constructor. More...
 
baseoperator= (const base &)
 Assignment operator. More...
 
virtual ~base ()
 Trivial destructor. More...
 
vertices_size_type get_number_of_vertices () const
 Get number of vertices. More...
 
edges_size_type get_number_of_edges () const
 Get number of edges. More...
 
void push_back ()
 Push back vertex. More...
 
double get_average_shortest_path_length () const
 Calculate average path length. More...
 
double get_clustering_coefficient () const
 Calculate clustering coefficient.
 
std::vector< double > get_degree_distribution () const
 Constructs the Degree Distribution.
 
bool are_adjacent (const vertices_size_type &, const vertices_size_type &) const
 Return true if two vertices are adjacent. More...
 
bool are_inv_adjacent (const vertices_size_type &, const vertices_size_type &) const
 Return true if two vertices are inversely adjacent. More...
 
std::vector< vertices_size_typeget_v_adjacent_vertices (const vertices_size_type &) const
 Return vector of adjacent vertices. More...
 
std::vector< vertices_size_typeget_v_inv_adjacent_vertices (const vertices_size_type &) const
 Return vector of inversely adjacent vertices. More...
 
edges_size_type get_num_adjacent_vertices (const vertices_size_type &) const
 Return the number of adjacent vertices. More...
 
edges_size_type get_num_inv_adjacent_vertices (const vertices_size_type &) const
 Return the number of inversely adjacent vertices. More...
 
void set_weight (double)
 Sets the migration probability. More...
 
void set_weight (const vertices_size_type &, double)
 Sets the migration probability. More...
 
void set_weight (const vertices_size_type &, const vertices_size_type &, double)
 Sets the migration probability. More...
 
double get_weight (const vertices_size_type &, const vertices_size_type &) const
 Get the migration probability. More...
 
std::string human_readable_terse () const
 Return terse human readable representation. More...
 
std::string human_readable () const
 Return complete human readable representation. More...
 

Protected Member Functions

void connect (const vertices_size_type &)
 
- Protected Member Functions inherited from pagmo::topology::base
void add_vertex ()
 Add a vertex. More...
 
std::pair< a_iterator, a_iteratorget_adjacent_vertices (const vertices_size_type &) const
 Return iterator range to adjacent vertices. More...
 
std::pair< ia_iterator, ia_iteratorget_inv_adjacent_vertices (const vertices_size_type &) const
 Return iterator range to inversely adjacent vertices. More...
 
void add_edge (const vertices_size_type &, const vertices_size_type &)
 Add an edge. More...
 
void remove_edge (const vertices_size_type &, const vertices_size_type &)
 Remove an edge. More...
 
void remove_all_edges ()
 Remove all edges. More...
 
std::pair< v_iterator, v_iteratorget_vertices () const
 Return iterator range to vertices. More...
 
virtual std::string human_readable_extra () const
 Return extra information for human readable representation. More...
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Public Types inherited from pagmo::topology::base
typedef graph_type::vertices_size_type vertices_size_type
 Vertices size type.
 
typedef graph_type::edges_size_type edges_size_type
 Edges size type.
 
- Protected Types inherited from pagmo::topology::base
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, boost::no_property, edge_properties, boost::no_property, boost::listS > graph_type
 
typedef boost::graph_traits< graph_type >::vertex_iterator v_iterator
 Iterator over the vertices.
 
typedef boost::graph_traits< graph_type >::edge_iterator e_iterator
 Iterator over the edges.
 
typedef boost::graph_traits< graph_type >::adjacency_iterator a_iterator
 Iterator over adjacent vertices.
 
typedef graph_type::inv_adjacency_iterator ia_iterator
 Iterator over inversely adjacent vertices.
 
typedef boost::graph_traits< graph_type >::vertex_descriptor v_descriptor
 Vertex descriptor.
 
typedef boost::graph_traits< graph_type >::edge_descriptor e_descriptor
 Edge descriptor.
 

Detailed Description

Hypercube topology.

TODO

Author
Francesco Biscani (blues.nosp@m.carn.nosp@m.i@gma.nosp@m.il.c.nosp@m.om)
Marek RuciƄski (marek.nosp@m..ruc.nosp@m.inski.nosp@m.@gma.nosp@m.il.co.nosp@m.m)

Definition at line 43 of file hypercube.h.

Member Function Documentation

base_ptr pagmo::topology::hypercube::clone ( ) const
virtual

Clone method.

Provided that the derived topology implements properly the copy constructor, virtually all implementations of this method will look like this:

return base_ptr(new derived_topology(*this));
Returns
topology::base_ptr to a copy of this.

Implements pagmo::topology::base.

Definition at line 36 of file hypercube.cpp.

void pagmo::topology::hypercube::connect ( const vertices_size_type n)
protectedvirtual

It's a kind of magic... an incremental algorithm for constructing a hypercube by Marek.

The algorithm takes advantage of the observation that a hypercube has a recursive structure: a hypercube of dimension d (for d > 0) is composed of two hypercubes of dimension (d-1) connected in paralell. In consequence, every node in an d-dimensional hypercube belongs either to the "first" or to the "second" sub-hypercube of dimension (d-1). For every node in an d-dimensional hypercube one can identify a series of hypercubes of decreasing dimensions, d-1, d-2, ... 1 to which the node belongs. Each node belongs to exactly one hypercube for each of these dimensions. So when adding a new node to a partial hypercube of dimension d, for each dimension d, d-1, ... 1 one has to:

  • Determine to which (first or second) sub-hypercube of dimension (d-1) the node belongs
  • If the node belongs to the second hypercube, one has to add a connection to the coresponding node in the first hypercube

Implements pagmo::topology::base.

Definition at line 55 of file hypercube.cpp.

std::string pagmo::topology::hypercube::get_name ( ) const
virtual

Get name of the topology.

Default implementation will return the class' mangled C++ name.

Returns
name of the topology.

Reimplemented from pagmo::topology::base.

Definition at line 84 of file hypercube.cpp.


The documentation for this class was generated from the following files: