test/min_mean_cycle_test.cc
changeset 765 3b544a9c92db
parent 764 1fac515a59c1
child 766 97744b6dabf8
equal deleted inserted replaced
1:50744cf65886 2:7762cfda2f5e
    19 #include <iostream>
    19 #include <iostream>
    20 #include <sstream>
    20 #include <sstream>
    21 
    21 
    22 #include <lemon/smart_graph.h>
    22 #include <lemon/smart_graph.h>
    23 #include <lemon/lgf_reader.h>
    23 #include <lemon/lgf_reader.h>
    24 #include <lemon/howard.h>
       
    25 #include <lemon/path.h>
    24 #include <lemon/path.h>
    26 #include <lemon/concepts/digraph.h>
    25 #include <lemon/concepts/digraph.h>
    27 #include <lemon/concept_check.h>
    26 #include <lemon/concept_check.h>
       
    27 
       
    28 #include <lemon/karp.h>
       
    29 #include <lemon/howard.h>
    28 
    30 
    29 #include "test_tools.h"
    31 #include "test_tools.h"
    30 
    32 
    31 using namespace lemon;
    33 using namespace lemon;
    32 
    34 
   139   #endif
   141   #endif
   140 
   142 
   141   // Check the interface
   143   // Check the interface
   142   {
   144   {
   143     typedef concepts::Digraph GR;
   145     typedef concepts::Digraph GR;
   144     typedef Howard<GR, concepts::ReadMap<GR::Arc, int> > IntMmcAlg;
   146 
   145     typedef Howard<GR, concepts::ReadMap<GR::Arc, float> > FloatMmcAlg;
   147     // Karp
       
   148     checkConcept< MmcClassConcept<GR, int>,
       
   149                   Karp<GR, concepts::ReadMap<GR::Arc, int> > >();
       
   150     checkConcept< MmcClassConcept<GR, float>,
       
   151                   Karp<GR, concepts::ReadMap<GR::Arc, float> > >();
   146     
   152     
   147     checkConcept<MmcClassConcept<GR, int>, IntMmcAlg>();
   153     // Howard
   148     checkConcept<MmcClassConcept<GR, float>, FloatMmcAlg>();
   154     checkConcept< MmcClassConcept<GR, int>,
   149   
   155                   Howard<GR, concepts::ReadMap<GR::Arc, int> > >();
   150     if (IsSameType<IntMmcAlg::LargeValue, long_int>::result == 0)
   156     checkConcept< MmcClassConcept<GR, float>,
   151       check(false, "Wrong LargeValue type");
   157                   Howard<GR, concepts::ReadMap<GR::Arc, float> > >();
   152     if (IsSameType<FloatMmcAlg::LargeValue, double>::result == 0)
   158 
   153       check(false, "Wrong LargeValue type");
   159     if (IsSameType<Howard<GR, concepts::ReadMap<GR::Arc, int> >::LargeValue,
       
   160           long_int>::result == 0) check(false, "Wrong LargeValue type");
       
   161     if (IsSameType<Howard<GR, concepts::ReadMap<GR::Arc, float> >::LargeValue,
       
   162           double>::result == 0) check(false, "Wrong LargeValue type");
   154   }
   163   }
   155 
   164 
   156   // Run various tests
   165   // Run various tests
   157   {
   166   {
   158     typedef SmartDigraph GR;
   167     typedef SmartDigraph GR;
   172       arcMap("c2", c2).
   181       arcMap("c2", c2).
   173       arcMap("c3", c3).
   182       arcMap("c3", c3).
   174       arcMap("c4", c4).
   183       arcMap("c4", c4).
   175       run();
   184       run();
   176 
   185 
       
   186     // Karp
       
   187     checkMmcAlg<Karp<GR, IntArcMap> >(gr, l1, c1,  6, 3);
       
   188     checkMmcAlg<Karp<GR, IntArcMap> >(gr, l2, c2,  5, 2);
       
   189     checkMmcAlg<Karp<GR, IntArcMap> >(gr, l3, c3,  0, 1);
       
   190     checkMmcAlg<Karp<GR, IntArcMap> >(gr, l4, c4, -1, 1);
       
   191 
       
   192     // Howard
   177     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l1, c1,  6, 3);
   193     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l1, c1,  6, 3);
   178     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l2, c2,  5, 2);
   194     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l2, c2,  5, 2);
   179     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l3, c3,  0, 1);
   195     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l3, c3,  0, 1);
   180     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l4, c4, -1, 1);
   196     checkMmcAlg<Howard<GR, IntArcMap> >(gr, l4, c4, -1, 1);
   181   }
   197   }