#include <mmn_dp_solver.h>
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_dependancy > | deps_ |
| Dependencies. | |
|
|
Default constructor.
Definition at line 10 of file mmn_dp_solver.cxx. |
|
||||||||||||
|
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. |
|
|
Definition at line 32 of file mmn_dp_solver.cxx. |
|
|
Definition at line 81 of file mmn_dp_solver.cxx. |
|
|
Index of root node.
Definition at line 15 of file mmn_dp_solver.cxx. |
|
|
root_cost()[i] is cost of selecting value i for the root node.
Definition at line 70 of file mmn_dp_solver.h. |
|
||||||||||||||||
|
Define dependencies.
Definition at line 22 of file mmn_dp_solver.cxx. |
|
||||||||||||||||
|
Find values for each node with minimise the total cost.
Definition at line 134 of file mmn_dp_solver.cxx. |
|
|
Dependencies.
Definition at line 37 of file mmn_dp_solver.h. |
|
|
index1[i][j] = optimal choice for i if other node is j.
Definition at line 31 of file mmn_dp_solver.h. |
|
|
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. |
|
|
Workspace for incremental costs of each node.
Definition at line 25 of file mmn_dp_solver.h. |
|
|
Workspace for incremental costs of each arc.
Definition at line 28 of file mmn_dp_solver.h. |
1.4.4