35 if (
matrix(row,col) == item )
43 for ( std::list<std::pair<int,int> >::const_iterator i = haystack.begin() ; i != haystack.end() ; i++ ) {
53 for (
int row = 0 ; row <
matrix.
rows() ; row++ )
55 if (
matrix(row,col) == 0 ) {
56 bool isstarred =
false;
57 for (
int nrow = 0 ; nrow <
matrix.
rows() ; nrow++ )
84 for (
int row = 0 ; row < rows ; row++ )
85 for (
int col = 0 ; col < cols ; col++ )
93 if ( covercount >= k ) {
95 std::cout <<
"Final cover count: " << covercount << std::endl;
101 std::cout <<
"Munkres matrix has " << covercount <<
" of " << k <<
" Columns covered:" << std::endl;
102 for (
int row = 0 ; row < rows ; row++ ) {
103 for (
int col = 0 ; col < cols ; col++ ) {
105 std::cout <<
matrix(row,col) <<
",";
107 std::cout << std::endl;
109 std::cout << std::endl;
146 std::list<std::pair<int,int> > seq;
149 std::pair<int,int> z1(-1,-1);
150 std::pair<int,int> z2n(-1,-1);
151 seq.insert(seq.end(), z0);
168 for ( row = 0 ; row < rows ; row++ )
176 seq.insert(seq.end(), z1);
185 for ( col = 0 ; col < cols ; col++ )
192 seq.insert(seq.end(), z2n);
195 }
while ( madepair );
197 for ( std::list<std::pair<int,int> >::iterator i = seq.begin() ;
216 for (
int i = 0 ; i < rows ; i++ ) {
220 for (
int i = 0 ; i < cols ; i++ ) {
241 for (
int row = 0 ; row < rows ; row++ ) {
243 for (
int col = 0 ; col < cols ; col++ ) {
245 if ( (h >
matrix(row,col) &&
matrix(row,col) != 0) || h == 0 ) {
253 for (
int row = 0 ; row < rows ; row++ )
255 for (
int col = 0 ; col < cols ; col++ )
258 for (
int col = 0 ; col < cols ; col++ )
260 for (
int row = 0 ; row < rows ; row++ )
277 double highValue = 0;
279 for(
int row=0;row<m_in.rows();++row)
280 for(
int col=0;col<m_in.cols();++col)
282 if(!std::isinf(m_in(row,col)))
284 highValue = m_in(row,col);
285 m(row,col) = m_in(row,col);
291 for(
int row=0;row<m_in.rows();++row)
292 for(
int col=0;col<m_in.cols();++col)
294 if(std::isinf(m_in(row,col)))
296 m(row,col) = highValue ;
343 for (
int row = 0 ; row <
matrix.
rows() ; row++ )
352 results.push_back(op);
372 double highValue = 0;
373 for (
int row = 0 ; row < m.
rows() ; row++ ) {
374 for (
int col = 0 ; col < m.
columns() ; col++ ) {
375 if ( m(row,col) != INFINITY && m(row,col) > highValue )
376 highValue = m(row,col);
381 for (
int row = 0 ; row < m.
rows() ; row++ )
382 for (
int col = 0 ; col < m.
columns() ; col++ )
383 if ( m(row,col) == INFINITY )
384 m(row,col) = highValue;
427 for (
int row = 0 ; row <
matrix.
rows() ; row++ )
435 std::cout <<
"Munkres output matrix:" << std::endl;
436 for (
int row = 0 ; row <
matrix.
rows() ; row++ ) {
439 std::cout <<
matrix(row,col) <<
",";
441 std::cout << std::endl;
443 std::cout << std::endl;
bool pair_in_list(const std::pair< int, int > &, const std::list< std::pair< int, int > > &)
void resize(int rows, int columns)
void solve(Matrix< double > &m)
Matrix< int > mask_matrix
bool find_uncovered_in_matrix(double, int &, int &)
External library declaration to preform the Hungarian algorithm (Munkres)
boost::shared_ptr< orderedPair > orderedPairPtr