# HG changeset patch # User Alpar Juttner # Date 1347530179 -7200 # Node ID 7fdaa05a69a1ac7c563277403ae25a829d487e23 # Parent 4bb9e72e1a4178c97f0c0e33c0daa1cb39cea0fa# Parent 761fe0846f49ded656f1d1e3d40e92c7ea2c89f9 Merge #449 to branches >=1.2 diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 CMakeLists.txt --- a/CMakeLists.txt Wed Sep 12 17:25:48 2012 +0200 +++ b/CMakeLists.txt Thu Sep 13 11:56:19 2012 +0200 @@ -66,17 +66,17 @@ # (performance warning) # C4996: 'function': was declared deprecated ELSE() - SET(CXX_WARNING "-Wall -W") + SET(CXX_WARNING "-Wall") ENDIF() ENDIF() SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}") -SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING +SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING "Flags used by the C++ compiler during maintainer builds." FORCE ) -SET( CMAKE_C_FLAGS_MAINTAINER "-Werror" CACHE STRING +SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING "Flags used by the C compiler during maintainer builds." FORCE ) SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 cmake/FindCOIN.cmake --- a/cmake/FindCOIN.cmake Wed Sep 12 17:25:48 2012 +0200 +++ b/cmake/FindCOIN.cmake Thu Sep 13 11:56:19 2012 +0200 @@ -54,6 +54,17 @@ HINTS ${COIN_ROOT_DIR}/lib ) +FIND_LIBRARY(COIN_ZLIB_LIBRARY + NAMES z libz + HINTS ${COIN_ROOT_DIR}/lib/coin + HINTS ${COIN_ROOT_DIR}/lib +) +FIND_LIBRARY(COIN_BZ2_LIBRARY + NAMES bz2 libbz2 + HINTS ${COIN_ROOT_DIR}/lib/coin + HINTS ${COIN_ROOT_DIR}/lib +) + INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG COIN_INCLUDE_DIR @@ -71,9 +82,15 @@ IF(COIN_FOUND) SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR}) - SET(COIN_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY}") - SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}") - SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES}) + SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY}") + IF(COIN_ZLIB_LIBRARY) + SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}") + ENDIF(COIN_ZLIB_LIBRARY) + IF(COIN_BZ2_LIBRARY) + SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}") + ENDIF(COIN_BZ2_LIBRARY) + SET(COIN_CBC_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY};${COIN_CLP_LIBRARIES}") + SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES}) ENDIF(COIN_FOUND) MARK_AS_ADVANCED( @@ -88,6 +105,8 @@ COIN_OSI_CLP_LIBRARY COIN_OSI_VOL_LIBRARY COIN_VOL_LIBRARY + COIN_ZLIB_LIBRARY + COIN_BZ2_LIBRARY ) IF(COIN_FOUND) diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 cmake/FindCPLEX.cmake --- a/cmake/FindCPLEX.cmake Wed Sep 12 17:25:48 2012 +0200 +++ b/cmake/FindCPLEX.cmake Thu Sep 13 11:56:19 2012 +0200 @@ -2,23 +2,25 @@ FIND_PATH(CPLEX_INCLUDE_DIR ilcplex/cplex.h - PATHS "C:/ILOG/CPLEX91/include" - PATHS "/opt/ilog/cplex91/include" + PATHS "C:/ILOG/CPLEX/include" + PATHS "/opt/ilog/cplex/include" HINTS ${CPLEX_ROOT_DIR}/include ) FIND_LIBRARY(CPLEX_LIBRARY - cplex91 - PATHS "C:/ILOG/CPLEX91/lib/msvc7/stat_mda" - PATHS "/opt/ilog/cplex91/bin" + cplex + PATHS "C:/ILOG/CPLEX/lib/msvc7/stat_mda" + PATHS "/opt/ilog/cplex/bin" HINTS ${CPLEX_ROOT_DIR}/bin + HINTS ${CPLEX_ROOT_DIR}/lib ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_INCLUDE_DIR) FIND_PATH(CPLEX_BIN_DIR - cplex91.dll - PATHS "C:/ILOG/CPLEX91/bin/x86_win32" + cplex.dll + PATHS "C:/ILOG/CPLEX/bin/x86_win32" + HINTS ${CPLEX_ROOT_DIR}/bin ) IF(CPLEX_FOUND) diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/adaptors.h --- a/lemon/adaptors.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/adaptors.h Thu Sep 13 11:56:19 2012 +0200 @@ -1371,7 +1371,7 @@ /// Creates a subgraph for the given graph with the given node /// and edge filter maps. SubGraph(GR& graph, NF& node_filter, EF& edge_filter) { - initialize(graph, node_filter, edge_filter); + this->initialize(graph, node_filter, edge_filter); } /// \brief Sets the status of the given node @@ -2277,7 +2277,7 @@ /// /// Creates an undirected graph from the given digraph. Undirector(DGR& digraph) { - initialize(digraph); + this->initialize(digraph); } /// \brief Arc map combined from two original arc maps diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/bfs.h --- a/lemon/bfs.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/bfs.h Thu Sep 13 11:56:19 2012 +0200 @@ -1251,6 +1251,7 @@ visitor.examine(arc); } _Visitor& visitor; + Constraints() {} }; }; #endif diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/bits/bezier.h --- a/lemon/bits/bezier.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/bits/bezier.h Thu Sep 13 11:56:19 2012 +0200 @@ -159,7 +159,7 @@ const Point c=(p3+p4)/2; const Point d=(a+b)/2; const Point e=(b+c)/2; - const Point f=(d+e)/2; + // const Point f=(d+e)/2; R f1=_f(Bezier3(p1,a,d,e),_d); R f2=_f(Bezier3(e,d,c,p4),_d); return _s(f1,f2); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/bits/edge_set_extender.h --- a/lemon/bits/edge_set_extender.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/bits/edge_set_extender.h Thu Sep 13 11:56:19 2012 +0200 @@ -523,13 +523,13 @@ // // Returns the base node of the iterator Node baseNode(const IncEdgeIt &e) const { - return e.direction ? u(e) : v(e); + return e.direction ? this->u(e) : this->v(e); } // Running node of the iterator // // Returns the running node of the iterator Node runningNode(const IncEdgeIt &e) const { - return e.direction ? v(e) : u(e); + return e.direction ? this->v(e) : this->u(e); } diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/bits/graph_extender.h Thu Sep 13 11:56:19 2012 +0200 @@ -587,13 +587,13 @@ // // Returns the base node of the iterator Node baseNode(const IncEdgeIt &edge) const { - return edge._direction ? u(edge) : v(edge); + return edge._direction ? this->u(edge) : this->v(edge); } // Running node of the iterator // // Returns the running node of the iterator Node runningNode(const IncEdgeIt &edge) const { - return edge._direction ? v(edge) : u(edge); + return edge._direction ? this->v(edge) : this->u(edge); } // Mappable extension diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/bits/solver_bits.h --- a/lemon/bits/solver_bits.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/bits/solver_bits.h Thu Sep 13 11:56:19 2012 +0200 @@ -44,6 +44,7 @@ void clear() { first_item = -1; + last_item = -1; first_free_item = -1; items.clear(); cross.clear(); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/cbc.cc --- a/lemon/cbc.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/cbc.cc Thu Sep 13 11:56:19 2012 +0200 @@ -25,12 +25,7 @@ #include #include -#ifdef COIN_HAS_CLP #include "coin/OsiClpSolverInterface.hpp" -#endif -#ifdef COIN_HAS_OSL -#include "coin/OsiOslSolverInterface.hpp" -#endif #include "coin/CbcCutGenerator.hpp" #include "coin/CbcHeuristicLocal.hpp" @@ -270,13 +265,7 @@ if (_osi_solver) { delete _osi_solver; } -#ifdef COIN_HAS_CLP _osi_solver = new OsiClpSolverInterface(); -#elif COIN_HAS_OSL - _osi_solver = new OsiOslSolverInterface(); -#else -#error Cannot instantiate Osi solver -#endif _osi_solver->loadFromCoinModel(*_prob); @@ -328,13 +317,11 @@ CglFlowCover flowGen; _cbc_model->addCutGenerator(&flowGen, -1, "FlowCover"); -#ifdef COIN_HAS_CLP OsiClpSolverInterface* osiclp = dynamic_cast(_cbc_model->solver()); if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) { osiclp->setupForRepeatedUse(2, 0); } -#endif CbcRounding heuristic1(*_cbc_model); heuristic1.setWhen(3); @@ -448,8 +435,6 @@ } _prob = new CoinModel(); - rows.clear(); - cols.clear(); } void CbcMip::_messageLevel(MessageLevel level) { diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/circulation.h --- a/lemon/circulation.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/circulation.h Thu Sep 13 11:56:19 2012 +0200 @@ -572,8 +572,6 @@ { Node act; - Node bact=INVALID; - Node last_activated=INVALID; while((act=_level->highestActive())!=INVALID) { int actlevel=(*_level)[act]; int mlevel=_node_num; diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/clp.cc --- a/lemon/clp.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/clp.cc Thu Sep 13 11:56:19 2012 +0200 @@ -437,8 +437,6 @@ void ClpLp::_clear() { delete _prob; _prob = new ClpSimplex(); - rows.clear(); - cols.clear(); _col_names_ref.clear(); _clear_temporals(); } diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/concept_check.h --- a/lemon/concept_check.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/concept_check.h Thu Sep 13 11:56:19 2012 +0200 @@ -35,6 +35,22 @@ */ template inline void ignore_unused_variable_warning(const T&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&, const T4&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&, const T4&, + const T5&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&, const T4&, + const T5&, const T6&) { } ///\e template diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/concepts/graph_components.h Thu Sep 13 11:56:19 2012 +0200 @@ -115,6 +115,7 @@ const _GraphItem &ia; const _GraphItem &ib; + Constraints() {} }; }; @@ -174,6 +175,7 @@ } const _Digraph& digraph; + Constraints() {} }; }; @@ -290,6 +292,7 @@ } const _Graph& graph; + Constraints() {} }; }; @@ -369,6 +372,7 @@ } const _Digraph& digraph; + Constraints() {} }; }; @@ -421,6 +425,7 @@ } const _Graph& graph; + Constraints() {} }; }; @@ -489,6 +494,8 @@ _GraphItemIt it2; _GraphItemIt it3 = it1; _GraphItemIt it4 = INVALID; + ignore_unused_variable_warning(it3); + ignore_unused_variable_warning(it4); it2 = ++it1; ++it2 = it1; @@ -498,6 +505,7 @@ bi = it2; } const GR& g; + Constraints() {} }; }; @@ -577,6 +585,8 @@ _GraphIncIt it2; _GraphIncIt it3 = it1; _GraphIncIt it4 = INVALID; + ignore_unused_variable_warning(it3); + ignore_unused_variable_warning(it4); it2 = ++it1; ++it2 = it1; @@ -586,6 +596,7 @@ } const Base& node; const GR& graph; + Constraints() {} }; }; @@ -762,6 +773,7 @@ } const _Digraph& digraph; + Constraints() {} }; }; @@ -886,6 +898,7 @@ } const _Graph& graph; + Constraints() {} }; }; @@ -943,6 +956,7 @@ } const _Digraph& digraph; + Constraints() {} }; }; @@ -984,6 +998,7 @@ } const _Graph& graph; + Constraints() {} }; }; @@ -1061,6 +1076,7 @@ const _Map &m; const GR &g; const typename GraphMap::Value &t; + Constraints() {} }; }; @@ -1199,6 +1215,7 @@ } const _Digraph& digraph; + Constraints() {} }; }; @@ -1284,6 +1301,7 @@ } const _Graph& graph; + Constraints() {} }; }; @@ -1328,6 +1346,7 @@ } _Digraph& digraph; + Constraints() {} }; }; @@ -1372,6 +1391,7 @@ } _Graph& graph; + Constraints() {} }; }; @@ -1411,6 +1431,7 @@ } _Digraph& digraph; + Constraints() {} }; }; @@ -1450,6 +1471,7 @@ } _Graph& graph; + Constraints() {} }; }; @@ -1478,6 +1500,7 @@ } _Digraph& digraph; + Constraints() {} }; }; @@ -1506,6 +1529,7 @@ } _Graph& graph; + Constraints() {} }; }; diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/concepts/heap.h --- a/lemon/concepts/heap.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/concepts/heap.h Thu Sep 13 11:56:19 2012 +0200 @@ -314,6 +314,7 @@ _Heap& heap; ItemIntMap& map; + Constraints() {} }; }; diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/concepts/maps.h --- a/lemon/concepts/maps.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/concepts/maps.h Thu Sep 13 11:56:19 2012 +0200 @@ -49,7 +49,7 @@ /// Returns the value associated with the given key. Value operator[](const Key &) const { - return *static_cast(0); + return *(static_cast(0)+1); } template @@ -68,6 +68,7 @@ const Key& key; const typename _ReadMap::Key& own_key; const _ReadMap& m; + Constraints() {} }; }; @@ -109,6 +110,7 @@ const typename _WriteMap::Key& own_key; const typename _WriteMap::Value& own_val; _WriteMap& m; + Constraints() {} }; }; @@ -129,7 +131,8 @@ /// Returns the value associated with the given key. Value operator[](const Key &) const { - return *static_cast(0); + Value *r = 0; + return *r; } /// Sets the value associated with the given key. @@ -169,12 +172,14 @@ /// Returns a reference to the value associated with the given key. Reference operator[](const Key &) { - return *static_cast(0); + Value *r = 0; + return *r; } /// Returns a const reference to the value associated with the given key. ConstReference operator[](const Key &) const { - return *static_cast(0); + Value *r = 0; + return *r; } /// Sets the value associated with the given key. @@ -205,6 +210,7 @@ typename _ReferenceMap::Reference own_ref; typename _ReferenceMap::ConstReference own_cref; _ReferenceMap& m; + Constraints() {} }; }; diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/concepts/path.h --- a/lemon/concepts/path.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/concepts/path.h Thu Sep 13 11:56:19 2012 +0200 @@ -168,6 +168,7 @@ ignore_unused_variable_warning(ed); } _Path& p; + PathDumperConstraints() {} }; template @@ -193,6 +194,7 @@ ignore_unused_variable_warning(ed); } _Path& p; + PathDumperConstraints() {} }; } diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/core.h --- a/lemon/core.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/core.h Thu Sep 13 11:56:19 2012 +0200 @@ -1849,15 +1849,26 @@ ///this operator. If you change the outgoing arcs of ///a single node \c n, then \ref refresh(Node) "refresh(n)" is enough. /// -#ifdef DOXYGEN - Arc operator()(Node s, Node t, Arc prev=INVALID) const {} -#else - using ArcLookUp::operator() ; - Arc operator()(Node s, Node t, Arc prev) const + Arc operator()(Node s, Node t, Arc prev=INVALID) const { - return prev==INVALID?(*this)(s,t):_next[prev]; + if(prev==INVALID) + { + Arc f=INVALID; + Arc e; + for(e=_head[s]; + e!=INVALID&&_g.target(e)!=t; + e = t < _g.target(e)?_left[e]:_right[e]) ; + while(e!=INVALID) + if(_g.target(e)==t) + { + f = e; + e = _left[e]; + } + else e = _right[e]; + return f; + } + else return _next[prev]; } -#endif }; diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/cplex.cc --- a/lemon/cplex.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/cplex.cc Thu Sep 13 11:56:19 2012 +0200 @@ -470,8 +470,6 @@ CPXfreeprob(cplexEnv(),&_prob); int status; _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem"); - rows.clear(); - cols.clear(); } void CplexBase::_messageLevel(MessageLevel level) { diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/dfs.h --- a/lemon/dfs.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/dfs.h Thu Sep 13 11:56:19 2012 +0200 @@ -1193,6 +1193,7 @@ visitor.backtrack(arc); } _Visitor& visitor; + Constraints() {} }; }; #endif diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/glpk.cc --- a/lemon/glpk.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/glpk.cc Thu Sep 13 11:56:19 2012 +0200 @@ -556,8 +556,6 @@ void GlpkBase::_clear() { glp_erase_prob(lp); - rows.clear(); - cols.clear(); } void GlpkBase::freeEnv() { diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/graph_to_eps.h Thu Sep 13 11:56:19 2012 +0200 @@ -222,7 +222,7 @@ using T::_title; using T::_copyright; - using T::NodeTextColorType; + using typename T::NodeTextColorType; using T::CUST_COL; using T::DIST_COL; using T::DIST_BW; diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/lp_base.h --- a/lemon/lp_base.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/lp_base.h Thu Sep 13 11:56:19 2012 +0200 @@ -1556,7 +1556,7 @@ void min() { _setSense(MIN); } ///Clears the problem - void clear() { _clear(); } + void clear() { _clear(); rows.clear(); cols.clear(); } /// Sets the message level of the solver void messageLevel(MessageLevel level) { _messageLevel(level); } diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 lemon/path.h --- a/lemon/path.h Wed Sep 12 17:25:48 2012 +0200 +++ b/lemon/path.h Thu Sep 13 11:56:19 2012 +0200 @@ -64,6 +64,12 @@ /// Default constructor Path() {} + /// \brief Copy constructor + /// + Path(const Path& cpath) { + pathCopy(cpath, *this); + } + /// \brief Template copy constructor /// /// This constuctor initializes the path from any other path type. @@ -73,6 +79,13 @@ pathCopy(cpath, *this); } + /// \brief Copy assignment + /// + Path& operator=(const Path& cpath) { + pathCopy(cpath, *this); + return *this; + } + /// \brief Template copy assignment /// /// This operator makes a copy of a path of any other type. @@ -252,6 +265,12 @@ /// Default constructor SimplePath() {} + /// \brief Copy constructor + /// + SimplePath(const SimplePath& cpath) { + pathCopy(cpath, *this); + } + /// \brief Template copy constructor /// /// This path can be initialized with any other path type. It just @@ -261,6 +280,13 @@ pathCopy(cpath, *this); } + /// \brief Copy assignment + /// + SimplePath& operator=(const SimplePath& cpath) { + pathCopy(cpath, *this); + return *this; + } + /// \brief Template copy assignment /// /// This path can be initialized with any other path type. It just @@ -431,6 +457,12 @@ /// Default constructor ListPath() : first(0), last(0) {} + /// \brief Copy constructor + /// + ListPath(const ListPath& cpath) : first(0), last(0) { + pathCopy(cpath, *this); + } + /// \brief Template copy constructor /// /// This path can be initialized with any other path type. It just @@ -447,6 +479,13 @@ clear(); } + /// \brief Copy assignment + /// + ListPath& operator=(const ListPath& cpath) { + pathCopy(cpath, *this); + return *this; + } + /// \brief Template copy assignment /// /// This path can be initialized with any other path type. It just @@ -758,6 +797,12 @@ /// Default constructor StaticPath() : len(0), arcs(0) {} + /// \brief Copy constructor + /// + StaticPath(const StaticPath& cpath) : arcs(0) { + pathCopy(cpath, *this); + } + /// \brief Template copy constructor /// /// This path can be initialized from any other path type. @@ -773,6 +818,13 @@ if (arcs) delete[] arcs; } + /// \brief Copy assignment + /// + StaticPath& operator=(const StaticPath& cpath) { + pathCopy(cpath, *this); + return *this; + } + /// \brief Template copy assignment /// /// This path can be made equal to any other path type. It simply diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/CMakeLists.txt --- a/test/CMakeLists.txt Wed Sep 12 17:25:48 2012 +0200 +++ b/test/CMakeLists.txt Thu Sep 13 11:56:19 2012 +0200 @@ -13,6 +13,7 @@ SET(TESTS adaptors_test + arc_look_up_test bellman_ford_test bfs_test circulation_test @@ -86,7 +87,7 @@ GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH} ) ENDIF() ENDIF() @@ -128,7 +129,7 @@ GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH} ) ENDIF() ENDIF() diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/adaptors_test.cc --- a/test/adaptors_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/adaptors_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -65,6 +65,7 @@ Digraph::Arc a1 = digraph.addArc(n1, n2); Digraph::Arc a2 = digraph.addArc(n1, n3); Digraph::Arc a3 = digraph.addArc(n2, n3); + ignore_unused_variable_warning(a3); // Check the adaptor checkGraphNodeList(adaptor, 3); @@ -99,6 +100,7 @@ Adaptor::Arc a6 = adaptor.addArc(n2, n4); Adaptor::Arc a7 = adaptor.addArc(n1, n4); Adaptor::Arc a8 = adaptor.addArc(n1, n2); + ignore_unused_variable_warning(a6,a7,a8); adaptor.erase(a1); adaptor.erase(n3); @@ -758,6 +760,7 @@ Digraph::Arc a1 = digraph.addArc(n1, n2); Digraph::Arc a2 = digraph.addArc(n1, n3); Digraph::Arc a3 = digraph.addArc(n2, n3); + ignore_unused_variable_warning(a1,a2,a3); checkGraphNodeList(adaptor, 6); checkGraphArcList(adaptor, 6); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/arc_look_up_test.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/arc_look_up_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -0,0 +1,85 @@ +/* -*- mode: C++; indent-tabs-mode: nil; -*- + * + * This file is a part of LEMON, a generic C++ optimization library. + * + * Copyright (C) 2003-2009 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#include +#include "lemon/list_graph.h" +#include "lemon/lgf_reader.h" + +#include "test_tools.h" + +using namespace lemon; + +const int lgfn = 4; +const std::string lgf = + "@nodes\n" +"label\n" +"0\n" +"1\n" +"2\n" +"3\n" +"4\n" +"5\n" +"6\n" +"@arcs\n" +"label\n" +"5 6 0\n" +"5 4 1\n" +"4 6 2\n" +"3 4 3\n" +"3 4 4\n" +"3 2 5\n" +"3 5 6\n" +"3 5 7\n" +"3 5 8\n" +"3 5 9\n" +"2 4 10\n" +"2 4 11\n" +"2 4 12\n" +"2 4 13\n" +"1 2 14\n" +"1 2 15\n" +"1 0 16\n" +"1 3 17\n" +"1 3 18\n" +"1 3 19\n" +"1 3 20\n" +"0 2 21\n" +"0 2 22\n" +"0 2 23\n" +"0 2 24\n"; + + +int main() { + ListDigraph graph; + std::istringstream lgfs(lgf); + DigraphReader(graph, lgfs).run(); + + AllArcLookUp lookup(graph); + + int numArcs = countArcs(graph); + + int arcCnt = 0; + for(ListDigraph::NodeIt n1(graph); n1 != INVALID; ++n1) + for(ListDigraph::NodeIt n2(graph); n2 != INVALID; ++n2) + for(ListDigraph::Arc a = lookup(n1, n2); a != INVALID; + a = lookup(n1, n2, a)) + ++arcCnt; + check(arcCnt==numArcs, "Wrong total number of arcs"); + + return 0; +} diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/connectivity_test.cc --- a/test/connectivity_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/connectivity_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -68,6 +68,7 @@ Digraph::NodeMap order(d); Graph g(d); Digraph::Node n = d.addNode(); + ignore_unused_variable_warning(n); check(stronglyConnected(d), "This digraph is strongly connected"); check(countStronglyConnectedComponents(d) == 1, @@ -245,6 +246,7 @@ Digraph::Node shoe = d.addNode(); Digraph::Node watch = d.addNode(); Digraph::Node pants = d.addNode(); + ignore_unused_variable_warning(watch); d.addArc(socks, shoe); d.addArc(pants, shoe); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/digraph_test.cc --- a/test/digraph_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/digraph_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -64,6 +64,7 @@ Arc a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); + ignore_unused_variable_warning(a2,a3,a4); checkGraphNodeList(G, 3); checkGraphArcList(G, 4); @@ -92,6 +93,7 @@ Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode(); Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); + ignore_unused_variable_warning(a1,a2,a3,a4); Node n4 = G.split(n2); @@ -125,6 +127,7 @@ Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1), a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3), a5 = G.addArc(n2, n4); + ignore_unused_variable_warning(a1,a2,a3,a5); checkGraphNodeList(G, 4); checkGraphArcList(G, 5); @@ -204,6 +207,7 @@ Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1), a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1), a5 = G.addArc(n2, n4); + ignore_unused_variable_warning(a2,a3,a4,a5); // Check arc deletion G.erase(a1); @@ -251,6 +255,7 @@ Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode(); Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); + ignore_unused_variable_warning(a1,a2,a3,a4); typename Digraph::Snapshot snapshot(G); @@ -351,6 +356,7 @@ Arc e1 = g.addArc(n1, n2), e2 = g.addArc(n2, n3); + ignore_unused_variable_warning(e2); check(g.valid(n1), "Wrong validity check"); check(g.valid(e1), "Wrong validity check"); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/edge_set_test.cc --- a/test/edge_set_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/edge_set_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -44,10 +44,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); ArcSet arc_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(arc_set, 2); checkGraphArcList(arc_set, 0); @@ -75,6 +77,8 @@ ArcSet::Arc a2 = arc_set.addArc(n2, n1), a3 = arc_set.addArc(n2, n3), a4 = arc_set.addArc(n2, n3); + ignore_unused_variable_warning(a2,a3,a4); + checkGraphNodeList(arc_set, 3); checkGraphArcList(arc_set, 4); @@ -110,10 +114,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); ArcSet arc_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(arc_set, 2); checkGraphArcList(arc_set, 0); @@ -141,6 +147,8 @@ ArcSet::Arc a2 = arc_set.addArc(n2, n1), a3 = arc_set.addArc(n2, n3), a4 = arc_set.addArc(n2, n3); + ignore_unused_variable_warning(a2,a3,a4); + checkGraphNodeList(arc_set, 3); checkGraphArcList(arc_set, 4); @@ -190,10 +198,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); EdgeSet edge_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(edge_set, 2); checkGraphArcList(edge_set, 0); @@ -230,6 +240,8 @@ EdgeSet::Edge e2 = edge_set.addEdge(n2, n1), e3 = edge_set.addEdge(n2, n3), e4 = edge_set.addEdge(n2, n3); + ignore_unused_variable_warning(e2,e3,e4); + checkGraphNodeList(edge_set, 3); checkGraphEdgeList(edge_set, 4); @@ -274,10 +286,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); EdgeSet edge_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(edge_set, 2); checkGraphArcList(edge_set, 0); @@ -314,6 +328,8 @@ EdgeSet::Edge e2 = edge_set.addEdge(n2, n1), e3 = edge_set.addEdge(n2, n3), e4 = edge_set.addEdge(n2, n3); + ignore_unused_variable_warning(e2,e3,e4); + checkGraphNodeList(edge_set, 3); checkGraphEdgeList(edge_set, 4); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/euler_test.cc --- a/test/euler_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/euler_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -101,7 +101,8 @@ Digraph d; Graph g(d); Digraph::Node n = d.addNode(); - + ignore_unused_variable_warning(n); + checkDiEulerIt(d); checkDiEulerIt(g); checkEulerIt(g); @@ -189,6 +190,7 @@ Digraph::Node n3 = d.addNode(); Digraph::Node n4 = d.addNode(); Digraph::Node n5 = d.addNode(); + ignore_unused_variable_warning(n0,n4,n5); d.addArc(n1, n2); d.addArc(n2, n3); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/graph_test.cc --- a/test/graph_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/graph_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -66,6 +66,7 @@ Edge e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3); + ignore_unused_variable_warning(e2,e3); checkGraphNodeList(G, 3); checkGraphEdgeList(G, 3); @@ -98,6 +99,7 @@ Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4), e5 = G.addEdge(n4, n3); + ignore_unused_variable_warning(e1,e3,e4,e5); checkGraphNodeList(G, 4); checkGraphEdgeList(G, 5); @@ -177,6 +179,7 @@ Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4), e5 = G.addEdge(n4, n3); + ignore_unused_variable_warning(e1,e3,e4,e5); // Check edge deletion G.erase(e2); @@ -217,6 +220,7 @@ Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode(); Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3); + ignore_unused_variable_warning(e1,e2,e3); checkGraphNodeList(G, 3); checkGraphEdgeList(G, 3); @@ -381,6 +385,7 @@ Edge e1 = g.addEdge(n1, n2), e2 = g.addEdge(n2, n3); + ignore_unused_variable_warning(e2); check(g.valid(n1), "Wrong validity check"); check(g.valid(e1), "Wrong validity check"); @@ -519,6 +524,7 @@ checkGraphArcList(G, dim * (1 << dim)); Node n = G.nodeFromId(dim); + ignore_unused_variable_warning(n); for (NodeIt n(G); n != INVALID; ++n) { checkGraphIncEdgeList(G, n, dim); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/lp_test.cc --- a/test/lp_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/lp_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -41,11 +41,38 @@ using namespace lemon; +int countCols(LpBase & lp) { + int count=0; + for (LpBase::ColIt c(lp); c!=INVALID; ++c) ++count; + return count; +} + +int countRows(LpBase & lp) { + int count=0; + for (LpBase::RowIt r(lp); r!=INVALID; ++r) ++count; + return count; +} + + void lpTest(LpSolver& lp) { typedef LpSolver LP; + // Test LpBase::clear() + check(countRows(lp)==0, "Wrong number of rows"); + check(countCols(lp)==0, "Wrong number of cols"); + lp.addCol(); lp.addRow(); lp.addRow(); + check(countRows(lp)==2, "Wrong number of rows"); + check(countCols(lp)==1, "Wrong number of cols"); + lp.clear(); + check(countRows(lp)==0, "Wrong number of rows"); + check(countCols(lp)==0, "Wrong number of cols"); + lp.addCol(); lp.addCol(); lp.addCol(); lp.addRow(); + check(countRows(lp)==1, "Wrong number of rows"); + check(countCols(lp)==3, "Wrong number of cols"); + lp.clear(); + std::vector x(10); // for(int i=0;i<10;i++) x.push_back(lp.addCol()); lp.addColSet(x); diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/maps_test.cc --- a/test/maps_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/maps_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -103,6 +103,7 @@ checkConcept, NullMap >(); NullMap map1; NullMap map2 = map1; + ignore_unused_variable_warning(map2); map1 = nullMap(); } @@ -113,11 +114,15 @@ ConstMap map1; ConstMap map2 = B(); ConstMap map3 = map1; + ignore_unused_variable_warning(map2,map3); + map1 = constMap(B()); map1 = constMap(); map1.setAll(B()); ConstMap map4(C(1)); ConstMap map5 = map4; + ignore_unused_variable_warning(map5); + map4 = constMap(C(2)); map4.setAll(C(3)); @@ -138,6 +143,8 @@ checkConcept, IdentityMap >(); IdentityMap map1; IdentityMap map2 = map1; + ignore_unused_variable_warning(map2); + map1 = identityMap(); checkConcept, IdentityMap >(); @@ -197,7 +204,9 @@ typedef ComposeMap > CompMap; checkConcept, CompMap>(); CompMap map1 = CompMap(DoubleMap(),ReadMap()); + ignore_unused_variable_warning(map1); CompMap map2 = composeMap(DoubleMap(), ReadMap()); + ignore_unused_variable_warning(map2); SparseMap m1(false); m1[3.14] = true; RangeMap m2(2); m2[0] = 3.0; m2[1] = 3.14; @@ -210,7 +219,9 @@ typedef CombineMap > CombMap; checkConcept, CombMap>(); CombMap map1 = CombMap(DoubleMap(), DoubleMap()); + ignore_unused_variable_warning(map1); CombMap map2 = combineMap(DoubleMap(), DoubleMap(), std::plus()); + ignore_unused_variable_warning(map2); check(combineMap(constMap(), identityMap(), &binc)[B()] == 3, "Something is wrong with CombineMap"); @@ -222,11 +233,15 @@ checkConcept, FunctorToMap >(); FunctorToMap map1; FunctorToMap map2 = FunctorToMap(F()); + ignore_unused_variable_warning(map2); + B b = functorToMap(F())[A()]; + ignore_unused_variable_warning(b); checkConcept, MapToFunctor > >(); MapToFunctor > map = MapToFunctor >(ReadMap()); + ignore_unused_variable_warning(map); check(functorToMap(&func)[A()] == 3, "Something is wrong with FunctorToMap"); @@ -244,7 +259,10 @@ checkConcept, ConvertMap, double> >(); ConvertMap, int> map1(rangeMap(1, true)); + ignore_unused_variable_warning(map1); ConvertMap, int> map2 = convertMap(rangeMap(2, false)); + ignore_unused_variable_warning(map2); + } // ForkMap diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/path_test.cc --- a/test/path_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/path_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -38,7 +38,36 @@ checkConcept, ListPath >(); } +// Check if proper copy consructor is called (use valgrind for testing) +template +void checkCopy() +{ + ListDigraph g; + ListDigraph::Arc a = g.addArc(g.addNode(), g.addNode()); + + _Path p,q; + p.addBack(a); + q=p; + _Path r(p); + StaticPath s(r); +} + int main() { check_concepts(); + + checkCopy >(); + checkCopy >(); + checkCopy >(); + + ListDigraph g; + ListDigraph::Arc a = g.addArc(g.addNode(), g.addNode()); + + Path p; + StaticPath q,r; + p.addBack(a); + q=p; + r=q; + StaticPath s(q); + return 0; } diff -r 4bb9e72e1a41 -r 7fdaa05a69a1 test/time_measure_test.cc --- a/test/time_measure_test.cc Wed Sep 12 17:25:48 2012 +0200 +++ b/test/time_measure_test.cc Thu Sep 13 11:56:19 2012 +0200 @@ -17,6 +17,7 @@ */ #include +#include using namespace lemon; @@ -32,7 +33,10 @@ static Timer T; for(int i=0;i<1000;i++) - TimeStamp x(T); + { + TimeStamp x(T); + ignore_unused_variable_warning(x); + } } int main()