Limbo
|
#include <FMMultiWay.h>
Classes | |
class | VertexMove |
a class denotes movement of vertex More... | |
Public Types | |
typedef GainCalcType | gain_calc_type |
typedef gain_calc_type::value_type | gain_value_type |
Public Member Functions | |
FMMultiWay (gain_calc_type const &gc, int tn, signed char tp) | |
constructor More... | |
void | set_partition (int v, signed char p) |
set vertex v to partition p More... | |
template<typename Iterator > | |
void | set_partitions (Iterator first, Iterator last) |
set partitions More... | |
signed char | partition (int v) const |
get partition of a vertex More... | |
void | operator() () |
API to run the algorithm. | |
Protected Member Functions | |
void | run () |
kernel function to run the algorithm | |
void | find_candidate (int &cv, signed char &cp, gain_value_type &max_gain) const |
void | best_kth_move (int &k, gain_value_type &improve) const |
void | revert_to_kth_move (int k) |
void | reset () |
reset movements and fixed flags | |
Protected Attributes | |
gain_calc_type const & | m_gain_calc |
function object to calculate gains | |
int | m_num_vertice |
total number of vertices | |
int | m_num_partitions |
total number of partitions | |
std::vector< signed char > | m_vPartition |
an array storing partition of each vertex | |
std::vector< bool > | m_vFixed |
whehter fixed during current iteration | |
std::vector< VertexMove > | m_vVertexMove |
record vertex movement during each iteration | |
Assume vertices are represented by 0, 1, ... N array. Partitions are 0, 1, ... P array. Negative partition id denotes no partition assigned.
GainCalcType | a function object that calculate gains, refer to limbo::algorithms::coloring::SDPColoringCsdp::FMGainCalcType for example. |
Definition at line 31 of file FMMultiWay.h.
|
inline |
constructor
gc | function object of gain calculator |
tn | number of vertices |
tp | number of partitions |
Definition at line 57 of file FMMultiWay.h.
|
protected |
find best kth movement
k | index of movement |
improve | cumulative improvement at kth movement |
Definition at line 133 of file FMMultiWay.h.
|
protected |
traverse all vertices and partitions for the candidate with best gain
cv | find vertex to move |
cp | target partition |
max_gain | best gain of the movement |
Definition at line 109 of file FMMultiWay.h.
|
inline |
get partition of a vertex
v | vertex |
Definition at line 78 of file FMMultiWay.h.
|
protected |
|
inline |
set vertex v to partition p
v | vertex |
p | partition |
Definition at line 69 of file FMMultiWay.h.
|
inline |
set partitions
Iterator | iterator to the array of partitions |
first,last | begin and end iterator to the array of partitions |
Definition at line 74 of file FMMultiWay.h.