Base for classes which solve Markov Random Field problems. More...
#include <mmn_solver.h>
Public Member Functions | |
mmn_solver () | |
Dflt ctor. | |
virtual | ~mmn_solver () |
Destructor. | |
virtual void | set_arcs (unsigned num_nodes, const vcl_vector< mmn_arc > &arcs)=0 |
Input the arcs that define the graph. | |
virtual double | solve (const vcl_vector< vnl_vector< double > > &node_cost, const vcl_vector< vnl_matrix< double > > &pair_cost, vcl_vector< unsigned > &x)=0 |
Find values for each node with minimise the total cost. | |
virtual bool | set_from_stream (vcl_istream &is) |
Initialise from a text stream. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual mmn_solver * | clone () const =0 |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const =0 |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const =0 |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs)=0 |
Load class from binary file stream. | |
Static Public Member Functions | |
static vcl_auto_ptr< mmn_solver > | create_from_stream (vcl_istream &is) |
Create a concrete region_model-derived object, from a text specification. |
Base for classes which solve Markov Random Field problems.
Definition at line 19 of file mmn_solver.h.
mmn_solver::mmn_solver | ( | ) |
Dflt ctor.
Definition at line 20 of file mmn_solver.cxx.
mmn_solver::~mmn_solver | ( | ) | [virtual] |
Destructor.
Definition at line 28 of file mmn_solver.cxx.
virtual void mmn_solver::b_read | ( | vsl_b_istream & | bfs | ) | [pure virtual] |
Load class from binary file stream.
Implemented in mmn_lbp_solver, and mmn_dp_solver.
virtual void mmn_solver::b_write | ( | vsl_b_ostream & | bfs | ) | const [pure virtual] |
Save class to binary file stream.
Implemented in mmn_lbp_solver, and mmn_dp_solver.
virtual mmn_solver* mmn_solver::clone | ( | ) | const [pure virtual] |
Create a copy on the heap and return base class pointer.
Implemented in mmn_lbp_solver, and mmn_dp_solver.
vcl_auto_ptr< mmn_solver > mmn_solver::create_from_stream | ( | vcl_istream & | is | ) | [static] |
Create a concrete region_model-derived object, from a text specification.
Definition at line 76 of file mmn_solver.cxx.
vcl_string mmn_solver::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented in mmn_lbp_solver, and mmn_dp_solver.
Definition at line 63 of file mmn_solver.cxx.
virtual void mmn_solver::print_summary | ( | vcl_ostream & | os | ) | const [pure virtual] |
Print class to os.
Implemented in mmn_lbp_solver, and mmn_dp_solver.
virtual void mmn_solver::set_arcs | ( | unsigned | num_nodes, |
const vcl_vector< mmn_arc > & | arcs | ||
) | [pure virtual] |
Input the arcs that define the graph.
Implemented in mmn_lbp_solver, and mmn_dp_solver.
bool mmn_solver::set_from_stream | ( | vcl_istream & | is | ) | [virtual] |
Initialise from a text stream.
Initialise from a string stream.
Reimplemented in mmn_lbp_solver, and mmn_dp_solver.
Definition at line 34 of file mmn_solver.cxx.
virtual double mmn_solver::solve | ( | const vcl_vector< vnl_vector< double > > & | node_cost, |
const vcl_vector< vnl_matrix< double > > & | pair_cost, | ||
vcl_vector< unsigned > & | x | ||
) | [pure virtual] |
Find values for each node with minimise the total cost.
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 |
Implemented in mmn_lbp_solver, and mmn_dp_solver.
short mmn_solver::version_no | ( | ) | const |
Version number for I/O.
Reimplemented in mmn_lbp_solver, and mmn_dp_solver.
Definition at line 54 of file mmn_solver.cxx.