munkres.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (c) 2007 John Weaver
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #if !defined(_MUNKRES_H_)
25 #define _MUNKRES_H_
26 
27 #include <mtt/matrix.h>
28 
29 #include <cmath>
30 #include <list>
31 #include <utility>
32 #include <vector>
33 
34 #include <Eigen/Dense>
35 #include <Eigen/Cholesky>
36 
37 #include <boost/shared_ptr.hpp>
38 
39 using Eigen::MatrixXd;
40 
41 using namespace std;
42 
43 typedef struct
44 {
45  int row, col;
46 
48 
49 typedef boost::shared_ptr<orderedPair> orderedPairPtr;
50 
51 
52 class Munkres {
53 public:
54  void solve(Matrix<double> &m);
55  double solve(MatrixXd& m_in,vector<orderedPairPtr>& results);
56 
57 private:
58  static const int NORMAL = 0;
59  static const int STAR = 1;
60  static const int PRIME = 2;
61  inline bool find_uncovered_in_matrix(double,int&,int&);
62  inline bool pair_in_list(const std::pair<int,int> &, const std::list<std::pair<int,int> > &);
63  int step1(void);
64  int step2(void);
65  int step3(void);
66  int step4(void);
67  int step5(void);
68  int step6(void);
71  bool *row_mask;
72  bool *col_mask;
73  int saverow, savecol;
74 };
75 
76 #endif /* !defined(_MUNKRES_H_) */
bool * col_mask
Definition: munkres.h:72
int saverow
Definition: munkres.h:73
Matrix< double > matrix
Definition: munkres.h:70
bool * row_mask
Definition: munkres.h:71
Matrix< int > mask_matrix
Definition: munkres.h:69
Auxiliary external matrix class used in the Munkres algorithm (Hungarian)
int row
Definition: munkres.h:45
boost::shared_ptr< orderedPair > orderedPairPtr
Definition: munkres.h:49


mtt
Author(s): Jorge Almeida
autogenerated on Mon Mar 2 2015 01:32:18