test/matching_test.cc
branch1.2
changeset 1099 1086d1c28303
parent 949 61120524af27
child 1173 d216e1c8b3fa
equal deleted inserted replaced
1:ed3f4674a8b3 2:413517cd474a
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2009
     5  * Copyright (C) 2003-2010
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
   132   mat_test.greedyInit();
   132   mat_test.greedyInit();
   133   mat_test.matchingInit(mat);
   133   mat_test.matchingInit(mat);
   134   mat_test.startSparse();
   134   mat_test.startSparse();
   135   mat_test.startDense();
   135   mat_test.startDense();
   136   mat_test.run();
   136   mat_test.run();
   137   
   137 
   138   const_mat_test.matchingSize();
   138   const_mat_test.matchingSize();
   139   const_mat_test.matching(e);
   139   const_mat_test.matching(e);
   140   const_mat_test.matching(n);
   140   const_mat_test.matching(n);
   141   const MaxMatching<Graph>::MatchingMap& mmap =
   141   const MaxMatching<Graph>::MatchingMap& mmap =
   142     const_mat_test.matchingMap();
   142     const_mat_test.matchingMap();
   143   e = mmap[n];
   143   e = mmap[n];
   144   const_mat_test.mate(n);
   144   const_mat_test.mate(n);
   145 
   145 
   146   MaxMatching<Graph>::Status stat = 
   146   MaxMatching<Graph>::Status stat =
   147     const_mat_test.status(n);
   147     const_mat_test.status(n);
   148   const MaxMatching<Graph>::StatusMap& smap =
   148   const MaxMatching<Graph>::StatusMap& smap =
   149     const_mat_test.statusMap();
   149     const_mat_test.statusMap();
   150   stat = smap[n];
   150   stat = smap[n];
   151   const_mat_test.barrier(n);
   151   const_mat_test.barrier(n);
   168     const_mat_test = mat_test;
   168     const_mat_test = mat_test;
   169 
   169 
   170   mat_test.init();
   170   mat_test.init();
   171   mat_test.start();
   171   mat_test.start();
   172   mat_test.run();
   172   mat_test.run();
   173   
   173 
   174   const_mat_test.matchingWeight();
   174   const_mat_test.matchingWeight();
   175   const_mat_test.matchingSize();
   175   const_mat_test.matchingSize();
   176   const_mat_test.matching(e);
   176   const_mat_test.matching(e);
   177   const_mat_test.matching(n);
   177   const_mat_test.matching(n);
   178   const MaxWeightedMatching<Graph>::MatchingMap& mmap =
   178   const MaxWeightedMatching<Graph>::MatchingMap& mmap =
   179     const_mat_test.matchingMap();
   179     const_mat_test.matchingMap();
   180   e = mmap[n];
   180   e = mmap[n];
   181   const_mat_test.mate(n);
   181   const_mat_test.mate(n);
   182   
   182 
   183   int k = 0;
   183   int k = 0;
   184   const_mat_test.dualValue();
   184   const_mat_test.dualValue();
   185   const_mat_test.nodeValue(n);
   185   const_mat_test.nodeValue(n);
   186   const_mat_test.blossomNum();
   186   const_mat_test.blossomNum();
   187   const_mat_test.blossomSize(k);
   187   const_mat_test.blossomSize(k);
   205     const_mat_test = mat_test;
   205     const_mat_test = mat_test;
   206 
   206 
   207   mat_test.init();
   207   mat_test.init();
   208   mat_test.start();
   208   mat_test.start();
   209   mat_test.run();
   209   mat_test.run();
   210   
   210 
   211   const_mat_test.matchingWeight();
   211   const_mat_test.matchingWeight();
   212   const_mat_test.matching(e);
   212   const_mat_test.matching(e);
   213   const_mat_test.matching(n);
   213   const_mat_test.matching(n);
   214   const MaxWeightedPerfectMatching<Graph>::MatchingMap& mmap =
   214   const MaxWeightedPerfectMatching<Graph>::MatchingMap& mmap =
   215     const_mat_test.matchingMap();
   215     const_mat_test.matchingMap();
   216   e = mmap[n];
   216   e = mmap[n];
   217   const_mat_test.mate(n);
   217   const_mat_test.mate(n);
   218   
   218 
   219   int k = 0;
   219   int k = 0;
   220   const_mat_test.dualValue();
   220   const_mat_test.dualValue();
   221   const_mat_test.nodeValue(n);
   221   const_mat_test.nodeValue(n);
   222   const_mat_test.blossomNum();
   222   const_mat_test.blossomNum();
   223   const_mat_test.blossomSize(k);
   223   const_mat_test.blossomSize(k);
   423     }
   423     }
   424 
   424 
   425     {
   425     {
   426       MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
   426       MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
   427       bool result = mwpm.run();
   427       bool result = mwpm.run();
   428       
   428 
   429       check(result == perfect, "Perfect matching found");
   429       check(result == perfect, "Perfect matching found");
   430       if (perfect) {
   430       if (perfect) {
   431         checkWeightedPerfectMatching(graph, weight, mwpm);
   431         checkWeightedPerfectMatching(graph, weight, mwpm);
   432       }
   432       }
   433     }
   433     }
   434 
   434 
   435     {
   435     {
   436       MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
   436       MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
   437       mwpm.init();
   437       mwpm.init();
   438       bool result = mwpm.start();
   438       bool result = mwpm.start();
   439       
   439 
   440       check(result == perfect, "Perfect matching found");
   440       check(result == perfect, "Perfect matching found");
   441       if (perfect) {
   441       if (perfect) {
   442         checkWeightedPerfectMatching(graph, weight, mwpm);
   442         checkWeightedPerfectMatching(graph, weight, mwpm);
   443       }
   443       }
   444     }
   444     }