COIN-OR::LEMON - Graph Library

Changeset 998:7fdaa05a69a1 in lemon-main for lemon


Ignore:
Timestamp:
09/13/12 11:56:19 (12 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
999:00f8d9f9920d, 1183:cd72eae05bdf
Parents:
995:4bb9e72e1a41 (diff), 997:761fe0846f49 (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 #449 to branches >=1.2

Location:
lemon
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • lemon/adaptors.h

    r877 r998  
    13721372    /// and edge filter maps.
    13731373    SubGraph(GR& graph, NF& node_filter, EF& edge_filter) {
    1374       initialize(graph, node_filter, edge_filter);
     1374      this->initialize(graph, node_filter, edge_filter);
    13751375    }
    13761376
     
    22782278    /// Creates an undirected graph from the given digraph.
    22792279    Undirector(DGR& digraph) {
    2280       initialize(digraph);
     2280      this->initialize(digraph);
    22812281    }
    22822282
  • lemon/adaptors.h

    r997 r998  
    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).
     
    361361  /// parameter is set to be \c const.
    362362  ///
     363  /// This class provides item counting in the same time as the adapted
     364  /// digraph structure.
     365  ///
    363366  /// \tparam DGR The type of the adapted digraph.
    364367  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    419422      Parent::initialize(digraph);
    420423      _node_filter = &node_filter;
    421       _arc_filter = &arc_filter;     
     424      _arc_filter = &arc_filter;
    422425    }
    423426
     
    506509
    507510    template <typename V>
    508     class NodeMap 
    509       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 
    510               LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
     511    class NodeMap
     512      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
     513              LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
    511514      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    512         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
     515        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
    513516
    514517    public:
     
    533536
    534537    template <typename V>
    535     class ArcMap 
     538    class ArcMap
    536539      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    537               LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
     540              LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
    538541      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    539542        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
     
    580583      Parent::initialize(digraph);
    581584      _node_filter = &node_filter;
    582       _arc_filter = &arc_filter;     
     585      _arc_filter = &arc_filter;
    583586    }
    584587
     
    649652
    650653    template <typename V>
    651     class NodeMap 
     654    class NodeMap
    652655      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    653656          LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
    654       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 
     657      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    655658        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
    656659
     
    676679
    677680    template <typename V>
    678     class ArcMap 
     681    class ArcMap
    679682      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    680683          LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
     
    719722  /// by adding or removing nodes or arcs, unless the \c GR template
    720723  /// parameter is set to be \c const.
     724  ///
     725  /// This class provides only linear time counting for nodes and arcs.
    721726  ///
    722727  /// \tparam DGR The type of the adapted digraph.
     
    10171022
    10181023    template <typename V>
    1019     class NodeMap 
     1024    class NodeMap
    10201025      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10211026          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
    1022       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
     1027      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10231028        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
    10241029
     
    10441049
    10451050    template <typename V>
    1046     class ArcMap 
     1051    class ArcMap
    10471052      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10481053          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
    1049       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
     1054      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10501055        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
    10511056
     
    10711076
    10721077    template <typename V>
    1073     class EdgeMap 
     1078    class EdgeMap
    10741079      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10751080        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
    1076       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
     1081      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10771082        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
    10781083
     
    11131118    NF* _node_filter;
    11141119    EF* _edge_filter;
    1115     SubGraphBase() 
    1116           : Parent(), _node_filter(0), _edge_filter(0) { }
     1120    SubGraphBase()
     1121          : Parent(), _node_filter(0), _edge_filter(0) { }
    11171122
    11181123    void initialize(GR& graph, NF& node_filter, EF& edge_filter) {
     
    12151220
    12161221    template <typename V>
    1217     class NodeMap 
     1222    class NodeMap
    12181223      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12191224          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
    1220       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
     1225      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12211226        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
    12221227
     
    12421247
    12431248    template <typename V>
    1244     class ArcMap 
     1249    class ArcMap
    12451250      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12461251          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
    1247       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
     1252      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12481253        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
    12491254
     
    12691274
    12701275    template <typename V>
    1271     class EdgeMap 
     1276    class EdgeMap
    12721277      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12731278        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
    1274       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
    1275         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
     1279      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
     1280        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
    12761281
    12771282    public:
     
    13141319  /// by adding or removing nodes or edges, unless the \c GR template
    13151320  /// parameter is set to be \c const.
     1321  ///
     1322  /// This class provides only linear time counting for nodes, edges and arcs.
    13161323  ///
    13171324  /// \tparam GR The type of the adapted graph.
     
    14711478  /// by adding or removing nodes or arcs/edges, unless the \c GR template
    14721479  /// parameter is set to be \c const.
     1480  ///
     1481  /// This class provides only linear time item counting.
    14731482  ///
    14741483  /// \tparam GR The type of the adapted digraph or graph.
     
    14961505#endif
    14971506    typedef DigraphAdaptorExtender<
    1498       SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 
     1507      SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
    14991508                     true> > Parent;
    15001509
     
    15171526    /// Creates a subgraph for the given digraph or graph with the
    15181527    /// given node filter map.
    1519     FilterNodes(GR& graph, NF& node_filter) 
     1528    FilterNodes(GR& graph, NF& node_filter)
    15201529      : Parent(), const_true_map()
    15211530    {
     
    15551564                    typename enable_if<UndirectedTagIndicator<GR> >::type> :
    15561565    public GraphAdaptorExtender<
    1557       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 
     1566      SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
    15581567                   true> > {
    15591568
    15601569    typedef GraphAdaptorExtender<
    1561       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 
     1570      SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
    15621571                   true> > Parent;
    15631572
     
    16191628  /// by adding or removing nodes or arcs, unless the \c GR template
    16201629  /// parameter is set to be \c const.
     1630  ///
     1631  /// This class provides only linear time counting for nodes and arcs.
    16211632  ///
    16221633  /// \tparam DGR The type of the adapted digraph.
     
    16431654#endif
    16441655    typedef DigraphAdaptorExtender<
    1645       SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 
     1656      SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
    16461657                     AF, false> > Parent;
    16471658
     
    17291740  /// by adding or removing nodes or edges, unless the \c GR template
    17301741  /// parameter is set to be \c const.
     1742  ///
     1743  /// This class provides only linear time counting for nodes, edges and arcs.
    17311744  ///
    17321745  /// \tparam GR The type of the adapted graph.
     
    17491762  class FilterEdges :
    17501763    public GraphAdaptorExtender<
    1751       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 
     1764      SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >,
    17521765                   EF, false> > {
    17531766#endif
    17541767    typedef GraphAdaptorExtender<
    1755       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 
     1768      SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,
    17561769                   EF, false> > Parent;
    17571770
     
    17781791    /// Creates a subgraph for the given graph with the given edge
    17791792    /// filter map.
    1780     FilterEdges(GR& graph, EF& edge_filter) 
     1793    FilterEdges(GR& graph, EF& edge_filter)
    17811794      : Parent(), const_true_map() {
    17821795      Parent::initialize(graph, const_true_map, edge_filter);
     
    18461859      bool _forward;
    18471860
    1848       Arc(const Edge& edge, bool forward) 
     1861      Arc(const Edge& edge, bool forward)
    18491862        : _edge(edge), _forward(forward) {}
    18501863
     
    20862099
    20872100      ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value)
    2088         : _forward(*adaptor._digraph, value), 
     2101        : _forward(*adaptor._digraph, value),
    20892102          _backward(*adaptor._digraph, value) {}
    20902103
     
    22042217    typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier;
    22052218    EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
    2206    
     2219
    22072220    typedef EdgeNotifier ArcNotifier;
    22082221    ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); }
     
    22322245  /// by adding or removing nodes or edges, unless the \c GR template
    22332246  /// parameter is set to be \c const.
     2247  ///
     2248  /// This class provides item counting in the same time as the adapted
     2249  /// digraph structure.
    22342250  ///
    22352251  /// \tparam DGR The type of the adapted digraph.
     
    25352551  /// by adding or removing nodes or arcs, unless the \c GR template
    25362552  /// parameter is set to be \c const.
     2553  ///
     2554  /// This class provides item counting in the same time as the adapted
     2555  /// graph structure.
    25372556  ///
    25382557  /// \tparam GR The type of the adapted graph.
     
    26792698  /// This class conforms to the \ref concepts::Digraph "Digraph" concept.
    26802699  ///
     2700  /// This class provides only linear time counting for nodes and arcs.
     2701  ///
    26812702  /// \tparam DGR The type of the adapted digraph.
    26822703  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    27082729           typename FM = CM,
    27092730           typename TL = Tolerance<typename CM::Value> >
    2710   class ResidualDigraph 
     2731  class ResidualDigraph
    27112732    : public SubDigraph<
    27122733        Undirector<const DGR>,
     
    27652786    ResidualDigraph(const DGR& digraph, const CM& capacity,
    27662787                    FM& flow, const TL& tolerance = Tolerance())
    2767       : Parent(), _capacity(&capacity), _flow(&flow), 
     2788      : Parent(), _capacity(&capacity), _flow(&flow),
    27682789        _graph(digraph), _node_filter(),
    27692790        _forward_filter(capacity, flow, tolerance),
     
    28472868
    28482869      /// Constructor
    2849       ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 
     2870      ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor)
    28502871        : _adaptor(&adaptor) {}
    28512872
     
    33263347  /// in the adaptor.
    33273348  ///
     3349  /// This class provides item counting in the same time as the adapted
     3350  /// digraph structure.
     3351  ///
    33283352  /// \tparam DGR The type of the adapted digraph.
    33293353  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    34243448    /// to get a node map of the split digraph.
    34253449    /// Its value type is inherited from the first node map type (\c IN).
    3426     /// \tparam IN The type of the node map for the in-nodes. 
     3450    /// \tparam IN The type of the node map for the in-nodes.
    34273451    /// \tparam OUT The type of the node map for the out-nodes.
    34283452    template <typename IN, typename OUT>
  • lemon/bfs.h

    r877 r976  
    12521252      }
    12531253      _Visitor& visitor;
     1254      Constraints() {}
    12541255    };
    12551256  };
  • lemon/bfs.h

    r975 r976  
    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).
     
    4848    ///The type of the map that stores the predecessor
    4949    ///arcs of the shortest paths.
    50     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     50    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    5151    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    5252    ///Instantiates a \c PredMap.
     
    6363
    6464    ///The type of the map that indicates which nodes are processed.
    65     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     65    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     66    ///By default, it is a NullMap.
    6667    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    6768    ///Instantiates a \c ProcessedMap.
     
    8283
    8384    ///The type of the map that indicates which nodes are reached.
    84     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     85    ///It must conform to
     86    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    8587    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    8688    ///Instantiates a \c ReachedMap.
     
    9799
    98100    ///The type of the map that stores the distances of the nodes.
    99     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     101    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    100102    typedef typename Digraph::template NodeMap<int> DistMap;
    101103    ///Instantiates a \c DistMap.
     
    121123  ///\tparam GR The type of the digraph the algorithm runs on.
    122124  ///The default type is \ref ListDigraph.
     125  ///\tparam TR The traits class that defines various types used by the
     126  ///algorithm. By default, it is \ref BfsDefaultTraits
     127  ///"BfsDefaultTraits<GR>".
     128  ///In most cases, this parameter should not be set directly,
     129  ///consider to use the named template parameters instead.
    123130#ifdef DOXYGEN
    124131  template <typename GR,
     
    226233    ///\ref named-templ-param "Named parameter" for setting
    227234    ///\c PredMap type.
    228     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     235    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    229236    template <class T>
    230237    struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > {
     
    246253    ///\ref named-templ-param "Named parameter" for setting
    247254    ///\c DistMap type.
    248     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     255    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    249256    template <class T>
    250257    struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > {
     
    266273    ///\ref named-templ-param "Named parameter" for setting
    267274    ///\c ReachedMap type.
    268     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     275    ///It must conform to
     276    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    269277    template <class T>
    270278    struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > {
     
    286294    ///\ref named-templ-param "Named parameter" for setting
    287295    ///\c ProcessedMap type.
    288     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     296    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    289297    template <class T>
    290298    struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > {
     
    414422    ///The simplest way to execute the BFS algorithm is to use one of the
    415423    ///member functions called \ref run(Node) "run()".\n
    416     ///If you need more control on the execution, first you have to call
    417     ///\ref init(), then you can add several source nodes with
     424    ///If you need better control on the execution, you have to call
     425    ///\ref init() first, then you can add several source nodes with
    418426    ///\ref addSource(). Finally the actual path computation can be
    419427    ///performed with one of the \ref start() functions.
     
    701709    ///Runs the algorithm to visit all nodes in the digraph.
    702710
    703     ///This method runs the %BFS algorithm in order to
    704     ///compute the shortest path to each node.
    705     ///
    706     ///The algorithm computes
    707     ///- the shortest path tree (forest),
    708     ///- the distance of each node from the root(s).
     711    ///This method runs the %BFS algorithm in order to visit all nodes
     712    ///in the digraph.
    709713    ///
    710714    ///\note <tt>b.run(s)</tt> is just a shortcut of the following code.
     
    738742    ///@{
    739743
    740     ///The shortest path to a node.
    741 
    742     ///Returns the shortest path to a node.
     744    ///The shortest path to the given node.
     745
     746    ///Returns the shortest path to the given node from the root(s).
    743747    ///
    744748    ///\warning \c t should be reached from the root(s).
     
    748752    Path path(Node t) const { return Path(*G, *_pred, t); }
    749753
    750     ///The distance of a node from the root(s).
    751 
    752     ///Returns the distance of a node from the root(s).
     754    ///The distance of the given node from the root(s).
     755
     756    ///Returns the distance of the given node from the root(s).
    753757    ///
    754758    ///\warning If node \c v is not reached from the root(s), then
     
    759763    int dist(Node v) const { return (*_dist)[v]; }
    760764
    761     ///Returns the 'previous arc' of the shortest path tree for a node.
    762 
     765    ///\brief Returns the 'previous arc' of the shortest path tree for
     766    ///the given node.
     767    ///
    763768    ///This function returns the 'previous arc' of the shortest path
    764769    ///tree for the node \c v, i.e. it returns the last arc of a
     
    767772    ///
    768773    ///The shortest path tree used here is equal to the shortest path
    769     ///tree used in \ref predNode().
     774    ///tree used in \ref predNode() and \ref predMap().
    770775    ///
    771776    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    773778    Arc predArc(Node v) const { return (*_pred)[v];}
    774779
    775     ///Returns the 'previous node' of the shortest path tree for a node.
    776 
     780    ///\brief Returns the 'previous node' of the shortest path tree for
     781    ///the given node.
     782    ///
    777783    ///This function returns the 'previous node' of the shortest path
    778784    ///tree for the node \c v, i.e. it returns the last but one node
    779     ///from a shortest path from a root to \c v. It is \c INVALID
     785    ///of a shortest path from a root to \c v. It is \c INVALID
    780786    ///if \c v is not reached from the root(s) or if \c v is a root.
    781787    ///
    782788    ///The shortest path tree used here is equal to the shortest path
    783     ///tree used in \ref predArc().
     789    ///tree used in \ref predArc() and \ref predMap().
    784790    ///
    785791    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    802808    ///
    803809    ///Returns a const reference to the node map that stores the predecessor
    804     ///arcs, which form the shortest path tree.
     810    ///arcs, which form the shortest path tree (forest).
    805811    ///
    806812    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    808814    const PredMap &predMap() const { return *_pred;}
    809815
    810     ///Checks if a node is reached from the root(s).
     816    ///Checks if the given node is reached from the root(s).
    811817
    812818    ///Returns \c true if \c v is reached from the root(s).
     
    834840    ///The type of the map that stores the predecessor
    835841    ///arcs of the shortest paths.
    836     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     842    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    837843    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    838844    ///Instantiates a PredMap.
     
    849855
    850856    ///The type of the map that indicates which nodes are processed.
    851     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    852     ///By default it is a NullMap.
     857    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     858    ///By default, it is a NullMap.
    853859    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    854860    ///Instantiates a ProcessedMap.
     
    869875
    870876    ///The type of the map that indicates which nodes are reached.
    871     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     877    ///It must conform to
     878    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    872879    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    873880    ///Instantiates a ReachedMap.
     
    884891
    885892    ///The type of the map that stores the distances of the nodes.
    886     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     893    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    887894    typedef typename Digraph::template NodeMap<int> DistMap;
    888895    ///Instantiates a DistMap.
     
    899906
    900907    ///The type of the shortest paths.
    901     ///It must meet the \ref concepts::Path "Path" concept.
     908    ///It must conform to the \ref concepts::Path "Path" concept.
    902909    typedef lemon::Path<Digraph> Path;
    903910  };
     
    905912  /// Default traits class used by BfsWizard
    906913
    907   /// To make it easier to use Bfs algorithm
    908   /// we have created a wizard class.
    909   /// This \ref BfsWizard class needs default traits,
    910   /// as well as the \ref Bfs class.
    911   /// The \ref BfsWizardBase is a class to be the default traits of the
    912   /// \ref BfsWizard class.
     914  /// Default traits class used by BfsWizard.
     915  /// \tparam GR The type of the digraph.
    913916  template<class GR>
    914917  class BfsWizardBase : public BfsWizardDefaultTraits<GR>
     
    938941    /// Constructor.
    939942
    940     /// This constructor does not require parameters, therefore it initiates
     943    /// This constructor does not require parameters, it initiates
    941944    /// all of the attributes to \c 0.
    942945    BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
     
    963966  /// This class should only be used through the \ref bfs() function,
    964967  /// which makes it easier to use the algorithm.
     968  ///
     969  /// \tparam TR The traits class that defines various types used by the
     970  /// algorithm.
    965971  template<class TR>
    966972  class BfsWizard : public TR
     
    968974    typedef TR Base;
    969975
    970     ///The type of the digraph the algorithm runs on.
    971976    typedef typename TR::Digraph Digraph;
    972977
     
    976981    typedef typename Digraph::OutArcIt OutArcIt;
    977982
    978     ///\brief The type of the map that stores the predecessor
    979     ///arcs of the shortest paths.
    980983    typedef typename TR::PredMap PredMap;
    981     ///\brief The type of the map that stores the distances of the nodes.
    982984    typedef typename TR::DistMap DistMap;
    983     ///\brief The type of the map that indicates which nodes are reached.
    984985    typedef typename TR::ReachedMap ReachedMap;
    985     ///\brief The type of the map that indicates which nodes are processed.
    986986    typedef typename TR::ProcessedMap ProcessedMap;
    987     ///The type of the shortest paths
    988987    typedef typename TR::Path Path;
    989988
     
    10551054    ///Runs BFS algorithm to visit all nodes in the digraph.
    10561055
    1057     ///This method runs BFS algorithm in order to compute
    1058     ///the shortest path to each node.
     1056    ///This method runs BFS algorithm in order to visit all nodes
     1057    ///in the digraph.
    10591058    void run()
    10601059    {
     
    10681067      SetPredMapBase(const TR &b) : TR(b) {}
    10691068    };
    1070     ///\brief \ref named-func-param "Named parameter"
    1071     ///for setting PredMap object.
    1072     ///
    1073     ///\ref named-func-param "Named parameter"
    1074     ///for setting PredMap object.
     1069
     1070    ///\brief \ref named-templ-param "Named parameter" for setting
     1071    ///the predecessor map.
     1072    ///
     1073    ///\ref named-templ-param "Named parameter" function for setting
     1074    ///the map that stores the predecessor arcs of the nodes.
    10751075    template<class T>
    10761076    BfsWizard<SetPredMapBase<T> > predMap(const T &t)
     
    10861086      SetReachedMapBase(const TR &b) : TR(b) {}
    10871087    };
    1088     ///\brief \ref named-func-param "Named parameter"
    1089     ///for setting ReachedMap object.
    1090     ///
    1091     /// \ref named-func-param "Named parameter"
    1092     ///for setting ReachedMap object.
     1088
     1089    ///\brief \ref named-templ-param "Named parameter" for setting
     1090    ///the reached map.
     1091    ///
     1092    ///\ref named-templ-param "Named parameter" function for setting
     1093    ///the map that indicates which nodes are reached.
    10931094    template<class T>
    10941095    BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
     
    11041105      SetDistMapBase(const TR &b) : TR(b) {}
    11051106    };
    1106     ///\brief \ref named-func-param "Named parameter"
    1107     ///for setting DistMap object.
    1108     ///
    1109     /// \ref named-func-param "Named parameter"
    1110     ///for setting DistMap object.
     1107
     1108    ///\brief \ref named-templ-param "Named parameter" for setting
     1109    ///the distance map.
     1110    ///
     1111    ///\ref named-templ-param "Named parameter" function for setting
     1112    ///the map that stores the distances of the nodes calculated
     1113    ///by the algorithm.
    11111114    template<class T>
    11121115    BfsWizard<SetDistMapBase<T> > distMap(const T &t)
     
    11221125      SetProcessedMapBase(const TR &b) : TR(b) {}
    11231126    };
    1124     ///\brief \ref named-func-param "Named parameter"
    1125     ///for setting ProcessedMap object.
    1126     ///
    1127     /// \ref named-func-param "Named parameter"
    1128     ///for setting ProcessedMap object.
     1127
     1128    ///\brief \ref named-func-param "Named parameter" for setting
     1129    ///the processed map.
     1130    ///
     1131    ///\ref named-templ-param "Named parameter" function for setting
     1132    ///the map that indicates which nodes are processed.
    11291133    template<class T>
    11301134    BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
     
    12661270    ///
    12671271    /// The type of the map that indicates which nodes are reached.
    1268     /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     1272    /// It must conform to
     1273    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    12691274    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    12701275
     
    13041309  /// does not observe the BFS events. If you want to observe the BFS
    13051310  /// events, you should implement your own visitor class.
    1306   /// \tparam TR Traits class to set various data types used by the
    1307   /// algorithm. The default traits class is
    1308   /// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<GR>".
    1309   /// See \ref BfsVisitDefaultTraits for the documentation of
    1310   /// a BFS visit traits class.
     1311  /// \tparam TR The traits class that defines various types used by the
     1312  /// algorithm. By default, it is \ref BfsVisitDefaultTraits
     1313  /// "BfsVisitDefaultTraits<GR>".
     1314  /// In most cases, this parameter should not be set directly,
     1315  /// consider to use the named template parameters instead.
    13111316#ifdef DOXYGEN
    13121317  template <typename GR, typename VS, typename TR>
     
    14271432    /// The simplest way to execute the BFS algorithm is to use one of the
    14281433    /// member functions called \ref run(Node) "run()".\n
    1429     /// If you need more control on the execution, first you have to call
    1430     /// \ref init(), then you can add several source nodes with
     1434    /// If you need better control on the execution, you have to call
     1435    /// \ref init() first, then you can add several source nodes with
    14311436    /// \ref addSource(). Finally the actual path computation can be
    14321437    /// performed with one of the \ref start() functions.
     
    17001705    /// \brief Runs the algorithm to visit all nodes in the digraph.
    17011706    ///
    1702     /// This method runs the %BFS algorithm in order to
    1703     /// compute the shortest path to each node.
    1704     ///
    1705     /// The algorithm computes
    1706     /// - the shortest path tree (forest),
    1707     /// - the distance of each node from the root(s).
     1707    /// This method runs the %BFS algorithm in order to visit all nodes
     1708    /// in the digraph.
    17081709    ///
    17091710    /// \note <tt>b.run(s)</tt> is just a shortcut of the following code.
     
    17371738    ///@{
    17381739
    1739     /// \brief Checks if a node is reached from the root(s).
     1740    /// \brief Checks if the given node is reached from the root(s).
    17401741    ///
    17411742    /// Returns \c true if \c v is reached from the root(s).
  • lemon/bits/edge_set_extender.h

    r964 r998  
    524524    // Returns the base node of the iterator
    525525    Node baseNode(const IncEdgeIt &e) const {
    526       return e.direction ? u(e) : v(e);
     526      return e.direction ? this->u(e) : this->v(e);
    527527    }
    528528    // Running node of the iterator
     
    530530    // Returns the running node of the iterator
    531531    Node runningNode(const IncEdgeIt &e) const {
    532       return e.direction ? v(e) : u(e);
     532      return e.direction ? this->v(e) : this->u(e);
    533533    }
    534534
  • lemon/bits/edge_set_extender.h

    r997 r998  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    6464    Node oppositeNode(const Node &n, const Arc &e) const {
    6565      if (n == Parent::source(e))
    66         return Parent::target(e);
     66        return Parent::target(e);
    6767      else if(n==Parent::target(e))
    68         return Parent::source(e);
     68        return Parent::source(e);
    6969      else
    70         return INVALID;
     70        return INVALID;
    7171    }
    7272
     
    9292    // Iterable extensions
    9393
    94     class NodeIt : public Node { 
     94    class NodeIt : public Node {
    9595      const Digraph* digraph;
    9696    public:
     
    101101
    102102      explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {
    103         _graph.first(static_cast<Node&>(*this));
    104       }
    105 
    106       NodeIt(const Digraph& _graph, const Node& node) 
    107         : Node(node), digraph(&_graph) {}
    108 
    109       NodeIt& operator++() { 
    110         digraph->next(*this);
    111         return *this;
    112       }
    113 
    114     };
    115 
    116 
    117     class ArcIt : public Arc { 
     103        _graph.first(static_cast<Node&>(*this));
     104      }
     105
     106      NodeIt(const Digraph& _graph, const Node& node)
     107        : Node(node), digraph(&_graph) {}
     108
     109      NodeIt& operator++() {
     110        digraph->next(*this);
     111        return *this;
     112      }
     113
     114    };
     115
     116
     117    class ArcIt : public Arc {
    118118      const Digraph* digraph;
    119119    public:
     
    124124
    125125      explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {
    126         _graph.first(static_cast<Arc&>(*this));
    127       }
    128 
    129       ArcIt(const Digraph& _graph, const Arc& e) : 
    130         Arc(e), digraph(&_graph) { }
    131 
    132       ArcIt& operator++() { 
    133         digraph->next(*this);
    134         return *this;
    135       }
    136 
    137     };
    138 
    139 
    140     class OutArcIt : public Arc { 
     126        _graph.first(static_cast<Arc&>(*this));
     127      }
     128
     129      ArcIt(const Digraph& _graph, const Arc& e) :
     130        Arc(e), digraph(&_graph) { }
     131
     132      ArcIt& operator++() {
     133        digraph->next(*this);
     134        return *this;
     135      }
     136
     137    };
     138
     139
     140    class OutArcIt : public Arc {
    141141      const Digraph* digraph;
    142142    public:
     
    146146      OutArcIt(Invalid i) : Arc(i) { }
    147147
    148       OutArcIt(const Digraph& _graph, const Node& node) 
    149         : digraph(&_graph) {
    150         _graph.firstOut(*this, node);
    151       }
    152 
    153       OutArcIt(const Digraph& _graph, const Arc& arc) 
    154         : Arc(arc), digraph(&_graph) {}
    155 
    156       OutArcIt& operator++() { 
    157         digraph->nextOut(*this);
    158         return *this;
    159       }
    160 
    161     };
    162 
    163 
    164     class InArcIt : public Arc { 
     148      OutArcIt(const Digraph& _graph, const Node& node)
     149        : digraph(&_graph) {
     150        _graph.firstOut(*this, node);
     151      }
     152
     153      OutArcIt(const Digraph& _graph, const Arc& arc)
     154        : Arc(arc), digraph(&_graph) {}
     155
     156      OutArcIt& operator++() {
     157        digraph->nextOut(*this);
     158        return *this;
     159      }
     160
     161    };
     162
     163
     164    class InArcIt : public Arc {
    165165      const Digraph* digraph;
    166166    public:
     
    170170      InArcIt(Invalid i) : Arc(i) { }
    171171
    172       InArcIt(const Digraph& _graph, const Node& node) 
    173         : digraph(&_graph) {
    174         _graph.firstIn(*this, node);
    175       }
    176 
    177       InArcIt(const Digraph& _graph, const Arc& arc) : 
    178         Arc(arc), digraph(&_graph) {}
    179 
    180       InArcIt& operator++() { 
    181         digraph->nextIn(*this);
    182         return *this;
     172      InArcIt(const Digraph& _graph, const Node& node)
     173        : digraph(&_graph) {
     174        _graph.firstIn(*this, node);
     175      }
     176
     177      InArcIt(const Digraph& _graph, const Arc& arc) :
     178        Arc(arc), digraph(&_graph) {}
     179
     180      InArcIt& operator++() {
     181        digraph->nextIn(*this);
     182        return *this;
    183183      }
    184184
     
    216216
    217217    // Mappable extension
    218    
     218
    219219    template <typename _Value>
    220     class ArcMap 
     220    class ArcMap
    221221      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
    222222      typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
    223223
    224224    public:
    225       explicit ArcMap(const Digraph& _g) 
    226         : Parent(_g) {}
    227       ArcMap(const Digraph& _g, const _Value& _v) 
    228         : Parent(_g, _v) {}
     225      explicit ArcMap(const Digraph& _g)
     226        : Parent(_g) {}
     227      ArcMap(const Digraph& _g, const _Value& _v)
     228        : Parent(_g, _v) {}
    229229
    230230      ArcMap& operator=(const ArcMap& cmap) {
    231         return operator=<ArcMap>(cmap);
     231        return operator=<ArcMap>(cmap);
    232232      }
    233233
     
    235235      ArcMap& operator=(const CMap& cmap) {
    236236        Parent::operator=(cmap);
    237         return *this;
     237        return *this;
    238238      }
    239239
     
    248248      return arc;
    249249    }
    250    
     250
    251251    void clear() {
    252252      notifier(Arc()).clear();
     
    313313    Node oppositeNode(const Node &n, const Edge &e) const {
    314314      if( n == Parent::u(e))
    315         return Parent::v(e);
     315        return Parent::v(e);
    316316      else if( n == Parent::v(e))
    317         return Parent::u(e);
     317        return Parent::u(e);
    318318      else
    319         return INVALID;
     319        return INVALID;
    320320    }
    321321
     
    341341
    342342    using Parent::notifier;
    343    
     343
    344344    ArcNotifier& notifier(Arc) const {
    345345      return arc_notifier;
     
    351351
    352352
    353     class NodeIt : public Node { 
     353    class NodeIt : public Node {
    354354      const Graph* graph;
    355355    public:
     
    360360
    361361      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
    362         _graph.first(static_cast<Node&>(*this));
    363       }
    364 
    365       NodeIt(const Graph& _graph, const Node& node) 
    366         : Node(node), graph(&_graph) {}
    367 
    368       NodeIt& operator++() { 
    369         graph->next(*this);
    370         return *this;
    371       }
    372 
    373     };
    374 
    375 
    376     class ArcIt : public Arc { 
     362        _graph.first(static_cast<Node&>(*this));
     363      }
     364
     365      NodeIt(const Graph& _graph, const Node& node)
     366        : Node(node), graph(&_graph) {}
     367
     368      NodeIt& operator++() {
     369        graph->next(*this);
     370        return *this;
     371      }
     372
     373    };
     374
     375
     376    class ArcIt : public Arc {
    377377      const Graph* graph;
    378378    public:
     
    383383
    384384      explicit ArcIt(const Graph& _graph) : graph(&_graph) {
    385         _graph.first(static_cast<Arc&>(*this));
    386       }
    387 
    388       ArcIt(const Graph& _graph, const Arc& e) : 
    389         Arc(e), graph(&_graph) { }
    390 
    391       ArcIt& operator++() { 
    392         graph->next(*this);
    393         return *this;
    394       }
    395 
    396     };
    397 
    398 
    399     class OutArcIt : public Arc { 
     385        _graph.first(static_cast<Arc&>(*this));
     386      }
     387
     388      ArcIt(const Graph& _graph, const Arc& e) :
     389        Arc(e), graph(&_graph) { }
     390
     391      ArcIt& operator++() {
     392        graph->next(*this);
     393        return *this;
     394      }
     395
     396    };
     397
     398
     399    class OutArcIt : public Arc {
    400400      const Graph* graph;
    401401    public:
     
    405405      OutArcIt(Invalid i) : Arc(i) { }
    406406
    407       OutArcIt(const Graph& _graph, const Node& node) 
    408         : graph(&_graph) {
    409         _graph.firstOut(*this, node);
    410       }
    411 
    412       OutArcIt(const Graph& _graph, const Arc& arc) 
    413         : Arc(arc), graph(&_graph) {}
    414 
    415       OutArcIt& operator++() { 
    416         graph->nextOut(*this);
    417         return *this;
    418       }
    419 
    420     };
    421 
    422 
    423     class InArcIt : public Arc { 
     407      OutArcIt(const Graph& _graph, const Node& node)
     408        : graph(&_graph) {
     409        _graph.firstOut(*this, node);
     410      }
     411
     412      OutArcIt(const Graph& _graph, const Arc& arc)
     413        : Arc(arc), graph(&_graph) {}
     414
     415      OutArcIt& operator++() {
     416        graph->nextOut(*this);
     417        return *this;
     418      }
     419
     420    };
     421
     422
     423    class InArcIt : public Arc {
    424424      const Graph* graph;
    425425    public:
     
    429429      InArcIt(Invalid i) : Arc(i) { }
    430430
    431       InArcIt(const Graph& _graph, const Node& node) 
    432         : graph(&_graph) {
    433         _graph.firstIn(*this, node);
    434       }
    435 
    436       InArcIt(const Graph& _graph, const Arc& arc) : 
    437         Arc(arc), graph(&_graph) {}
    438 
    439       InArcIt& operator++() { 
    440         graph->nextIn(*this);
    441         return *this;
    442       }
    443 
    444     };
    445 
    446 
    447     class EdgeIt : public Parent::Edge { 
     431      InArcIt(const Graph& _graph, const Node& node)
     432        : graph(&_graph) {
     433        _graph.firstIn(*this, node);
     434      }
     435
     436      InArcIt(const Graph& _graph, const Arc& arc) :
     437        Arc(arc), graph(&_graph) {}
     438
     439      InArcIt& operator++() {
     440        graph->nextIn(*this);
     441        return *this;
     442      }
     443
     444    };
     445
     446
     447    class EdgeIt : public Parent::Edge {
    448448      const Graph* graph;
    449449    public:
     
    454454
    455455      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
    456         _graph.first(static_cast<Edge&>(*this));
    457       }
    458 
    459       EdgeIt(const Graph& _graph, const Edge& e) : 
    460         Edge(e), graph(&_graph) { }
    461 
    462       EdgeIt& operator++() { 
    463         graph->next(*this);
    464         return *this;
     456        _graph.first(static_cast<Edge&>(*this));
     457      }
     458
     459      EdgeIt(const Graph& _graph, const Edge& e) :
     460        Edge(e), graph(&_graph) { }
     461
     462      EdgeIt& operator++() {
     463        graph->next(*this);
     464        return *this;
    465465      }
    466466
     
    478478
    479479      IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
    480         _graph.firstInc(*this, direction, n);
     480        _graph.firstInc(*this, direction, n);
    481481      }
    482482
    483483      IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n)
    484         : graph(&_graph), Edge(ue) {
    485         direction = (_graph.source(ue) == n);
     484        : graph(&_graph), Edge(ue) {
     485        direction = (_graph.source(ue) == n);
    486486      }
    487487
    488488      IncEdgeIt& operator++() {
    489         graph->nextInc(*this, direction);
    490         return *this;
     489        graph->nextInc(*this, direction);
     490        return *this;
    491491      }
    492492    };
     
    535535
    536536    template <typename _Value>
    537     class ArcMap 
     537    class ArcMap
    538538      : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
    539539      typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
    540540
    541541    public:
    542       explicit ArcMap(const Graph& _g) 
    543         : Parent(_g) {}
    544       ArcMap(const Graph& _g, const _Value& _v) 
    545         : Parent(_g, _v) {}
     542      explicit ArcMap(const Graph& _g)
     543        : Parent(_g) {}
     544      ArcMap(const Graph& _g, const _Value& _v)
     545        : Parent(_g, _v) {}
    546546
    547547      ArcMap& operator=(const ArcMap& cmap) {
    548         return operator=<ArcMap>(cmap);
     548        return operator=<ArcMap>(cmap);
    549549      }
    550550
     
    552552      ArcMap& operator=(const CMap& cmap) {
    553553        Parent::operator=(cmap);
    554         return *this;
     554        return *this;
    555555      }
    556556
     
    559559
    560560    template <typename _Value>
    561     class EdgeMap 
     561    class EdgeMap
    562562      : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
    563563      typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
    564564
    565565    public:
    566       explicit EdgeMap(const Graph& _g) 
    567         : Parent(_g) {}
    568 
    569       EdgeMap(const Graph& _g, const _Value& _v) 
    570         : Parent(_g, _v) {}
     566      explicit EdgeMap(const Graph& _g)
     567        : Parent(_g) {}
     568
     569      EdgeMap(const Graph& _g, const _Value& _v)
     570        : Parent(_g, _v) {}
    571571
    572572      EdgeMap& operator=(const EdgeMap& cmap) {
    573         return operator=<EdgeMap>(cmap);
     573        return operator=<EdgeMap>(cmap);
    574574      }
    575575
     
    577577      EdgeMap& operator=(const CMap& cmap) {
    578578        Parent::operator=(cmap);
    579         return *this;
     579        return *this;
    580580      }
    581581
     
    594594      return edge;
    595595    }
    596    
     596
    597597    void clear() {
    598598      notifier(Arc()).clear();
     
    620620      arc_notifier.clear();
    621621    }
    622    
     622
    623623  };
    624624
  • lemon/bits/graph_extender.h

    r778 r998  
    588588    // Returns the base node of the iterator
    589589    Node baseNode(const IncEdgeIt &edge) const {
    590       return edge._direction ? u(edge) : v(edge);
     590      return edge._direction ? this->u(edge) : this->v(edge);
    591591    }
    592592    // Running node of the iterator
     
    594594    // Returns the running node of the iterator
    595595    Node runningNode(const IncEdgeIt &edge) const {
    596       return edge._direction ? v(edge) : u(edge);
     596      return edge._direction ? this->v(edge) : this->u(edge);
    597597    }
    598598
  • lemon/bits/graph_extender.h

    r997 r998  
    5757    }
    5858
    59     Node fromId(int id, Node) const {
     59    static Node fromId(int id, Node) {
    6060      return Parent::nodeFromId(id);
    6161    }
    6262
    63     Arc fromId(int id, Arc) const {
     63    static Arc fromId(int id, Arc) {
    6464      return Parent::arcFromId(id);
    6565    }
     
    356356    }
    357357
    358     Node fromId(int id, Node) const {
     358    static Node fromId(int id, Node) {
    359359      return Parent::nodeFromId(id);
    360360    }
    361361
    362     Arc fromId(int id, Arc) const {
     362    static Arc fromId(int id, Arc) {
    363363      return Parent::arcFromId(id);
    364364    }
    365365
    366     Edge fromId(int id, Edge) const {
     366    static Edge fromId(int id, Edge) {
    367367      return Parent::edgeFromId(id);
    368368    }
  • lemon/bits/solver_bits.h

    r877 r989  
    4545      void clear() {
    4646        first_item = -1;
     47        last_item = -1;
    4748        first_free_item = -1;
    4849        items.clear();
  • lemon/bits/solver_bits.h

    r988 r989  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
  • lemon/cbc.cc

    r746 r998  
    2626#include <coin/OsiSolverInterface.hpp>
    2727
    28 #ifdef COIN_HAS_CLP
    2928#include "coin/OsiClpSolverInterface.hpp"
    30 #endif
    31 #ifdef COIN_HAS_OSL
    32 #include "coin/OsiOslSolverInterface.hpp"
    33 #endif
    3429
    3530#include "coin/CbcCutGenerator.hpp"
     
    271266      delete _osi_solver;
    272267    }
    273 #ifdef COIN_HAS_CLP
    274268    _osi_solver = new OsiClpSolverInterface();
    275 #elif COIN_HAS_OSL
    276     _osi_solver = new OsiOslSolverInterface();
    277 #else
    278 #error Cannot instantiate Osi solver
    279 #endif
    280269
    281270    _osi_solver->loadFromCoinModel(*_prob);
     
    329318      _cbc_model->addCutGenerator(&flowGen, -1, "FlowCover");
    330319
    331 #ifdef COIN_HAS_CLP
    332320      OsiClpSolverInterface* osiclp =
    333321        dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver());
     
    335323        osiclp->setupForRepeatedUse(2, 0);
    336324      }
    337 #endif
    338325
    339326      CbcRounding heuristic1(*_cbc_model);
     
    449436
    450437    _prob = new CoinModel();
    451     rows.clear();
    452     cols.clear();
    453438  }
    454439
  • lemon/cbc.cc

    r988 r998  
    9090  }
    9191
     92  int CbcMip::_addRow(Value l, ExprIterator b, ExprIterator e, Value u) {
     93    std::vector<int> indexes;
     94    std::vector<Value> values;
     95
     96    for(ExprIterator it = b; it != e; ++it) {
     97      indexes.push_back(it->first);
     98      values.push_back(it->second);
     99    }
     100
     101    _prob->addRow(values.size(), &indexes.front(), &values.front(), l, u);
     102    return _prob->numberRows() - 1;
     103  }
    92104
    93105  void CbcMip::_eraseCol(int i) {
  • lemon/circulation.h

    r877 r998  
    573573
    574574      Node act;
    575       Node bact=INVALID;
    576       Node last_activated=INVALID;
    577575      while((act=_level->highestActive())!=INVALID) {
    578576        int actlevel=(*_level)[act];
  • lemon/circulation.h

    r997 r998  
    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).
     
    6060    /// \brief The type of supply map.
    6161    ///
    62     /// The type of the map that stores the signed supply values of the 
    63     /// nodes. 
     62    /// The type of the map that stores the signed supply values of the
     63    /// nodes.
    6464    /// It must conform to the \ref concepts::ReadMap "ReadMap" concept.
    6565    typedef SM SupplyMap;
     
    7373    /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap"
    7474    /// concept.
     75#ifdef DOXYGEN
     76    typedef GR::ArcMap<Value> FlowMap;
     77#else
    7578    typedef typename Digraph::template ArcMap<Value> FlowMap;
     79#endif
    7680
    7781    /// \brief Instantiates a FlowMap.
     
    8892    /// The elevator type used by the algorithm.
    8993    ///
    90     /// \sa Elevator
    91     /// \sa LinkedElevator
     94    /// \sa Elevator, LinkedElevator
     95#ifdef DOXYGEN
     96    typedef lemon::Elevator<GR, GR::Node> Elevator;
     97#else
    9298    typedef lemon::Elevator<Digraph, typename Digraph::Node> Elevator;
     99#endif
    93100
    94101    /// \brief Instantiates an Elevator.
     
    135142     \geq sup(u) \quad \forall u\in V, \f]
    136143     \f[ lower(uv) \leq f(uv) \leq upper(uv) \quad \forall uv\in A. \f]
    137      
     144
    138145     The sum of the supply values, i.e. \f$\sum_{u\in V} sup(u)\f$ must be
    139146     zero or negative in order to have a feasible solution (since the sum
     
    145152     constraints have to be satisfied with equality, i.e. all demands
    146153     have to be satisfied and all supplies have to be used.
    147      
     154
    148155     If you need the opposite inequalities in the supply/demand constraints
    149156     (i.e. the total demand is less than the total supply and all the demands
     
    167174     \tparam SM The type of the supply map. The default map type is
    168175     \ref concepts::Digraph::NodeMap "GR::NodeMap<UM::Value>".
     176     \tparam TR The traits class that defines various types used by the
     177     algorithm. By default, it is \ref CirculationDefaultTraits
     178     "CirculationDefaultTraits<GR, LM, UM, SM>".
     179     In most cases, this parameter should not be set directly,
     180     consider to use the named template parameters instead.
    169181  */
    170182#ifdef DOXYGEN
     
    300312    /// able to automatically created by the algorithm (i.e. the
    301313    /// digraph and the maximum level should be passed to it).
    302     /// However an external elevator object could also be passed to the
     314    /// However, an external elevator object could also be passed to the
    303315    /// algorithm with the \ref elevator(Elevator&) "elevator()" function
    304316    /// before calling \ref run() or \ref init().
     
    326338    /// \param graph The digraph the algorithm runs on.
    327339    /// \param lower The lower bounds for the flow values on the arcs.
    328     /// \param upper The upper bounds (capacities) for the flow values 
     340    /// \param upper The upper bounds (capacities) for the flow values
    329341    /// on the arcs.
    330342    /// \param supply The signed supply values of the nodes.
     
    451463    }
    452464
    453     /// \brief Sets the tolerance used by algorithm.
    454     ///
    455     /// Sets the tolerance used by algorithm.
     465    /// \brief Sets the tolerance used by the algorithm.
     466    ///
     467    /// Sets the tolerance object used by the algorithm.
     468    /// \return <tt>(*this)</tt>
    456469    Circulation& tolerance(const Tolerance& tolerance) {
    457470      _tol = tolerance;
     
    461474    /// \brief Returns a const reference to the tolerance.
    462475    ///
    463     /// Returns a const reference to the tolerance.
     476    /// Returns a const reference to the tolerance object used by
     477    /// the algorithm.
    464478    const Tolerance& tolerance() const {
    465479      return _tol;
     
    468482    /// \name Execution Control
    469483    /// The simplest way to execute the algorithm is to call \ref run().\n
    470     /// If you need more control on the initial solution or the execution,
    471     /// first you have to call one of the \ref init() functions, then
     484    /// If you need better control on the initial solution or the execution,
     485    /// you have to call one of the \ref init() functions first, then
    472486    /// the \ref start() function.
    473487
  • lemon/clp.cc

    r877 r989  
    438438    delete _prob;
    439439    _prob = new ClpSimplex();
    440     rows.clear();
    441     cols.clear();
    442440    _col_names_ref.clear();
    443441    _clear_temporals();
  • lemon/clp.cc

    r988 r989  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    7676  int ClpLp::_addRow() {
    7777    _prob->addRow(0, 0, 0, -COIN_DBL_MAX, COIN_DBL_MAX);
     78    return _prob->numberRows() - 1;
     79  }
     80
     81  int ClpLp::_addRow(Value l, ExprIterator b, ExprIterator e, Value u) {
     82    std::vector<int> indexes;
     83    std::vector<Value> values;
     84
     85    for(ExprIterator it = b; it != e; ++it) {
     86      indexes.push_back(it->first);
     87      values.push_back(it->second);
     88    }
     89
     90    _prob->addRow(values.size(), &indexes.front(), &values.front(), l, u);
    7891    return _prob->numberRows() - 1;
    7992  }
  • lemon/concepts/graph_components.h

    r877 r998  
    116116        const _GraphItem &ia;
    117117        const _GraphItem &ib;
     118        Constraints() {}
    118119      };
    119120    };
     
    175176
    176177        const _Digraph& digraph;
     178        Constraints() {}
    177179      };
    178180    };
     
    291293
    292294        const _Graph& graph;
     295      Constraints() {}
    293296      };
    294297
     
    370373
    371374        const _Digraph& digraph;
     375        Constraints() {}
    372376      };
    373377    };
     
    422426
    423427        const _Graph& graph;
     428        Constraints() {}
    424429      };
    425430    };
     
    490495          _GraphItemIt it3 = it1;
    491496          _GraphItemIt it4 = INVALID;
     497          ignore_unused_variable_warning(it3);
     498          ignore_unused_variable_warning(it4);
    492499
    493500          it2 = ++it1;
     
    499506        }
    500507        const GR& g;
     508        Constraints() {}
    501509      };
    502510    };
     
    578586          _GraphIncIt it3 = it1;
    579587          _GraphIncIt it4 = INVALID;
     588          ignore_unused_variable_warning(it3);
     589          ignore_unused_variable_warning(it4);
    580590
    581591          it2 = ++it1;
     
    587597        const Base& node;
    588598        const GR& graph;
     599        Constraints() {}
    589600      };
    590601    };
     
    763774
    764775        const _Digraph& digraph;
     776        Constraints() {}
    765777      };
    766778    };
     
    887899
    888900        const _Graph& graph;
     901        Constraints() {}
    889902      };
    890903    };
     
    944957
    945958        const _Digraph& digraph;
     959        Constraints() {}
    946960      };
    947961    };
     
    985999
    9861000        const _Graph& graph;
     1001        Constraints() {}
    9871002      };
    9881003    };
     
    10621077        const GR &g;
    10631078        const typename GraphMap::Value &t;
     1079        Constraints() {}
    10641080      };
    10651081
     
    12001216
    12011217        const _Digraph& digraph;
     1218        Constraints() {}
    12021219      };
    12031220    };
     
    12851302
    12861303        const _Graph& graph;
     1304        Constraints() {}
    12871305      };
    12881306    };
     
    13291347
    13301348        _Digraph& digraph;
     1349        Constraints() {}
    13311350      };
    13321351    };
     
    13731392
    13741393        _Graph& graph;
     1394        Constraints() {}
    13751395      };
    13761396    };
     
    14121432
    14131433        _Digraph& digraph;
     1434        Constraints() {}
    14141435      };
    14151436    };
     
    14511472
    14521473        _Graph& graph;
     1474        Constraints() {}
    14531475      };
    14541476    };
     
    14791501
    14801502        _Digraph& digraph;
     1503        Constraints() {}
    14811504      };
    14821505    };
     
    15071530
    15081531        _Graph& graph;
     1532        Constraints() {}
    15091533      };
    15101534    };
  • lemon/concepts/graph_components.h

    r997 r998  
    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).
     
    1919///\ingroup graph_concepts
    2020///\file
    21 ///\brief The concept of graph components.
     21///\brief The concepts of graph components.
    2222
    2323#ifndef LEMON_CONCEPTS_GRAPH_COMPONENTS_H
     
    3939    /// \note This class is a template class so that we can use it to
    4040    /// create graph skeleton classes. The reason for this is that \c Node
    41     /// and \c Arc (or \c Edge) types should \e not derive from the same 
     41    /// and \c Arc (or \c Edge) types should \e not derive from the same
    4242    /// base class. For \c Node you should instantiate it with character
    4343    /// \c 'n', for \c Arc with \c 'a' and for \c Edge with \c 'e'.
     
    9090      ///
    9191      /// This operator defines an ordering of the items.
    92       /// It makes possible to use graph item types as key types in 
     92      /// It makes possible to use graph item types as key types in
    9393      /// associative containers (e.g. \c std::map).
    9494      ///
    95       /// \note This operator only have to define some strict ordering of
     95      /// \note This operator only has to define some strict ordering of
    9696      /// the items; this order has nothing to do with the iteration
    9797      /// ordering of the items.
     
    124124    /// This class describes the base interface of directed graph types.
    125125    /// All digraph %concepts have to conform to this class.
    126     /// It just provides types for nodes and arcs and functions 
     126    /// It just provides types for nodes and arcs and functions
    127127    /// to get the source and the target nodes of arcs.
    128128    class BaseDigraphComponent {
     
    432432    /// \brief Concept class for \c NodeIt, \c ArcIt and \c EdgeIt types.
    433433    ///
    434     /// This class describes the concept of \c NodeIt, \c ArcIt and 
     434    /// This class describes the concept of \c NodeIt, \c ArcIt and
    435435    /// \c EdgeIt subtypes of digraph and graph types.
    436436    template <typename GR, typename Item>
     
    472472      /// next item.
    473473      GraphItemIt& operator++() { return *this; }
    474  
     474
    475475      /// \brief Equality operator
    476476      ///
     
    510510    };
    511511
    512     /// \brief Concept class for \c InArcIt, \c OutArcIt and 
     512    /// \brief Concept class for \c InArcIt, \c OutArcIt and
    513513    /// \c IncEdgeIt types.
    514514    ///
    515     /// This class describes the concept of \c InArcIt, \c OutArcIt 
     515    /// This class describes the concept of \c InArcIt, \c OutArcIt
    516516    /// and \c IncEdgeIt subtypes of digraph and graph types.
    517517    ///
    518518    /// \note Since these iterator classes do not inherit from the same
    519519    /// base class, there is an additional template parameter (selector)
    520     /// \c sel. For \c InArcIt you should instantiate it with character 
     520    /// \c sel. For \c InArcIt you should instantiate it with character
    521521    /// \c 'i', for \c OutArcIt with \c 'o' and for \c IncEdgeIt with \c 'e'.
    522522    template <typename GR,
     
    539539      GraphIncIt(const GraphIncIt& it) : Item(it) {}
    540540
    541       /// \brief Constructor that sets the iterator to the first 
     541      /// \brief Constructor that sets the iterator to the first
    542542      /// incoming or outgoing arc.
    543543      ///
    544       /// Constructor that sets the iterator to the first arc 
     544      /// Constructor that sets the iterator to the first arc
    545545      /// incoming to or outgoing from the given node.
    546546      explicit GraphIncIt(const GR&, const Base&) {}
     
    817817      /// \brief Return the first edge incident to the given node.
    818818      ///
    819       /// This function gives back the first edge incident to the given 
     819      /// This function gives back the first edge incident to the given
    820820      /// node. The bool parameter gives back the direction for which the
    821       /// source node of the directed arc representing the edge is the 
     821      /// source node of the directed arc representing the edge is the
    822822      /// given node.
    823823      void firstInc(Edge&, bool&, const Node&) const {}
     
    826826      /// given node.
    827827      ///
    828       /// This function gives back the next edge incident to the given 
     828      /// This function gives back the next edge incident to the given
    829829      /// node. The bool parameter should be used as \c firstInc() use it.
    830830      void nextInc(Edge&, bool&) const {}
     
    10061006    ///
    10071007    /// This class describes the concept of standard graph maps, i.e.
    1008     /// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and 
     1008    /// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and
    10091009    /// graph types, which can be used for associating data to graph items.
    10101010    /// The standard graph maps must conform to the ReferenceMap concept.
     
    10611061          _Map m1(g);
    10621062          _Map m2(g,t);
    1063          
     1063
    10641064          // Copy constructor
    10651065          // _Map m3(m);
     
    10851085    ///
    10861086    /// This class describes the interface of mappable directed graphs.
    1087     /// It extends \ref BaseDigraphComponent with the standard digraph 
     1087    /// It extends \ref BaseDigraphComponent with the standard digraph
    10881088    /// map classes, namely \c NodeMap and \c ArcMap.
    10891089    /// This concept is part of the Digraph concept.
     
    12231223    ///
    12241224    /// This class describes the interface of mappable undirected graphs.
    1225     /// It extends \ref MappableDigraphComponent with the standard graph 
     1225    /// It extends \ref MappableDigraphComponent with the standard graph
    12261226    /// map class for edges (\c EdgeMap).
    12271227    /// This concept is part of the Graph concept.
     
    13091309    ///
    13101310    /// This class describes the interface of extendable directed graphs.
    1311     /// It extends \ref BaseDigraphComponent with functions for adding 
     1311    /// It extends \ref BaseDigraphComponent with functions for adding
    13121312    /// nodes and arcs to the digraph.
    13131313    /// This concept requires \ref AlterableDigraphComponent.
     
    13541354    ///
    13551355    /// This class describes the interface of extendable undirected graphs.
    1356     /// It extends \ref BaseGraphComponent with functions for adding 
     1356    /// It extends \ref BaseGraphComponent with functions for adding
    13571357    /// nodes and edges to the graph.
    13581358    /// This concept requires \ref AlterableGraphComponent.
     
    13991399    ///
    14001400    /// This class describes the interface of erasable directed graphs.
    1401     /// It extends \ref BaseDigraphComponent with functions for removing 
     1401    /// It extends \ref BaseDigraphComponent with functions for removing
    14021402    /// nodes and arcs from the digraph.
    14031403    /// This concept requires \ref AlterableDigraphComponent.
     
    14121412      /// \brief Erase a node from the digraph.
    14131413      ///
    1414       /// This function erases the given node from the digraph and all arcs 
     1414      /// This function erases the given node from the digraph and all arcs
    14151415      /// connected to the node.
    14161416      void erase(const Node&) {}
     
    14391439    ///
    14401440    /// This class describes the interface of erasable undirected graphs.
    1441     /// It extends \ref BaseGraphComponent with functions for removing 
     1441    /// It extends \ref BaseGraphComponent with functions for removing
    14421442    /// nodes and edges from the graph.
    14431443    /// This concept requires \ref AlterableGraphComponent.
  • lemon/concepts/heap.h

    r877 r976  
    315315        _Heap& heap;
    316316        ItemIntMap& map;
     317        Constraints() {}
    317318      };
    318319    };
  • lemon/concepts/heap.h

    r975 r976  
    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).
     
    1717 */
    1818
     19#ifndef LEMON_CONCEPTS_HEAP_H
     20#define LEMON_CONCEPTS_HEAP_H
     21
    1922///\ingroup concept
    2023///\file
    2124///\brief The concept of heaps.
    2225
    23 #ifndef LEMON_CONCEPTS_HEAP_H
    24 #define LEMON_CONCEPTS_HEAP_H
    25 
    2626#include <lemon/core.h>
    2727#include <lemon/concept_check.h>
     
    3636    /// \brief The heap concept.
    3737    ///
    38     /// Concept class describing the main interface of heaps. A \e heap
    39     /// is a data structure for storing items with specified values called
    40     /// \e priorities in such a way that finding the item with minimum
    41     /// priority is efficient. In a heap one can change the priority of an
    42     /// item, add or erase an item, etc.
     38    /// This concept class describes the main interface of heaps.
     39    /// The various \ref heaps "heap structures" are efficient
     40    /// implementations of the abstract data type \e priority \e queue.
     41    /// They store items with specified values called \e priorities
     42    /// in such a way that finding and removing the item with minimum
     43    /// priority are efficient. The basic operations are adding and
     44    /// erasing items, changing the priority of an item, etc.
    4345    ///
    44     /// \tparam PR Type of the priority of the items.
    45     /// \tparam IM A read and writable item map with int values, used
     46    /// Heaps are crucial in several algorithms, such as Dijkstra and Prim.
     47    /// Any class that conforms to this concept can be used easily in such
     48    /// algorithms.
     49    ///
     50    /// \tparam PR Type of the priorities of the items.
     51    /// \tparam IM A read-writable item map with \c int values, used
    4652    /// internally to handle the cross references.
    47     /// \tparam Comp A functor class for the ordering of the priorities.
     53    /// \tparam CMP A functor class for comparing the priorities.
    4854    /// The default is \c std::less<PR>.
    4955#ifdef DOXYGEN
    50     template <typename PR, typename IM, typename Comp = std::less<PR> >
    51 #else
    52     template <typename PR, typename IM>
     56    template <typename PR, typename IM, typename CMP>
     57#else
     58    template <typename PR, typename IM, typename CMP = std::less<PR> >
    5359#endif
    5460    class Heap {
     
    6571      ///
    6672      /// Each item has a state associated to it. It can be "in heap",
    67       /// "pre heap" or "post heap". The later two are indifferent
    68       /// from the point of view of the heap, but may be useful for
    69       /// the user.
     73      /// "pre-heap" or "post-heap". The latter two are indifferent from the
     74      /// heap's point of view, but may be useful to the user.
    7075      ///
    7176      /// The item-int map must be initialized in such way that it assigns
     
    7378      enum State {
    7479        IN_HEAP = 0,    ///< = 0. The "in heap" state constant.
    75         PRE_HEAP = -1,  ///< = -1. The "pre heap" state constant.
    76         POST_HEAP = -2  ///< = -2. The "post heap" state constant.
     80        PRE_HEAP = -1,  ///< = -1. The "pre-heap" state constant.
     81        POST_HEAP = -2  ///< = -2. The "post-heap" state constant.
    7782      };
    7883
    79       /// \brief The constructor.
    80       ///
    81       /// The constructor.
     84      /// \brief Constructor.
     85      ///
     86      /// Constructor.
    8287      /// \param map A map that assigns \c int values to keys of type
    8388      /// \c Item. It is used internally by the heap implementations to
    8489      /// handle the cross references. The assigned value must be
    85       /// \c PRE_HEAP (<tt>-1</tt>) for every item.
     90      /// \c PRE_HEAP (<tt>-1</tt>) for each item.
     91#ifdef DOXYGEN
    8692      explicit Heap(ItemIntMap &map) {}
     93#else
     94      explicit Heap(ItemIntMap&) {}
     95#endif
     96
     97      /// \brief Constructor.
     98      ///
     99      /// Constructor.
     100      /// \param map A map that assigns \c int values to keys of type
     101      /// \c Item. It is used internally by the heap implementations to
     102      /// handle the cross references. The assigned value must be
     103      /// \c PRE_HEAP (<tt>-1</tt>) for each item.
     104      /// \param comp The function object used for comparing the priorities.
     105#ifdef DOXYGEN
     106      explicit Heap(ItemIntMap &map, const CMP &comp) {}
     107#else
     108      explicit Heap(ItemIntMap&, const CMP&) {}
     109#endif
    87110
    88111      /// \brief The number of items stored in the heap.
    89112      ///
    90       /// Returns the number of items stored in the heap.
     113      /// This function returns the number of items stored in the heap.
    91114      int size() const { return 0; }
    92115
    93       /// \brief Checks if the heap is empty.
    94       ///
    95       /// Returns \c true if the heap is empty.
     116      /// \brief Check if the heap is empty.
     117      ///
     118      /// This function returns \c true if the heap is empty.
    96119      bool empty() const { return false; }
    97120
    98       /// \brief Makes the heap empty.
    99       ///
    100       /// Makes the heap empty.
    101       void clear();
    102 
    103       /// \brief Inserts an item into the heap with the given priority.
    104       ///
    105       /// Inserts the given item into the heap with the given priority.
     121      /// \brief Make the heap empty.
     122      ///
     123      /// This functon makes the heap empty.
     124      /// It does not change the cross reference map. If you want to reuse
     125      /// a heap that is not surely empty, you should first clear it and
     126      /// then you should set the cross reference map to \c PRE_HEAP
     127      /// for each item.
     128      void clear() {}
     129
     130      /// \brief Insert an item into the heap with the given priority.
     131      ///
     132      /// This function inserts the given item into the heap with the
     133      /// given priority.
    106134      /// \param i The item to insert.
    107135      /// \param p The priority of the item.
     136      /// \pre \e i must not be stored in the heap.
     137#ifdef DOXYGEN
    108138      void push(const Item &i, const Prio &p) {}
    109 
    110       /// \brief Returns the item having minimum priority.
    111       ///
    112       /// Returns the item having minimum priority.
     139#else
     140      void push(const Item&, const Prio&) {}
     141#endif
     142
     143      /// \brief Return the item having minimum priority.
     144      ///
     145      /// This function returns the item having minimum priority.
    113146      /// \pre The heap must be non-empty.
    114       Item top() const {}
     147      Item top() const { return Item(); }
    115148
    116149      /// \brief The minimum priority.
    117150      ///
    118       /// Returns the minimum priority.
     151      /// This function returns the minimum priority.
    119152      /// \pre The heap must be non-empty.
    120       Prio prio() const {}
    121 
    122       /// \brief Removes the item having minimum priority.
    123       ///
    124       /// Removes the item having minimum priority.
     153      Prio prio() const { return Prio(); }
     154
     155      /// \brief Remove the item having minimum priority.
     156      ///
     157      /// This function removes the item having minimum priority.
    125158      /// \pre The heap must be non-empty.
    126159      void pop() {}
    127160
    128       /// \brief Removes an item from the heap.
    129       ///
    130       /// Removes the given item from the heap if it is already stored.
     161      /// \brief Remove the given item from the heap.
     162      ///
     163      /// This function removes the given item from the heap if it is
     164      /// already stored.
    131165      /// \param i The item to delete.
     166      /// \pre \e i must be in the heap.
     167#ifdef DOXYGEN
    132168      void erase(const Item &i) {}
    133 
    134       /// \brief The priority of an item.
    135       ///
    136       /// Returns the priority of the given item.
    137       /// \param i The item.
    138       /// \pre \c i must be in the heap.
     169#else
     170      void erase(const Item&) {}
     171#endif
     172
     173      /// \brief The priority of the given item.
     174      ///
     175      /// This function returns the priority of the given item.
     176      /// \param i The item.
     177      /// \pre \e i must be in the heap.
     178#ifdef DOXYGEN
    139179      Prio operator[](const Item &i) const {}
    140 
    141       /// \brief Sets the priority of an item or inserts it, if it is
     180#else
     181      Prio operator[](const Item&) const { return Prio(); }
     182#endif
     183
     184      /// \brief Set the priority of an item or insert it, if it is
    142185      /// not stored in the heap.
    143186      ///
    144187      /// This method sets the priority of the given item if it is
    145       /// already stored in the heap.
    146       /// Otherwise it inserts the given item with the given priority.
     188      /// already stored in the heap. Otherwise it inserts the given
     189      /// item into the heap with the given priority.
    147190      ///
    148191      /// \param i The item.
    149192      /// \param p The priority.
     193#ifdef DOXYGEN
    150194      void set(const Item &i, const Prio &p) {}
    151 
    152       /// \brief Decreases the priority of an item to the given value.
    153       ///
    154       /// Decreases the priority of an item to the given value.
     195#else
     196      void set(const Item&, const Prio&) {}
     197#endif
     198
     199      /// \brief Decrease the priority of an item to the given value.
     200      ///
     201      /// This function decreases the priority of an item to the given value.
    155202      /// \param i The item.
    156203      /// \param p The priority.
    157       /// \pre \c i must be stored in the heap with priority at least \c p.
     204      /// \pre \e i must be stored in the heap with priority at least \e p.
     205#ifdef DOXYGEN
    158206      void decrease(const Item &i, const Prio &p) {}
    159 
    160       /// \brief Increases the priority of an item to the given value.
    161       ///
    162       /// Increases the priority of an item to the given value.
     207#else
     208      void decrease(const Item&, const Prio&) {}
     209#endif
     210
     211      /// \brief Increase the priority of an item to the given value.
     212      ///
     213      /// This function increases the priority of an item to the given value.
    163214      /// \param i The item.
    164215      /// \param p The priority.
    165       /// \pre \c i must be stored in the heap with priority at most \c p.
     216      /// \pre \e i must be stored in the heap with priority at most \e p.
     217#ifdef DOXYGEN
    166218      void increase(const Item &i, const Prio &p) {}
    167 
    168       /// \brief Returns if an item is in, has already been in, or has
    169       /// never been in the heap.
     219#else
     220      void increase(const Item&, const Prio&) {}
     221#endif
     222
     223      /// \brief Return the state of an item.
    170224      ///
    171225      /// This method returns \c PRE_HEAP if the given item has never
     
    175229      /// to the heap again.
    176230      /// \param i The item.
     231#ifdef DOXYGEN
    177232      State state(const Item &i) const {}
    178 
    179       /// \brief Sets the state of an item in the heap.
    180       ///
    181       /// Sets the state of the given item in the heap. It can be used
    182       /// to manually clear the heap when it is important to achive the
    183       /// better time complexity.
     233#else
     234      State state(const Item&) const { return PRE_HEAP; }
     235#endif
     236
     237      /// \brief Set the state of an item in the heap.
     238      ///
     239      /// This function sets the state of the given item in the heap.
     240      /// It can be used to manually clear the heap when it is important
     241      /// to achive better time complexity.
    184242      /// \param i The item.
    185243      /// \param st The state. It should not be \c IN_HEAP.
     244#ifdef DOXYGEN
    186245      void state(const Item& i, State st) {}
     246#else
     247      void state(const Item&, State) {}
     248#endif
    187249
    188250
  • lemon/concepts/path.h

    r785 r976  
    169169        }
    170170        _Path& p;
     171        PathDumperConstraints() {}
    171172      };
    172173
     
    194195        }
    195196        _Path& p;
     197        PathDumperConstraints() {}
    196198      };
    197199
  • lemon/concepts/path.h

    r975 r976  
    1919///\ingroup concept
    2020///\file
    21 ///\brief Classes for representing paths in digraphs.
     21///\brief The concept of paths
    2222///
    2323
     
    3939    /// A skeleton structure for representing directed paths in a
    4040    /// digraph.
     41    /// In a sense, a path can be treated as a list of arcs.
     42    /// LEMON path types just store this list. As a consequence, they cannot
     43    /// enumerate the nodes on the path directly and a zero length path
     44    /// cannot store its source node.
     45    ///
     46    /// The arcs of a path should be stored in the order of their directions,
     47    /// i.e. the target node of each arc should be the same as the source
     48    /// node of the next arc. This consistency could be checked using
     49    /// \ref checkPath().
     50    /// The source and target nodes of a (consistent) path can be obtained
     51    /// using \ref pathSource() and \ref pathTarget().
     52    ///
     53    /// A path can be constructed from another path of any type using the
     54    /// copy constructor or the assignment operator.
     55    ///
    4156    /// \tparam GR The digraph type in which the path is.
    42     ///
    43     /// In a sense, the path can be treated as a list of arcs. The
    44     /// lemon path type stores just this list. As a consequence it
    45     /// cannot enumerate the nodes in the path and the zero length
    46     /// paths cannot store the source.
    47     ///
    4857    template <typename GR>
    4958    class Path {
     
    6069      Path() {}
    6170
    62       /// \brief Template constructor
     71      /// \brief Template copy constructor
    6372      template <typename CPath>
    6473      Path(const CPath& cpath) {}
    6574
    66       /// \brief Template assigment
     75      /// \brief Template assigment operator
    6776      template <typename CPath>
    6877      Path& operator=(const CPath& cpath) {
     
    7180      }
    7281
    73       /// Length of the path ie. the number of arcs in the path.
     82      /// Length of the path, i.e. the number of arcs on the path.
    7483      int length() const { return 0;}
    7584
     
    8089      void clear() {}
    8190
    82       /// \brief LEMON style iterator for path arcs
     91      /// \brief LEMON style iterator for enumerating the arcs of a path.
    8392      ///
    84       /// This class is used to iterate on the arcs of the paths.
     93      /// LEMON style iterator class for enumerating the arcs of a path.
    8594      class ArcIt {
    8695      public:
     
    8998        /// Invalid constructor
    9099        ArcIt(Invalid) {}
    91         /// Constructor for first arc
     100        /// Sets the iterator to the first arc of the given path
    92101        ArcIt(const Path &) {}
    93102
    94         /// Conversion to Arc
     103        /// Conversion to \c Arc
    95104        operator Arc() const { return INVALID; }
    96105
     
    195204    ///
    196205    /// A skeleton structure for path dumpers. The path dumpers are
    197     /// the generalization of the paths. The path dumpers can
    198     /// enumerate the arcs of the path wheter in forward or in
    199     /// backward order.  In most time these classes are not used
    200     /// directly rather it used to assign a dumped class to a real
    201     /// path type.
     206    /// the generalization of the paths, they can enumerate the arcs
     207    /// of the path either in forward or in backward order.
     208    /// These classes are typically not used directly, they are rather
     209    /// used to be assigned to a real path type.
    202210    ///
    203211    /// The main purpose of this concept is that the shortest path
    204     /// algorithms can enumerate easily the arcs in reverse order.
    205     /// If we would like to give back a real path from these
    206     /// algorithms then we should create a temporarly path object. In
    207     /// LEMON such algorithms gives back a path dumper what can
    208     /// assigned to a real path and the dumpers can be implemented as
     212    /// algorithms can enumerate the arcs easily in reverse order.
     213    /// In LEMON, such algorithms give back a (reverse) path dumper that
     214    /// can be assigned to a real path. The dumpers can be implemented as
    209215    /// an adaptor class to the predecessor map.
    210216    ///
    211217    /// \tparam GR The digraph type in which the path is.
    212     ///
    213     /// The paths can be constructed from any path type by a
    214     /// template constructor or a template assignment operator.
    215218    template <typename GR>
    216219    class PathDumper {
     
    222225      typedef typename Digraph::Arc Arc;
    223226
    224       /// Length of the path ie. the number of arcs in the path.
     227      /// Length of the path, i.e. the number of arcs on the path.
    225228      int length() const { return 0;}
    226229
     
    230233      /// \brief Forward or reverse dumping
    231234      ///
    232       /// If the RevPathTag is defined and true then reverse dumping
    233       /// is provided in the path dumper. In this case instead of the
    234       /// ArcIt the RevArcIt iterator should be implemented in the
    235       /// dumper.
     235      /// If this tag is defined to be \c True, then reverse dumping
     236      /// is provided in the path dumper. In this case, \c RevArcIt
     237      /// iterator should be implemented instead of \c ArcIt iterator.
    236238      typedef False RevPathTag;
    237239
    238       /// \brief LEMON style iterator for path arcs
     240      /// \brief LEMON style iterator for enumerating the arcs of a path.
    239241      ///
    240       /// This class is used to iterate on the arcs of the paths.
     242      /// LEMON style iterator class for enumerating the arcs of a path.
    241243      class ArcIt {
    242244      public:
     
    245247        /// Invalid constructor
    246248        ArcIt(Invalid) {}
    247         /// Constructor for first arc
     249        /// Sets the iterator to the first arc of the given path
    248250        ArcIt(const PathDumper&) {}
    249251
    250         /// Conversion to Arc
     252        /// Conversion to \c Arc
    251253        operator Arc() const { return INVALID; }
    252254
     
    263265      };
    264266
    265       /// \brief LEMON style iterator for path arcs
     267      /// \brief LEMON style iterator for enumerating the arcs of a path
     268      /// in reverse direction.
    266269      ///
    267       /// This class is used to iterate on the arcs of the paths in
    268       /// reverse direction.
     270      /// LEMON style iterator class for enumerating the arcs of a path
     271      /// in reverse direction.
    269272      class RevArcIt {
    270273      public:
     
    273276        /// Invalid constructor
    274277        RevArcIt(Invalid) {}
    275         /// Constructor for first arc
     278        /// Sets the iterator to the last arc of the given path
    276279        RevArcIt(const PathDumper &) {}
    277280
    278         /// Conversion to Arc
     281        /// Conversion to \c Arc
    279282        operator Arc() const { return INVALID; }
    280283
  • lemon/core.h

    r964 r998  
    18501850    ///a single node \c n, then \ref refresh(Node) "refresh(n)" is enough.
    18511851    ///
    1852 #ifdef DOXYGEN
    1853     Arc operator()(Node s, Node t, Arc prev=INVALID) const {}
    1854 #else
    1855     using ArcLookUp<GR>::operator() ;
    1856     Arc operator()(Node s, Node t, Arc prev) const
     1852    Arc operator()(Node s, Node t, Arc prev=INVALID) const
    18571853    {
    1858       return prev==INVALID?(*this)(s,t):_next[prev];
    1859     }
     1854      if(prev==INVALID)
     1855        {
     1856          Arc f=INVALID;
     1857          Arc e;
     1858          for(e=_head[s];
     1859              e!=INVALID&&_g.target(e)!=t;
     1860              e = t < _g.target(e)?_left[e]:_right[e]) ;
     1861          while(e!=INVALID)
     1862            if(_g.target(e)==t)
     1863              {
     1864                f = e;
     1865                e = _left[e];
     1866              }
     1867            else e = _right[e];
     1868          return f;
     1869        }
     1870      else return _next[prev];
     1871    }
     1872
     1873  };
     1874
     1875  /// @}
     1876
     1877} //namespace lemon
     1878
    18601879#endif
    1861 
    1862   };
    1863 
    1864   /// @}
    1865 
    1866 } //namespace lemon
    1867 
    1868 #endif
  • lemon/core.h

    r993 r998  
    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).
     
    12421242  protected:
    12431243
    1244     class AutoNodeMap : public ItemSetTraits<GR, Node>::template Map<Arc>::Type {
     1244    class AutoNodeMap : public ItemSetTraits<GR, Node>::template Map<Arc>::Type
     1245    {
    12451246      typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent;
    12461247
     
    12811282    };
    12821283
    1283   protected: 
     1284  protected:
    12841285
    12851286    const Digraph &_g;
  • lemon/cplex.cc

    r877 r989  
    471471    int status;
    472472    _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
    473     rows.clear();
    474     cols.clear();
    475473  }
    476474
  • lemon/cplex.cc

    r988 r989  
    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).
     
    112112  }
    113113
     114  int CplexBase::_addRow(Value lb, ExprIterator b,
     115                         ExprIterator e, Value ub) {
     116    int i = CPXgetnumrows(cplexEnv(), _prob);
     117    if (lb == -INF) {
     118      const char s = 'L';
     119      CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
     120    } else if (ub == INF) {
     121      const char s = 'G';
     122      CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
     123    } else if (lb == ub){
     124      const char s = 'E';
     125      CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
     126    } else {
     127      const char s = 'R';
     128      double len = ub - lb;
     129      CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, &len, 0);
     130    }
     131
     132    std::vector<int> indices;
     133    std::vector<int> rowlist;
     134    std::vector<Value> values;
     135
     136    for(ExprIterator it=b; it!=e; ++it) {
     137      indices.push_back(it->first);
     138      values.push_back(it->second);
     139      rowlist.push_back(i);
     140    }
     141
     142    CPXchgcoeflist(cplexEnv(), _prob, values.size(),
     143                   &rowlist.front(), &indices.front(), &values.front());
     144
     145    return i;
     146  }
    114147
    115148  void CplexBase::_eraseCol(int i) {
     
    455488
    456489  void CplexBase::_applyMessageLevel() {
    457     CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND, 
     490    CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND,
    458491                   _message_enabled ? CPX_ON : CPX_OFF);
    459492  }
  • lemon/dfs.h

    r964 r998  
    11941194      }
    11951195      _Visitor& visitor;
     1196      Constraints() {}
    11961197    };
    11971198  };
  • lemon/dfs.h

    r975 r998  
    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).
     
    4848    ///The type of the map that stores the predecessor
    4949    ///arcs of the %DFS paths.
    50     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     50    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    5151    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    5252    ///Instantiates a \c PredMap.
     
    6363
    6464    ///The type of the map that indicates which nodes are processed.
    65     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     65    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     66    ///By default, it is a NullMap.
    6667    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    6768    ///Instantiates a \c ProcessedMap.
     
    8283
    8384    ///The type of the map that indicates which nodes are reached.
    84     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     85    ///It must conform to
     86    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    8587    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    8688    ///Instantiates a \c ReachedMap.
     
    9799
    98100    ///The type of the map that stores the distances of the nodes.
    99     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     101    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    100102    typedef typename Digraph::template NodeMap<int> DistMap;
    101103    ///Instantiates a \c DistMap.
     
    121123  ///\tparam GR The type of the digraph the algorithm runs on.
    122124  ///The default type is \ref ListDigraph.
     125  ///\tparam TR The traits class that defines various types used by the
     126  ///algorithm. By default, it is \ref DfsDefaultTraits
     127  ///"DfsDefaultTraits<GR>".
     128  ///In most cases, this parameter should not be set directly,
     129  ///consider to use the named template parameters instead.
    123130#ifdef DOXYGEN
    124131  template <typename GR,
     
    225232    ///\ref named-templ-param "Named parameter" for setting
    226233    ///\c PredMap type.
    227     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     234    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    228235    template <class T>
    229236    struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > {
     
    245252    ///\ref named-templ-param "Named parameter" for setting
    246253    ///\c DistMap type.
    247     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     254    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    248255    template <class T>
    249256    struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > {
     
    265272    ///\ref named-templ-param "Named parameter" for setting
    266273    ///\c ReachedMap type.
    267     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     274    ///It must conform to
     275    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    268276    template <class T>
    269277    struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > {
     
    285293    ///\ref named-templ-param "Named parameter" for setting
    286294    ///\c ProcessedMap type.
    287     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     295    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    288296    template <class T>
    289297    struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > {
     
    412420    ///The simplest way to execute the DFS algorithm is to use one of the
    413421    ///member functions called \ref run(Node) "run()".\n
    414     ///If you need more control on the execution, first you have to call
    415     ///\ref init(), then you can add a source node with \ref addSource()
     422    ///If you need better control on the execution, you have to call
     423    ///\ref init() first, then you can add a source node with \ref addSource()
    416424    ///and perform the actual computation with \ref start().
    417425    ///This procedure can be repeated if there are nodes that have not
     
    633641    ///Runs the algorithm to visit all nodes in the digraph.
    634642
    635     ///This method runs the %DFS algorithm in order to compute the
    636     ///%DFS path to each node.
    637     ///
    638     ///The algorithm computes
    639     ///- the %DFS tree (forest),
    640     ///- the distance of each node from the root(s) in the %DFS tree.
     643    ///This method runs the %DFS algorithm in order to visit all nodes
     644    ///in the digraph.
    641645    ///
    642646    ///\note <tt>d.run()</tt> is just a shortcut of the following code.
     
    670674    ///@{
    671675
    672     ///The DFS path to a node.
    673 
    674     ///Returns the DFS path to a node.
     676    ///The DFS path to the given node.
     677
     678    ///Returns the DFS path to the given node from the root(s).
    675679    ///
    676680    ///\warning \c t should be reached from the root(s).
     
    680684    Path path(Node t) const { return Path(*G, *_pred, t); }
    681685
    682     ///The distance of a node from the root(s).
    683 
    684     ///Returns the distance of a node from the root(s).
     686    ///The distance of the given node from the root(s).
     687
     688    ///Returns the distance of the given node from the root(s).
    685689    ///
    686690    ///\warning If node \c v is not reached from the root(s), then
     
    691695    int dist(Node v) const { return (*_dist)[v]; }
    692696
    693     ///Returns the 'previous arc' of the %DFS tree for a node.
     697    ///Returns the 'previous arc' of the %DFS tree for the given node.
    694698
    695699    ///This function returns the 'previous arc' of the %DFS tree for the
     
    699703    ///
    700704    ///The %DFS tree used here is equal to the %DFS tree used in
    701     ///\ref predNode().
     705    ///\ref predNode() and \ref predMap().
    702706    ///
    703707    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    705709    Arc predArc(Node v) const { return (*_pred)[v];}
    706710
    707     ///Returns the 'previous node' of the %DFS tree.
     711    ///Returns the 'previous node' of the %DFS tree for the given node.
    708712
    709713    ///This function returns the 'previous node' of the %DFS
    710714    ///tree for the node \c v, i.e. it returns the last but one node
    711     ///from a %DFS path from a root to \c v. It is \c INVALID
     715    ///of a %DFS path from a root to \c v. It is \c INVALID
    712716    ///if \c v is not reached from the root(s) or if \c v is a root.
    713717    ///
    714718    ///The %DFS tree used here is equal to the %DFS tree used in
    715     ///\ref predArc().
     719    ///\ref predArc() and \ref predMap().
    716720    ///
    717721    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    734738    ///
    735739    ///Returns a const reference to the node map that stores the predecessor
    736     ///arcs, which form the DFS tree.
     740    ///arcs, which form the DFS tree (forest).
    737741    ///
    738742    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    740744    const PredMap &predMap() const { return *_pred;}
    741745
    742     ///Checks if a node is reached from the root(s).
     746    ///Checks if the given node. node is reached from the root(s).
    743747
    744748    ///Returns \c true if \c v is reached from the root(s).
     
    766770    ///The type of the map that stores the predecessor
    767771    ///arcs of the %DFS paths.
    768     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     772    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    769773    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    770774    ///Instantiates a PredMap.
     
    781785
    782786    ///The type of the map that indicates which nodes are processed.
    783     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    784     ///By default it is a NullMap.
     787    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     788    ///By default, it is a NullMap.
    785789    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    786790    ///Instantiates a ProcessedMap.
     
    801805
    802806    ///The type of the map that indicates which nodes are reached.
    803     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     807    ///It must conform to
     808    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    804809    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    805810    ///Instantiates a ReachedMap.
     
    816821
    817822    ///The type of the map that stores the distances of the nodes.
    818     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     823    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    819824    typedef typename Digraph::template NodeMap<int> DistMap;
    820825    ///Instantiates a DistMap.
     
    831836
    832837    ///The type of the DFS paths.
    833     ///It must meet the \ref concepts::Path "Path" concept.
     838    ///It must conform to the \ref concepts::Path "Path" concept.
    834839    typedef lemon::Path<Digraph> Path;
    835840  };
     
    837842  /// Default traits class used by DfsWizard
    838843
    839   /// To make it easier to use Dfs algorithm
    840   /// we have created a wizard class.
    841   /// This \ref DfsWizard class needs default traits,
    842   /// as well as the \ref Dfs class.
    843   /// The \ref DfsWizardBase is a class to be the default traits of the
    844   /// \ref DfsWizard class.
     844  /// Default traits class used by DfsWizard.
     845  /// \tparam GR The type of the digraph.
    845846  template<class GR>
    846847  class DfsWizardBase : public DfsWizardDefaultTraits<GR>
     
    870871    /// Constructor.
    871872
    872     /// This constructor does not require parameters, therefore it initiates
     873    /// This constructor does not require parameters, it initiates
    873874    /// all of the attributes to \c 0.
    874875    DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
     
    895896  /// This class should only be used through the \ref dfs() function,
    896897  /// which makes it easier to use the algorithm.
     898  ///
     899  /// \tparam TR The traits class that defines various types used by the
     900  /// algorithm.
    897901  template<class TR>
    898902  class DfsWizard : public TR
     
    900904    typedef TR Base;
    901905
    902     ///The type of the digraph the algorithm runs on.
    903906    typedef typename TR::Digraph Digraph;
    904907
     
    908911    typedef typename Digraph::OutArcIt OutArcIt;
    909912
    910     ///\brief The type of the map that stores the predecessor
    911     ///arcs of the DFS paths.
    912913    typedef typename TR::PredMap PredMap;
    913     ///\brief The type of the map that stores the distances of the nodes.
    914914    typedef typename TR::DistMap DistMap;
    915     ///\brief The type of the map that indicates which nodes are reached.
    916915    typedef typename TR::ReachedMap ReachedMap;
    917     ///\brief The type of the map that indicates which nodes are processed.
    918916    typedef typename TR::ProcessedMap ProcessedMap;
    919     ///The type of the DFS paths
    920917    typedef typename TR::Path Path;
    921918
     
    987984    ///Runs DFS algorithm to visit all nodes in the digraph.
    988985
    989     ///This method runs DFS algorithm in order to compute
    990     ///the DFS path to each node.
     986    ///This method runs DFS algorithm in order to visit all nodes
     987    ///in the digraph.
    991988    void run()
    992989    {
     
    1000997      SetPredMapBase(const TR &b) : TR(b) {}
    1001998    };
    1002     ///\brief \ref named-func-param "Named parameter"
    1003     ///for setting PredMap object.
    1004     ///
    1005     ///\ref named-func-param "Named parameter"
    1006     ///for setting PredMap object.
     999
     1000    ///\brief \ref named-templ-param "Named parameter" for setting
     1001    ///the predecessor map.
     1002    ///
     1003    ///\ref named-templ-param "Named parameter" function for setting
     1004    ///the map that stores the predecessor arcs of the nodes.
    10071005    template<class T>
    10081006    DfsWizard<SetPredMapBase<T> > predMap(const T &t)
     
    10181016      SetReachedMapBase(const TR &b) : TR(b) {}
    10191017    };
    1020     ///\brief \ref named-func-param "Named parameter"
    1021     ///for setting ReachedMap object.
    1022     ///
    1023     /// \ref named-func-param "Named parameter"
    1024     ///for setting ReachedMap object.
     1018
     1019    ///\brief \ref named-templ-param "Named parameter" for setting
     1020    ///the reached map.
     1021    ///
     1022    ///\ref named-templ-param "Named parameter" function for setting
     1023    ///the map that indicates which nodes are reached.
    10251024    template<class T>
    10261025    DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
     
    10361035      SetDistMapBase(const TR &b) : TR(b) {}
    10371036    };
    1038     ///\brief \ref named-func-param "Named parameter"
    1039     ///for setting DistMap object.
    1040     ///
    1041     /// \ref named-func-param "Named parameter"
    1042     ///for setting DistMap object.
     1037
     1038    ///\brief \ref named-templ-param "Named parameter" for setting
     1039    ///the distance map.
     1040    ///
     1041    ///\ref named-templ-param "Named parameter" function for setting
     1042    ///the map that stores the distances of the nodes calculated
     1043    ///by the algorithm.
    10431044    template<class T>
    10441045    DfsWizard<SetDistMapBase<T> > distMap(const T &t)
     
    10541055      SetProcessedMapBase(const TR &b) : TR(b) {}
    10551056    };
    1056     ///\brief \ref named-func-param "Named parameter"
    1057     ///for setting ProcessedMap object.
    1058     ///
    1059     /// \ref named-func-param "Named parameter"
    1060     ///for setting ProcessedMap object.
     1057
     1058    ///\brief \ref named-func-param "Named parameter" for setting
     1059    ///the processed map.
     1060    ///
     1061    ///\ref named-templ-param "Named parameter" function for setting
     1062    ///the map that indicates which nodes are processed.
    10611063    template<class T>
    10621064    DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
     
    12101212    ///
    12111213    /// The type of the map that indicates which nodes are reached.
    1212     /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     1214    /// It must conform to the
     1215    /// \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    12131216    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    12141217
     
    12481251  /// does not observe the DFS events. If you want to observe the DFS
    12491252  /// events, you should implement your own visitor class.
    1250   /// \tparam TR Traits class to set various data types used by the
    1251   /// algorithm. The default traits class is
    1252   /// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<GR>".
    1253   /// See \ref DfsVisitDefaultTraits for the documentation of
    1254   /// a DFS visit traits class.
     1253  /// \tparam TR The traits class that defines various types used by the
     1254  /// algorithm. By default, it is \ref DfsVisitDefaultTraits
     1255  /// "DfsVisitDefaultTraits<GR>".
     1256  /// In most cases, this parameter should not be set directly,
     1257  /// consider to use the named template parameters instead.
    12551258#ifdef DOXYGEN
    12561259  template <typename GR, typename VS, typename TR>
     
    13711374    /// The simplest way to execute the DFS algorithm is to use one of the
    13721375    /// member functions called \ref run(Node) "run()".\n
    1373     /// If you need more control on the execution, first you have to call
    1374     /// \ref init(), then you can add a source node with \ref addSource()
     1376    /// If you need better control on the execution, you have to call
     1377    /// \ref init() first, then you can add a source node with \ref addSource()
    13751378    /// and perform the actual computation with \ref start().
    13761379    /// This procedure can be repeated if there are nodes that have not
     
    15851588    /// \brief Runs the algorithm to visit all nodes in the digraph.
    15861589
    1587     /// This method runs the %DFS algorithm in order to
    1588     /// compute the %DFS path to each node.
    1589     ///
    1590     /// The algorithm computes
    1591     /// - the %DFS tree (forest),
    1592     /// - the distance of each node from the root(s) in the %DFS tree.
     1590    /// This method runs the %DFS algorithm in order to visit all nodes
     1591    /// in the digraph.
    15931592    ///
    15941593    /// \note <tt>d.run()</tt> is just a shortcut of the following code.
     
    16221621    ///@{
    16231622
    1624     /// \brief Checks if a node is reached from the root(s).
     1623    /// \brief Checks if the given node is reached from the root(s).
    16251624    ///
    16261625    /// Returns \c true if \c v is reached from the root(s).
  • lemon/glpk.cc

    r877 r989  
    557557  void GlpkBase::_clear() {
    558558    glp_erase_prob(lp);
    559     rows.clear();
    560     cols.clear();
    561559  }
    562560
  • lemon/glpk.cc

    r988 r989  
    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).
     
    5757    int i = glp_add_rows(lp, 1);
    5858    glp_set_row_bnds(lp, i, GLP_FR, 0.0, 0.0);
     59    return i;
     60  }
     61
     62  int GlpkBase::_addRow(Value lo, ExprIterator b,
     63                        ExprIterator e, Value up) {
     64    int i = glp_add_rows(lp, 1);
     65
     66    if (lo == -INF) {
     67      if (up == INF) {
     68        glp_set_row_bnds(lp, i, GLP_FR, lo, up);
     69      } else {
     70        glp_set_row_bnds(lp, i, GLP_UP, lo, up);
     71      }
     72    } else {
     73      if (up == INF) {
     74        glp_set_row_bnds(lp, i, GLP_LO, lo, up);
     75      } else if (lo != up) {
     76        glp_set_row_bnds(lp, i, GLP_DB, lo, up);
     77      } else {
     78        glp_set_row_bnds(lp, i, GLP_FX, lo, up);
     79      }
     80    }
     81
     82    std::vector<int> indexes;
     83    std::vector<Value> values;
     84
     85    indexes.push_back(0);
     86    values.push_back(0);
     87
     88    for(ExprIterator it = b; it != e; ++it) {
     89      indexes.push_back(it->first);
     90      values.push_back(it->second);
     91    }
     92
     93    glp_set_mat_row(lp, i, values.size() - 1,
     94                    &indexes.front(), &values.front());
    5995    return i;
    6096  }
  • lemon/graph_to_eps.h

    r964 r998  
    223223  using T::_copyright;
    224224
    225   using T::NodeTextColorType;
     225  using typename T::NodeTextColorType;
    226226  using T::CUST_COL;
    227227  using T::DIST_COL;
  • lemon/graph_to_eps.h

    r997 r998  
    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).
     
    143143  ///\param gr  Reference to the graph to be printed.
    144144  ///\param ost Reference to the output stream.
    145   ///By default it is <tt>std::cout</tt>.
     145  ///By default, it is <tt>std::cout</tt>.
    146146  ///\param pros If it is \c true, then the \c ostream referenced by \c os
    147147  ///will be explicitly deallocated by the destructor.
     
    513513  ///Turn on/off pre-scaling
    514514
    515   ///By default graphToEps() rescales the whole image in order to avoid
     515  ///By default, graphToEps() rescales the whole image in order to avoid
    516516  ///very big or very small bounding boxes.
    517517  ///
     
    11151115///\param g Reference to the graph to be printed.
    11161116///\param os Reference to the output stream.
    1117 ///By default it is <tt>std::cout</tt>.
     1117///By default, it is <tt>std::cout</tt>.
    11181118///
    11191119///This function also has a lot of
     
    11271127///\endcode
    11281128///
    1129 ///For more detailed examples see the \ref graph_to_eps_demo.cc demo file.
     1129///For more detailed examples, see the \ref graph_to_eps_demo.cc demo file.
    11301130///
    11311131///\warning Don't forget to put the \ref GraphToEps::run() "run()"
  • lemon/lp_base.h

    r958 r989  
    15571557
    15581558    ///Clears the problem
    1559     void clear() { _clear(); }
     1559    void clear() { _clear(); rows.clear(); cols.clear(); }
    15601560
    15611561    /// Sets the message level of the solver
  • lemon/lp_base.h

    r988 r989  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    8383      MESSAGE_VERBOSE
    8484    };
    85    
     85
    8686
    8787    ///The floating point type used by the solver
     
    115115      typedef True LpCol;
    116116      /// Default constructor
    117      
     117
    118118      /// \warning The default constructor sets the Col to an
    119119      /// undefined value.
    120120      Col() {}
    121121      /// Invalid constructor \& conversion.
    122      
     122
    123123      /// This constructor initializes the Col to be invalid.
    124       /// \sa Invalid for more details.     
     124      /// \sa Invalid for more details.
    125125      Col(const Invalid&) : _id(-1) {}
    126126      /// Equality operator
     
    147147    ///Iterator for iterate over the columns of an LP problem
    148148
    149     /// Its usage is quite simple, for example you can count the number
     149    /// Its usage is quite simple, for example, you can count the number
    150150    /// of columns in an LP \c lp:
    151151    ///\code
     
    157157    public:
    158158      /// Default constructor
    159      
     159
    160160      /// \warning The default constructor sets the iterator
    161161      /// to an undefined value.
    162162      ColIt() {}
    163163      /// Sets the iterator to the first Col
    164      
     164
    165165      /// Sets the iterator to the first Col.
    166166      ///
     
    170170      }
    171171      /// Invalid constructor \& conversion
    172      
     172
    173173      /// Initialize the iterator to be invalid.
    174174      /// \sa Invalid for more details.
    175175      ColIt(const Invalid&) : Col(INVALID) {}
    176176      /// Next column
    177      
     177
    178178      /// Assign the iterator to the next column.
    179179      ///
     
    210210      typedef True LpRow;
    211211      /// Default constructor
    212      
     212
    213213      /// \warning The default constructor sets the Row to an
    214214      /// undefined value.
    215215      Row() {}
    216216      /// Invalid constructor \& conversion.
    217      
     217
    218218      /// This constructor initializes the Row to be invalid.
    219       /// \sa Invalid for more details.     
     219      /// \sa Invalid for more details.
    220220      Row(const Invalid&) : _id(-1) {}
    221221      /// Equality operator
     
    225225      bool operator==(Row r) const  {return _id == r._id;}
    226226      /// Inequality operator
    227      
     227
    228228      /// \sa operator==(Row r)
    229229      ///
     
    242242    ///Iterator for iterate over the rows of an LP problem
    243243
    244     /// Its usage is quite simple, for example you can count the number
     244    /// Its usage is quite simple, for example, you can count the number
    245245    /// of rows in an LP \c lp:
    246246    ///\code
     
    252252    public:
    253253      /// Default constructor
    254      
     254
    255255      /// \warning The default constructor sets the iterator
    256256      /// to an undefined value.
    257257      RowIt() {}
    258258      /// Sets the iterator to the first Row
    259      
     259
    260260      /// Sets the iterator to the first Row.
    261261      ///
     
    265265      }
    266266      /// Invalid constructor \& conversion
    267      
     267
    268268      /// Initialize the iterator to be invalid.
    269269      /// \sa Invalid for more details.
    270270      RowIt(const Invalid&) : Row(INVALID) {}
    271271      /// Next row
    272      
     272
    273273      /// Assign the iterator to the next row.
    274274      ///
     
    348348      typedef True SolverExpr;
    349349      /// Default constructor
    350      
     350
    351351      /// Construct an empty expression, the coefficients and
    352352      /// the constant component are initialized to zero.
     
    449449
    450450      ///Iterator over the expression
    451      
    452       ///The iterator iterates over the terms of the expression. 
    453       /// 
     451
     452      ///The iterator iterates over the terms of the expression.
     453      ///
    454454      ///\code
    455455      ///double s=0;
     
    465465
    466466        /// Sets the iterator to the first term
    467        
     467
    468468        /// Sets the iterator to the first term of the expression.
    469469        ///
     
    482482        const Value& operator*() const { return _it->second; }
    483483        /// Next term
    484        
     484
    485485        /// Assign the iterator to the next term.
    486486        ///
     
    494494
    495495      /// Const iterator over the expression
    496      
    497       ///The iterator iterates over the terms of the expression. 
    498       /// 
     496
     497      ///The iterator iterates over the terms of the expression.
     498      ///
    499499      ///\code
    500500      ///double s=0;
     
    510510
    511511        /// Sets the iterator to the first term
    512        
     512
    513513        /// Sets the iterator to the first term of the expression.
    514514        ///
     
    525525
    526526        /// Next term
    527        
     527
    528528        /// Assign the iterator to the next term.
    529529        ///
     
    674674      typedef True SolverExpr;
    675675      /// Default constructor
    676      
     676
    677677      /// Construct an empty expression, the coefficients are
    678678      /// initialized to zero.
     
    709709      }
    710710      /// \brief Removes the coefficients which's absolute value does
    711       /// not exceed \c epsilon. 
     711      /// not exceed \c epsilon.
    712712      void simplify(Value epsilon = 0.0) {
    713713        std::map<int, Value>::iterator it=comps.begin();
     
    758758
    759759      ///Iterator over the expression
    760      
    761       ///The iterator iterates over the terms of the expression. 
    762       /// 
     760
     761      ///The iterator iterates over the terms of the expression.
     762      ///
    763763      ///\code
    764764      ///double s=0;
     
    774774
    775775        /// Sets the iterator to the first term
    776        
     776
    777777        /// Sets the iterator to the first term of the expression.
    778778        ///
     
    792792
    793793        /// Next term
    794        
     794
    795795        /// Assign the iterator to the next term.
    796796        ///
     
    804804
    805805      ///Iterator over the expression
    806      
    807       ///The iterator iterates over the terms of the expression. 
    808       /// 
     806
     807      ///The iterator iterates over the terms of the expression.
     808      ///
    809809      ///\code
    810810      ///double s=0;
     
    820820
    821821        /// Sets the iterator to the first term
    822        
     822
    823823        /// Sets the iterator to the first term of the expression.
    824824        ///
     
    835835
    836836        /// Next term
    837        
     837
    838838        /// Assign the iterator to the next term.
    839839        ///
     
    943943    virtual int _addCol() = 0;
    944944    virtual int _addRow() = 0;
     945
     946    virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u) {
     947      int row = _addRow();
     948      _setRowCoeffs(row, b, e);
     949      _setRowLowerBound(row, l);
     950      _setRowUpperBound(row, u);
     951      return row;
     952    }
    945953
    946954    virtual void _eraseCol(int col) = 0;
     
    12081216    ///\return The created row.
    12091217    Row addRow(Value l,const Expr &e, Value u) {
    1210       Row r=addRow();
    1211       row(r,l,e,u);
     1218      Row r;
     1219      e.simplify();
     1220      r._id = _addRowId(_addRow(l - *e, ExprIterator(e.comps.begin(), cols),
     1221                                ExprIterator(e.comps.end(), cols), u - *e));
    12121222      return r;
    12131223    }
     
    12181228    ///\return The created row.
    12191229    Row addRow(const Constr &c) {
    1220       Row r=addRow();
    1221       row(r,c);
     1230      Row r;
     1231      c.expr().simplify();
     1232      r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound()-*c.expr():-INF,
     1233                                ExprIterator(c.expr().comps.begin(), cols),
     1234                                ExprIterator(c.expr().comps.end(), cols),
     1235                                c.upperBounded()?c.upperBound()-*c.expr():INF));
    12221236      return r;
    12231237    }
     
    18041818    enum VarStatus {
    18051819      /// The variable is in the basis
    1806       BASIC, 
     1820      BASIC,
    18071821      /// The variable is free, but not basic
    18081822      FREE,
    1809       /// The variable has active lower bound 
     1823      /// The variable has active lower bound
    18101824      LOWER,
    18111825      /// The variable has active upper bound
     
    18861900    }
    18871901    /// Returns a component of the primal ray
    1888    
     1902
    18891903    /// The primal ray is solution of the modified primal problem,
    18901904    /// where we change each finite bound to 0, and we looking for a
     
    19201934
    19211935    /// Returns a component of the dual ray
    1922    
     1936
    19231937    /// The dual ray is solution of the modified primal problem, where
    19241938    /// we change each finite bound to 0 (i.e. the objective function
     
    20622076    }
    20632077    ///The value of the objective function
    2064    
     2078
    20652079    ///\return
    20662080    ///- \ref INF or -\ref INF means either infeasibility or unboundedness
  • lemon/path.h

    r877 r998  
    6565    Path() {}
    6666
     67    /// \brief Copy constructor
     68    ///
     69    Path(const Path& cpath) {
     70      pathCopy(cpath, *this);
     71    }
     72
    6773    /// \brief Template copy constructor
    6874    ///
     
    7278    Path(const CPath& cpath) {
    7379      pathCopy(cpath, *this);
     80    }
     81
     82    /// \brief Copy assignment
     83    ///
     84    Path& operator=(const Path& cpath) {
     85      pathCopy(cpath, *this);
     86      return *this;
    7487    }
    7588
     
    253266    SimplePath() {}
    254267
     268    /// \brief Copy constructor
     269    ///
     270    SimplePath(const SimplePath& cpath) {
     271      pathCopy(cpath, *this);
     272    }
     273
    255274    /// \brief Template copy constructor
    256275    ///
     
    260279    SimplePath(const CPath& cpath) {
    261280      pathCopy(cpath, *this);
     281    }
     282
     283    /// \brief Copy assignment
     284    ///
     285    SimplePath& operator=(const SimplePath& cpath) {
     286      pathCopy(cpath, *this);
     287      return *this;
    262288    }
    263289
     
    432458    ListPath() : first(0), last(0) {}
    433459
     460    /// \brief Copy constructor
     461    ///
     462    ListPath(const ListPath& cpath) : first(0), last(0) {
     463      pathCopy(cpath, *this);
     464    }
     465
    434466    /// \brief Template copy constructor
    435467    ///
     
    446478    ~ListPath() {
    447479      clear();
     480    }
     481
     482    /// \brief Copy assignment
     483    ///
     484    ListPath& operator=(const ListPath& cpath) {
     485      pathCopy(cpath, *this);
     486      return *this;
    448487    }
    449488
     
    759798    StaticPath() : len(0), arcs(0) {}
    760799
     800    /// \brief Copy constructor
     801    ///
     802    StaticPath(const StaticPath& cpath) : arcs(0) {
     803      pathCopy(cpath, *this);
     804    }
     805
    761806    /// \brief Template copy constructor
    762807    ///
     
    772817    ~StaticPath() {
    773818      if (arcs) delete[] arcs;
     819    }
     820
     821    /// \brief Copy assignment
     822    ///
     823    StaticPath& operator=(const StaticPath& cpath) {
     824      pathCopy(cpath, *this);
     825      return *this;
    774826    }
    775827
  • lemon/path.h

    r990 r998  
    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).
     
    10191019    };
    10201020
    1021    
     1021
    10221022    template <typename From, typename To,
    10231023              bool revEnable = RevPathTagIndicator<From>::value>
     
    10251025      static void copy(const From& from, To& to) {
    10261026        PathCopySelectorForward<From, To>::copy(from, to);
    1027       }     
     1027      }
    10281028    };
    10291029
     
    10321032      static void copy(const From& from, To& to) {
    10331033        PathCopySelectorBackward<From, To>::copy(from, to);
    1034       }     
     1034      }
    10351035    };
    10361036
Note: See TracChangeset for help on using the changeset viewer.