test/max_cardinality_search_test.cc
changeset 1140 f8ec64f78b5f
parent 955 7f6eeffe3cd1
equal deleted inserted replaced
1:7733f0a4f1e5 2:2df9c0b706a9
     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-2010
     5  * Copyright (C) 2003-2013
     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
    65   Node n,s;
    65   Node n,s;
    66   CapMap cap;
    66   CapMap cap;
    67   CardMap card;
    67   CardMap card;
    68   ProcMap proc;
    68   ProcMap proc;
    69   HeapCrossRef crossref(g);
    69   HeapCrossRef crossref(g);
    70   
    70 
    71   typedef MaxCardinalitySearch<Digraph,CapMap>
    71   typedef MaxCardinalitySearch<Digraph,CapMap>
    72     ::SetCapacityMap<CapMap>
    72     ::SetCapacityMap<CapMap>
    73     ::SetCardinalityMap<CardMap>
    73     ::SetCardinalityMap<CardMap>
    74     ::SetProcessedMap<ProcMap>
    74     ::SetProcessedMap<ProcMap>
    75     ::SetStandardHeap<BinHeap<Value,HeapCrossRef> >
    75     ::SetStandardHeap<BinHeap<Value,HeapCrossRef> >
    79   const MaxCardType& const_maxcard = maxcard;
    79   const MaxCardType& const_maxcard = maxcard;
    80 
    80 
    81   const MaxCardType::Heap& heap_const = const_maxcard.heap();
    81   const MaxCardType::Heap& heap_const = const_maxcard.heap();
    82   MaxCardType::Heap& heap = const_cast<MaxCardType::Heap&>(heap_const);
    82   MaxCardType::Heap& heap = const_cast<MaxCardType::Heap&>(heap_const);
    83   maxcard.heap(heap,crossref);
    83   maxcard.heap(heap,crossref);
    84   
    84 
    85   maxcard.capacityMap(cap).cardinalityMap(card).processedMap(proc);
    85   maxcard.capacityMap(cap).cardinalityMap(card).processedMap(proc);
    86 
    86 
    87   maxcard.init();
    87   maxcard.init();
    88   maxcard.addSource(s);
    88   maxcard.addSource(s);
    89   n = maxcard.nextNode();
    89   n = maxcard.nextNode();