Adds tests for the new MCF algorithms (#180)
authorPeter Kovacs <kpeter@inf.elte.hu>
Fri, 13 Nov 2009 00:24:39 +0100
changeset 885d93490b861e9
parent 884 bc75ee2ad082
child 886 7ef7a5fbb85d
Adds tests for the new MCF algorithms (#180)
test/min_cost_flow_test.cc
     1.1 --- a/test/min_cost_flow_test.cc	Fri Nov 13 00:23:07 2009 +0100
     1.2 +++ b/test/min_cost_flow_test.cc	Fri Nov 13 00:24:39 2009 +0100
     1.3 @@ -24,8 +24,12 @@
     1.4  #include <lemon/lgf_reader.h>
     1.5  
     1.6  #include <lemon/network_simplex.h>
     1.7 +#include <lemon/capacity_scaling.h>
     1.8 +#include <lemon/cost_scaling.h>
     1.9 +#include <lemon/cycle_canceling.h>
    1.10  
    1.11  #include <lemon/concepts/digraph.h>
    1.12 +#include <lemon/concepts/heap.h>
    1.13  #include <lemon/concept_check.h>
    1.14  
    1.15  #include "test_tools.h"
    1.16 @@ -457,6 +461,45 @@
    1.17                    NetworkSimplex<GR, int, double> >();
    1.18    }
    1.19  
    1.20 +  // Check the interface of CapacityScaling
    1.21 +  {
    1.22 +    typedef concepts::Digraph GR;
    1.23 +    checkConcept< McfClassConcept<GR, int, int>,
    1.24 +                  CapacityScaling<GR> >();
    1.25 +    checkConcept< McfClassConcept<GR, double, double>,
    1.26 +                  CapacityScaling<GR, double> >();
    1.27 +    checkConcept< McfClassConcept<GR, int, double>,
    1.28 +                  CapacityScaling<GR, int, double> >();
    1.29 +    typedef CapacityScaling<GR>::
    1.30 +      SetHeap<concepts::Heap<int, RangeMap<int> > >::Create CAS;
    1.31 +    checkConcept< McfClassConcept<GR, int, int>, CAS >();
    1.32 +  }
    1.33 +
    1.34 +  // Check the interface of CostScaling
    1.35 +  {
    1.36 +    typedef concepts::Digraph GR;
    1.37 +    checkConcept< McfClassConcept<GR, int, int>,
    1.38 +                  CostScaling<GR> >();
    1.39 +    checkConcept< McfClassConcept<GR, double, double>,
    1.40 +                  CostScaling<GR, double> >();
    1.41 +    checkConcept< McfClassConcept<GR, int, double>,
    1.42 +                  CostScaling<GR, int, double> >();
    1.43 +    typedef CostScaling<GR>::
    1.44 +      SetLargeCost<double>::Create COS;
    1.45 +    checkConcept< McfClassConcept<GR, int, int>, COS >();
    1.46 +  }
    1.47 +
    1.48 +  // Check the interface of CycleCanceling
    1.49 +  {
    1.50 +    typedef concepts::Digraph GR;
    1.51 +    checkConcept< McfClassConcept<GR, int, int>,
    1.52 +                  CycleCanceling<GR> >();
    1.53 +    checkConcept< McfClassConcept<GR, double, double>,
    1.54 +                  CycleCanceling<GR, double> >();
    1.55 +    checkConcept< McfClassConcept<GR, int, double>,
    1.56 +                  CycleCanceling<GR, int, double> >();
    1.57 +  }
    1.58 +
    1.59    // Test NetworkSimplex
    1.60    { 
    1.61      typedef NetworkSimplex<Digraph> MCF;
    1.62 @@ -471,6 +514,29 @@
    1.63      runMcfGeqTests<MCF>(MCF::ALTERING_LIST,  "NS-AL", true);
    1.64      runMcfLeqTests<MCF>(MCF::ALTERING_LIST,  "NS-AL");
    1.65    }
    1.66 +  
    1.67 +  // Test CapacityScaling
    1.68 +  {
    1.69 +    typedef CapacityScaling<Digraph> MCF;
    1.70 +    runMcfGeqTests<MCF>(0, "SSP");
    1.71 +    runMcfGeqTests<MCF>(2, "CAS");
    1.72 +  }
    1.73 +
    1.74 +  // Test CostScaling
    1.75 +  {
    1.76 +    typedef CostScaling<Digraph> MCF;
    1.77 +    runMcfGeqTests<MCF>(MCF::PUSH, "COS-PR");
    1.78 +    runMcfGeqTests<MCF>(MCF::AUGMENT, "COS-AR");
    1.79 +    runMcfGeqTests<MCF>(MCF::PARTIAL_AUGMENT, "COS-PAR");
    1.80 +  }
    1.81 +
    1.82 +  // Test CycleCanceling
    1.83 +  {
    1.84 +    typedef CycleCanceling<Digraph> MCF;
    1.85 +    runMcfGeqTests<MCF>(MCF::SIMPLE_CYCLE_CANCELING, "SCC");
    1.86 +    runMcfGeqTests<MCF>(MCF::MINIMUM_MEAN_CYCLE_CANCELING, "MMCC");
    1.87 +    runMcfGeqTests<MCF>(MCF::CANCEL_AND_TIGHTEN, "CAT");
    1.88 +  }
    1.89  
    1.90    return 0;
    1.91  }