gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Adds tests for the new MCF algorithms (#180)
0 1 0
default
1 file changed with 66 insertions and 0 deletions:
↑ Collapse diff ↑
Ignore white space 12 line context
... ...
@@ -21,14 +21,18 @@
21 21
#include <limits>
22 22

	
23 23
#include <lemon/list_graph.h>
24 24
#include <lemon/lgf_reader.h>
25 25

	
26 26
#include <lemon/network_simplex.h>
27
#include <lemon/capacity_scaling.h>
28
#include <lemon/cost_scaling.h>
29
#include <lemon/cycle_canceling.h>
27 30

	
28 31
#include <lemon/concepts/digraph.h>
32
#include <lemon/concepts/heap.h>
29 33
#include <lemon/concept_check.h>
30 34

	
31 35
#include "test_tools.h"
32 36

	
33 37
using namespace lemon;
34 38

	
... ...
@@ -454,12 +458,51 @@
454 458
    checkConcept< McfClassConcept<GR, double, double>,
455 459
                  NetworkSimplex<GR, double> >();
456 460
    checkConcept< McfClassConcept<GR, int, double>,
457 461
                  NetworkSimplex<GR, int, double> >();
458 462
  }
459 463

	
464
  // Check the interface of CapacityScaling
465
  {
466
    typedef concepts::Digraph GR;
467
    checkConcept< McfClassConcept<GR, int, int>,
468
                  CapacityScaling<GR> >();
469
    checkConcept< McfClassConcept<GR, double, double>,
470
                  CapacityScaling<GR, double> >();
471
    checkConcept< McfClassConcept<GR, int, double>,
472
                  CapacityScaling<GR, int, double> >();
473
    typedef CapacityScaling<GR>::
474
      SetHeap<concepts::Heap<int, RangeMap<int> > >::Create CAS;
475
    checkConcept< McfClassConcept<GR, int, int>, CAS >();
476
  }
477

	
478
  // Check the interface of CostScaling
479
  {
480
    typedef concepts::Digraph GR;
481
    checkConcept< McfClassConcept<GR, int, int>,
482
                  CostScaling<GR> >();
483
    checkConcept< McfClassConcept<GR, double, double>,
484
                  CostScaling<GR, double> >();
485
    checkConcept< McfClassConcept<GR, int, double>,
486
                  CostScaling<GR, int, double> >();
487
    typedef CostScaling<GR>::
488
      SetLargeCost<double>::Create COS;
489
    checkConcept< McfClassConcept<GR, int, int>, COS >();
490
  }
491

	
492
  // Check the interface of CycleCanceling
493
  {
494
    typedef concepts::Digraph GR;
495
    checkConcept< McfClassConcept<GR, int, int>,
496
                  CycleCanceling<GR> >();
497
    checkConcept< McfClassConcept<GR, double, double>,
498
                  CycleCanceling<GR, double> >();
499
    checkConcept< McfClassConcept<GR, int, double>,
500
                  CycleCanceling<GR, int, double> >();
501
  }
502

	
460 503
  // Test NetworkSimplex
461 504
  { 
462 505
    typedef NetworkSimplex<Digraph> MCF;
463 506
    runMcfGeqTests<MCF>(MCF::FIRST_ELIGIBLE, "NS-FE", true);
464 507
    runMcfLeqTests<MCF>(MCF::FIRST_ELIGIBLE, "NS-FE");
465 508
    runMcfGeqTests<MCF>(MCF::BEST_ELIGIBLE,  "NS-BE", true);
... ...
@@ -468,9 +511,32 @@
468 511
    runMcfLeqTests<MCF>(MCF::BLOCK_SEARCH,   "NS-BS");
469 512
    runMcfGeqTests<MCF>(MCF::CANDIDATE_LIST, "NS-CL", true);
470 513
    runMcfLeqTests<MCF>(MCF::CANDIDATE_LIST, "NS-CL");
471 514
    runMcfGeqTests<MCF>(MCF::ALTERING_LIST,  "NS-AL", true);
472 515
    runMcfLeqTests<MCF>(MCF::ALTERING_LIST,  "NS-AL");
473 516
  }
517
  
518
  // Test CapacityScaling
519
  {
520
    typedef CapacityScaling<Digraph> MCF;
521
    runMcfGeqTests<MCF>(0, "SSP");
522
    runMcfGeqTests<MCF>(2, "CAS");
523
  }
524

	
525
  // Test CostScaling
526
  {
527
    typedef CostScaling<Digraph> MCF;
528
    runMcfGeqTests<MCF>(MCF::PUSH, "COS-PR");
529
    runMcfGeqTests<MCF>(MCF::AUGMENT, "COS-AR");
530
    runMcfGeqTests<MCF>(MCF::PARTIAL_AUGMENT, "COS-PAR");
531
  }
532

	
533
  // Test CycleCanceling
534
  {
535
    typedef CycleCanceling<Digraph> MCF;
536
    runMcfGeqTests<MCF>(MCF::SIMPLE_CYCLE_CANCELING, "SCC");
537
    runMcfGeqTests<MCF>(MCF::MINIMUM_MEAN_CYCLE_CANCELING, "MMCC");
538
    runMcfGeqTests<MCF>(MCF::CANCEL_AND_TIGHTEN, "CAT");
539
  }
474 540

	
475 541
  return 0;
476 542
}
0 comments (0 inline)