COIN-OR::LEMON - Graph Library

Changeset 970:d216e1c8b3fa in lemon-1.2 for test/suurballe_test.cc


Ignore:
Timestamp:
11/28/12 11:54:43 (7 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Parents:
965:00f8d9f9920d (diff), 969:7e368d9b67f7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge #453 to branches >=1.2

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/suurballe_test.cc

    r877 r970  
    118118  int f;
    119119  VType c;
     120  ignore_unused_variable_warning(f,c);
     121
    120122  c = const_suurb_test.totalLength();
    121123  f = const_suurb_test.flow(e);
  • test/suurballe_test.cc

    r969 r970  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    2424#include <lemon/suurballe.h>
    2525#include <lemon/concepts/digraph.h>
     26#include <lemon/concepts/heap.h>
    2627
    2728#include "test_tools.h"
     
    8182  typedef Digraph::Arc Arc;
    8283  typedef concepts::ReadMap<Arc, VType> LengthMap;
    83  
    84   typedef Suurballe<Digraph, LengthMap> SuurballeType;
     84
     85  typedef Suurballe<Digraph, LengthMap> ST;
     86  typedef Suurballe<Digraph, LengthMap>
     87    ::SetFlowMap<ST::FlowMap>
     88    ::SetPotentialMap<ST::PotentialMap>
     89    ::SetPath<SimplePath<Digraph> >
     90    ::SetHeap<concepts::Heap<VType, Digraph::NodeMap<int> > >
     91    ::Create SuurballeType;
    8592
    8693  Digraph g;
     
    102109  k = suurb_test.run(n, n, k);
    103110  suurb_test.init(n);
     111  suurb_test.fullInit(n);
     112  suurb_test.start(n);
     113  suurb_test.start(n, k);
    104114  k = suurb_test.findFlow(n);
    105115  k = suurb_test.findFlow(n, k);
    106116  suurb_test.findPaths();
    107  
     117
    108118  int f;
    109119  VType c;
     
    119129  k = const_suurb_test.pathNum();
    120130  Path<Digraph> p = const_suurb_test.path(k);
    121  
     131
    122132  ignore_unused_variable_warning(fm);
    123133  ignore_unused_variable_warning(pm);
     
    198208    run();
    199209
    200   // Find 2 paths
     210  // Check run()
    201211  {
    202212    Suurballe<ListDigraph> suurballe(digraph, length);
     213
     214    // Find 2 paths
    203215    check(suurballe.run(s, t) == 2, "Wrong number of paths");
    204216    check(checkFlow(digraph, suurballe.flowMap(), s, t, 2),
     
    210222    for (int i = 0; i < suurballe.pathNum(); ++i)
    211223      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    212   }
    213 
    214   // Find 3 paths
    215   {
    216     Suurballe<ListDigraph> suurballe(digraph, length);
     224
     225    // Find 3 paths
    217226    check(suurballe.run(s, t, 3) == 3, "Wrong number of paths");
    218227    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
     
    224233    for (int i = 0; i < suurballe.pathNum(); ++i)
    225234      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    226   }
    227 
    228   // Find 5 paths (only 3 can be found)
    229   {
    230     Suurballe<ListDigraph> suurballe(digraph, length);
     235
     236    // Find 5 paths (only 3 can be found)
    231237    check(suurballe.run(s, t, 5) == 3, "Wrong number of paths");
    232238    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
     
    240246  }
    241247
     248  // Check fullInit() + start()
     249  {
     250    Suurballe<ListDigraph> suurballe(digraph, length);
     251    suurballe.fullInit(s);
     252
     253    // Find 2 paths
     254    check(suurballe.start(t) == 2, "Wrong number of paths");
     255    check(suurballe.totalLength() == 510, "The flow is not optimal");
     256
     257    // Find 3 paths
     258    check(suurballe.start(t, 3) == 3, "Wrong number of paths");
     259    check(suurballe.totalLength() == 1040, "The flow is not optimal");
     260
     261    // Find 5 paths (only 3 can be found)
     262    check(suurballe.start(t, 5) == 3, "Wrong number of paths");
     263    check(suurballe.totalLength() == 1040, "The flow is not optimal");
     264  }
     265
    242266  return 0;
    243267}
Note: See TracChangeset for help on using the changeset viewer.