Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

mmn_dp_solver Class Reference

#include <mmn_dp_solver.h>

List of all members.


Detailed Description

Find choice of values at each node which minimises Markov problem.

Minimises F() = sum node_costs + sum pair_costs

Assumes graph defining relationships can be fully decomposed by repeatedly removing any nodes with two or fewer neighbours. Global optimum is found using a series of sequential exhaustive optimisations.

Definition at line 21 of file mmn_dp_solver.h.

Public Member Functions

 mmn_dp_solver ()
 Default constructor.
unsigned root () const
 Index of root node.
void set_dependancies (const vcl_vector< mmn_dependancy > &deps, unsigned n_nodes, unsigned max_n_arcs)
 Define dependencies.
double solve (const vcl_vector< vnl_vector< double > > &node_cost, const vcl_vector< vnl_matrix< double > > &pair_cost, vcl_vector< unsigned > &x)
 Find values for each node with minimise the total cost.
void backtrace (unsigned root_value, vcl_vector< unsigned > &x)
 Compute optimal values for x[i] given that root node is root_value.
const vnl_vector< double > & root_cost () const
 root_cost()[i] is cost of selecting value i for the root node.

Private Member Functions

void process_dep1 (const mmn_dependancy &dep)
void process_dep2 (const mmn_dependancy &dep)

Private Attributes

vcl_vector< vnl_vector< double > > nc_
 Workspace for incremental costs of each node.
vcl_vector< vnl_matrix< double > > pc_
 Workspace for incremental costs of each arc.
vcl_vector< vcl_vector< unsigned > > index1_
 index1[i][j] = optimal choice for i if other node is j.
vcl_vector< vnl_matrix< int > > index2_
 index2[i](j,k) = optimal choice of i if two other nodes are (j,k).
vcl_vector< mmn_dependancydeps_
 Dependencies.


Constructor & Destructor Documentation

mmn_dp_solver::mmn_dp_solver  ) 
 

Default constructor.

Definition at line 10 of file mmn_dp_solver.cxx.


Member Function Documentation

void mmn_dp_solver::backtrace unsigned  root_value,
vcl_vector< unsigned > &  x
 

Compute optimal values for x[i] given that root node is root_value.

Assumes that solve() has been already called.

Definition at line 168 of file mmn_dp_solver.cxx.

void mmn_dp_solver::process_dep1 const mmn_dependancy dep  )  [private]
 

Definition at line 32 of file mmn_dp_solver.cxx.

void mmn_dp_solver::process_dep2 const mmn_dependancy dep  )  [private]
 

Definition at line 81 of file mmn_dp_solver.cxx.

unsigned mmn_dp_solver::root  )  const
 

Index of root node.

Definition at line 15 of file mmn_dp_solver.cxx.

const vnl_vector<double>& mmn_dp_solver::root_cost  )  const [inline]
 

root_cost()[i] is cost of selecting value i for the root node.

Definition at line 70 of file mmn_dp_solver.h.

void mmn_dp_solver::set_dependancies const vcl_vector< mmn_dependancy > &  deps,
unsigned  n_nodes,
unsigned  max_n_arcs
 

Define dependencies.

Definition at line 22 of file mmn_dp_solver.cxx.

double mmn_dp_solver::solve const vcl_vector< vnl_vector< double > > &  node_cost,
const vcl_vector< vnl_matrix< double > > &  pair_cost,
vcl_vector< unsigned > &  x
 

Find values for each node with minimise the total cost.

Parameters:
node_cost,: node_cost[i][j] is cost of selecting value j for node i
pair_cost,: pair_cost[a](i,j) is cost of selecting values (i,j) for nodes at end of arc a.
x,: On exit, x[i] gives choice for node i NOTE: If arc a connects nodes v1,v2, the associated pair_cost is ordered with the node with the lowest index being the first parameter. Thus if v1 has value i1, v2 has value i2, then the cost of this choice is (v1<v2?pair_cost(i1,i2):pair_cost(i2,i1)) Returns the minimum cost

Definition at line 134 of file mmn_dp_solver.cxx.


Member Data Documentation

vcl_vector<mmn_dependancy> mmn_dp_solver::deps_ [private]
 

Dependencies.

Definition at line 37 of file mmn_dp_solver.h.

vcl_vector<vcl_vector<unsigned> > mmn_dp_solver::index1_ [private]
 

index1[i][j] = optimal choice for i if other node is j.

Definition at line 31 of file mmn_dp_solver.h.

vcl_vector<vnl_matrix<int> > mmn_dp_solver::index2_ [private]
 

index2[i](j,k) = optimal choice of i if two other nodes are (j,k).

Definition at line 34 of file mmn_dp_solver.h.

vcl_vector<vnl_vector<double> > mmn_dp_solver::nc_ [private]
 

Workspace for incremental costs of each node.

Definition at line 25 of file mmn_dp_solver.h.

vcl_vector<vnl_matrix<double> > mmn_dp_solver::pc_ [private]
 

Workspace for incremental costs of each arc.

Definition at line 28 of file mmn_dp_solver.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 14:44:52 2008 for contrib/mul/mmn by  doxygen 1.4.4