1.1 --- a/CMakeLists.txt Fri Mar 23 15:43:30 2018 +0100
1.2 +++ b/CMakeLists.txt Wed Oct 17 19:22:52 2018 +0200
1.3 @@ -86,38 +86,37 @@
1.4
1.5 IF(LEMON_ENABLE_GLPK)
1.6 FIND_PACKAGE(GLPK 4.33)
1.7 + IF(GLPK_FOUND)
1.8 + SET(LEMON_HAVE_LP TRUE)
1.9 + SET(LEMON_HAVE_MIP TRUE)
1.10 + SET(LEMON_HAVE_GLPK TRUE)
1.11 + ENDIF(GLPK_FOUND)
1.12 ENDIF(LEMON_ENABLE_GLPK)
1.13 IF(LEMON_ENABLE_ILOG)
1.14 FIND_PACKAGE(ILOG)
1.15 + IF(ILOG_FOUND)
1.16 + SET(LEMON_HAVE_LP TRUE)
1.17 + SET(LEMON_HAVE_MIP TRUE)
1.18 + SET(LEMON_HAVE_CPLEX TRUE)
1.19 + ENDIF(ILOG_FOUND)
1.20 ENDIF(LEMON_ENABLE_ILOG)
1.21 IF(LEMON_ENABLE_COIN)
1.22 FIND_PACKAGE(COIN)
1.23 + IF(COIN_FOUND)
1.24 + SET(LEMON_HAVE_LP TRUE)
1.25 + SET(LEMON_HAVE_MIP TRUE)
1.26 + SET(LEMON_HAVE_CLP TRUE)
1.27 + SET(LEMON_HAVE_CBC TRUE)
1.28 + ENDIF(COIN_FOUND)
1.29 ENDIF(LEMON_ENABLE_COIN)
1.30 IF(LEMON_ENABLE_SOPLEX)
1.31 FIND_PACKAGE(SOPLEX)
1.32 + IF(SOPLEX_FOUND)
1.33 + SET(LEMON_HAVE_LP TRUE)
1.34 + SET(LEMON_HAVE_SOPLEX TRUE)
1.35 + ENDIF(SOPLEX_FOUND)
1.36 ENDIF(LEMON_ENABLE_SOPLEX)
1.37
1.38 -IF(GLPK_FOUND)
1.39 - SET(LEMON_HAVE_LP TRUE)
1.40 - SET(LEMON_HAVE_MIP TRUE)
1.41 - SET(LEMON_HAVE_GLPK TRUE)
1.42 -ENDIF(GLPK_FOUND)
1.43 -IF(ILOG_FOUND)
1.44 - SET(LEMON_HAVE_LP TRUE)
1.45 - SET(LEMON_HAVE_MIP TRUE)
1.46 - SET(LEMON_HAVE_CPLEX TRUE)
1.47 -ENDIF(ILOG_FOUND)
1.48 -IF(COIN_FOUND)
1.49 - SET(LEMON_HAVE_LP TRUE)
1.50 - SET(LEMON_HAVE_MIP TRUE)
1.51 - SET(LEMON_HAVE_CLP TRUE)
1.52 - SET(LEMON_HAVE_CBC TRUE)
1.53 -ENDIF(COIN_FOUND)
1.54 -IF(SOPLEX_FOUND)
1.55 - SET(LEMON_HAVE_LP TRUE)
1.56 - SET(LEMON_HAVE_SOPLEX TRUE)
1.57 -ENDIF(SOPLEX_FOUND)
1.58 -
1.59 IF(ILOG_FOUND)
1.60 SET(DEFAULT_LP "CPLEX")
1.61 SET(DEFAULT_MIP "CPLEX")
2.1 --- a/cmake/FindCOIN.cmake Fri Mar 23 15:43:30 2018 +0100
2.2 +++ b/cmake/FindCOIN.cmake Wed Oct 17 19:22:52 2018 +0200
2.3 @@ -65,6 +65,12 @@
2.4 HINTS ${COIN_ROOT_DIR}/lib
2.5 )
2.6
2.7 +FIND_LIBRARY(COIN_PTHREADS_LIBRARY
2.8 + NAMES pthreads libpthreads
2.9 + HINTS ${COIN_ROOT_DIR}/lib/coin
2.10 + HINTS ${COIN_ROOT_DIR}/lib
2.11 +)
2.12 +
2.13 INCLUDE(FindPackageHandleStandardArgs)
2.14 FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
2.15 COIN_INCLUDE_DIR
2.16 @@ -82,14 +88,17 @@
2.17
2.18 IF(COIN_FOUND)
2.19 SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
2.20 - SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY}")
2.21 + SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
2.22 IF(COIN_ZLIB_LIBRARY)
2.23 SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
2.24 ENDIF(COIN_ZLIB_LIBRARY)
2.25 IF(COIN_BZ2_LIBRARY)
2.26 SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}")
2.27 ENDIF(COIN_BZ2_LIBRARY)
2.28 - 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}")
2.29 + IF(COIN_PTHREADS_LIBRARY)
2.30 + SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_PTHREADS_LIBRARY}")
2.31 + ENDIF(COIN_PTHREADS_LIBRARY)
2.32 + 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_CLP_LIBRARIES}")
2.33 SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
2.34 ENDIF(COIN_FOUND)
2.35
3.1 --- a/lemon/adaptors.h Fri Mar 23 15:43:30 2018 +0100
3.2 +++ b/lemon/adaptors.h Wed Oct 17 19:22:52 2018 +0200
3.3 @@ -3446,26 +3446,26 @@
3.4 ///
3.5 /// This map adaptor class adapts two node maps of the original digraph
3.6 /// to get a node map of the split digraph.
3.7 - /// Its value type is inherited from the first node map type (\c IN).
3.8 - /// \tparam IN The type of the node map for the in-nodes.
3.9 - /// \tparam OUT The type of the node map for the out-nodes.
3.10 - template <typename IN, typename OUT>
3.11 + /// Its value type is inherited from the first node map type (\c In).
3.12 + /// \tparam In The type of the node map for the in-nodes.
3.13 + /// \tparam Out The type of the node map for the out-nodes.
3.14 + template <typename In, typename Out>
3.15 class CombinedNodeMap {
3.16 public:
3.17
3.18 /// The key type of the map
3.19 typedef Node Key;
3.20 /// The value type of the map
3.21 - typedef typename IN::Value Value;
3.22 -
3.23 - typedef typename MapTraits<IN>::ReferenceMapTag ReferenceMapTag;
3.24 - typedef typename MapTraits<IN>::ReturnValue ReturnValue;
3.25 - typedef typename MapTraits<IN>::ConstReturnValue ConstReturnValue;
3.26 - typedef typename MapTraits<IN>::ReturnValue Reference;
3.27 - typedef typename MapTraits<IN>::ConstReturnValue ConstReference;
3.28 + typedef typename In::Value Value;
3.29 +
3.30 + typedef typename MapTraits<In>::ReferenceMapTag ReferenceMapTag;
3.31 + typedef typename MapTraits<In>::ReturnValue ReturnValue;
3.32 + typedef typename MapTraits<In>::ConstReturnValue ConstReturnValue;
3.33 + typedef typename MapTraits<In>::ReturnValue Reference;
3.34 + typedef typename MapTraits<In>::ConstReturnValue ConstReference;
3.35
3.36 /// Constructor
3.37 - CombinedNodeMap(IN& in_map, OUT& out_map)
3.38 + CombinedNodeMap(In& in_map, Out& out_map)
3.39 : _in_map(in_map), _out_map(out_map) {}
3.40
3.41 /// Returns the value associated with the given key.
3.42 @@ -3497,8 +3497,8 @@
3.43
3.44 private:
3.45
3.46 - IN& _in_map;
3.47 - OUT& _out_map;
3.48 + In& _in_map;
3.49 + Out& _out_map;
3.50
3.51 };
3.52
3.53 @@ -3506,28 +3506,28 @@
3.54 /// \brief Returns a combined node map
3.55 ///
3.56 /// This function just returns a combined node map.
3.57 - template <typename IN, typename OUT>
3.58 - static CombinedNodeMap<IN, OUT>
3.59 - combinedNodeMap(IN& in_map, OUT& out_map) {
3.60 - return CombinedNodeMap<IN, OUT>(in_map, out_map);
3.61 + template <typename In, typename Out>
3.62 + static CombinedNodeMap<In, Out>
3.63 + combinedNodeMap(In& in_map, Out& out_map) {
3.64 + return CombinedNodeMap<In, Out>(in_map, out_map);
3.65 }
3.66
3.67 - template <typename IN, typename OUT>
3.68 - static CombinedNodeMap<const IN, OUT>
3.69 - combinedNodeMap(const IN& in_map, OUT& out_map) {
3.70 - return CombinedNodeMap<const IN, OUT>(in_map, out_map);
3.71 + template <typename In, typename Out>
3.72 + static CombinedNodeMap<const In, Out>
3.73 + combinedNodeMap(const In& in_map, Out& out_map) {
3.74 + return CombinedNodeMap<const In, Out>(in_map, out_map);
3.75 }
3.76
3.77 - template <typename IN, typename OUT>
3.78 - static CombinedNodeMap<IN, const OUT>
3.79 - combinedNodeMap(IN& in_map, const OUT& out_map) {
3.80 - return CombinedNodeMap<IN, const OUT>(in_map, out_map);
3.81 + template <typename In, typename Out>
3.82 + static CombinedNodeMap<In, const Out>
3.83 + combinedNodeMap(In& in_map, const Out& out_map) {
3.84 + return CombinedNodeMap<In, const Out>(in_map, out_map);
3.85 }
3.86
3.87 - template <typename IN, typename OUT>
3.88 - static CombinedNodeMap<const IN, const OUT>
3.89 - combinedNodeMap(const IN& in_map, const OUT& out_map) {
3.90 - return CombinedNodeMap<const IN, const OUT>(in_map, out_map);
3.91 + template <typename In, typename Out>
3.92 + static CombinedNodeMap<const In, const Out>
3.93 + combinedNodeMap(const In& in_map, const Out& out_map) {
3.94 + return CombinedNodeMap<const In, const Out>(in_map, out_map);
3.95 }
3.96
3.97 /// \brief Arc map combined from an arc map and a node map of the
4.1 --- a/lemon/arg_parser.cc Fri Mar 23 15:43:30 2018 +0100
4.2 +++ b/lemon/arg_parser.cc Wed Oct 17 19:22:52 2018 +0200
4.3 @@ -221,9 +221,9 @@
4.4 const std::string &opt)
4.5 {
4.6 Opts::iterator o = _opts.find(opt);
4.7 - Opts::iterator s = _opts.find(syn);
4.8 LEMON_ASSERT(o!=_opts.end(), "Unknown option: '"+opt+"'");
4.9 - LEMON_ASSERT(s==_opts.end(), "Option already used: '"+syn+"'");
4.10 + LEMON_ASSERT(_opts.find(syn)==_opts.end(),
4.11 + "Option already used: '"+syn+"'");
4.12 ParData p;
4.13 p.help=opt;
4.14 p.mandatory=false;
5.1 --- a/lemon/planarity.h Fri Mar 23 15:43:30 2018 +0100
5.2 +++ b/lemon/planarity.h Wed Oct 17 19:22:52 2018 +0200
5.3 @@ -2383,7 +2383,7 @@
5.4 PlanarEmbedding<Graph> pe(_graph);
5.5 if (!pe.run()) return false;
5.6
5.7 - run(pe);
5.8 + run(pe.embeddingMap());
5.9 return true;
5.10 }
5.11
5.12 @@ -2398,6 +2398,15 @@
5.13 void run(const EmbeddingMap& embedding) {
5.14 typedef SmartEdgeSet<Graph> AuxGraph;
5.15
5.16 + if (countNodes(_graph) < 3) {
5.17 + int y = 0;
5.18 + for (typename Graph::NodeIt n(_graph); n != INVALID; ++n) {
5.19 + _point_map[n].x = 0;
5.20 + _point_map[n].y = y++;
5.21 + }
5.22 + return;
5.23 + }
5.24 +
5.25 if (3 * countNodes(_graph) - 6 == countEdges(_graph)) {
5.26 drawing(_graph, embedding, _point_map);
5.27 return;
6.1 --- a/lemon/random.h Fri Mar 23 15:43:30 2018 +0100
6.2 +++ b/lemon/random.h Wed Oct 17 19:22:52 2018 +0200
6.3 @@ -339,7 +339,7 @@
6.4 do {
6.5 num = rnd() & mask;
6.6 } while (num > max);
6.7 - return num;
6.8 + return static_cast<Result>(num);
6.9 }
6.10 };
6.11
7.1 --- a/test/max_flow_test.cc Fri Mar 23 15:43:30 2018 +0100
7.2 +++ b/test/max_flow_test.cc Wed Oct 17 19:22:52 2018 +0200
7.3 @@ -419,7 +419,7 @@
7.4 checkMaxFlowAlg<PType2, PreflowStartFunctions<PType2> >(test_lgf, 13);
7.5 checkMaxFlowAlg<PType3, PreflowStartFunctions<PType3> >(test_lgf, 13);
7.6
7.7 - checkMaxFlowAlg<PType2, PreflowStartFunctions<PType2> >(test_lgf_float, 0.3);
7.8 + checkMaxFlowAlg<PType2, PreflowStartFunctions<PType2> >(test_lgf_float, 0.3f);
7.9 checkMaxFlowAlg<PType3, PreflowStartFunctions<PType3> >(test_lgf_float, 0.3);
7.10
7.11 checkInitPreflow();
7.12 @@ -433,7 +433,7 @@
7.13 checkMaxFlowAlg<EKType2, GeneralStartFunctions<EKType2> >(test_lgf, 13);
7.14 checkMaxFlowAlg<EKType3, GeneralStartFunctions<EKType3> >(test_lgf, 13);
7.15
7.16 - checkMaxFlowAlg<EKType2, GeneralStartFunctions<EKType2> >(test_lgf_float, 0.3);
7.17 + checkMaxFlowAlg<EKType2, GeneralStartFunctions<EKType2> >(test_lgf_float, 0.3f);
7.18 checkMaxFlowAlg<EKType3, GeneralStartFunctions<EKType3> >(test_lgf_float, 0.3);
7.19
7.20 return 0;
8.1 --- a/test/planarity_test.cc Fri Mar 23 15:43:30 2018 +0100
8.2 +++ b/test/planarity_test.cc Wed Oct 17 19:22:52 2018 +0200
8.3 @@ -30,10 +30,40 @@
8.4 using namespace lemon;
8.5 using namespace lemon::dim2;
8.6
8.7 -const int lgfn = 4;
8.8 +const int lgfn = 8;
8.9 const std::string lgf[lgfn] = {
8.10 "@nodes\n"
8.11 "label\n"
8.12 + "@edges\n"
8.13 + " label\n",
8.14 +
8.15 + "@nodes\n"
8.16 + "label\n"
8.17 + "0\n"
8.18 + "@edges\n"
8.19 + " label\n",
8.20 +
8.21 + "@nodes\n"
8.22 + "label\n"
8.23 + "0\n"
8.24 + "1\n"
8.25 + "@edges\n"
8.26 + " label\n"
8.27 + "0 1 0\n",
8.28 +
8.29 + "@nodes\n"
8.30 + "label\n"
8.31 + "0\n"
8.32 + "1\n"
8.33 + "2\n"
8.34 + "@edges\n"
8.35 + " label\n"
8.36 + "0 1 0\n"
8.37 + "1 2 1\n"
8.38 + "2 0 2\n",
8.39 +
8.40 + "@nodes\n"
8.41 + "label\n"
8.42 "0\n"
8.43 "1\n"
8.44 "2\n"
8.45 @@ -136,8 +166,11 @@
8.46 ++face_num;
8.47 }
8.48 }
8.49 - check(face_num + countNodes(graph) - countConnectedComponents(graph) ==
8.50 - countEdges(graph) + 1, "Euler test does not passed");
8.51 +
8.52 + if (face_num != 0) {
8.53 + check(face_num + countNodes(graph) - countConnectedComponents(graph) ==
8.54 + countEdges(graph) + 1, "Euler test does not passed");
8.55 + }
8.56 }
8.57
8.58 void checkKuratowski(const Graph& graph, PE& pe) {
8.59 @@ -245,13 +278,29 @@
8.60 if (planar) {
8.61 checkEmbedding(graph, pe);
8.62
8.63 - PlanarDrawing<Graph> pd(graph);
8.64 - pd.run(pe.embeddingMap());
8.65 - checkDrawing(graph, pd);
8.66 + {
8.67 + PlanarDrawing<Graph> pd(graph);
8.68 + pd.run(pe.embeddingMap());
8.69 + checkDrawing(graph, pd);
8.70 + }
8.71
8.72 - PlanarColoring<Graph> pc(graph);
8.73 - pc.runFiveColoring(pe.embeddingMap());
8.74 - checkColoring(graph, pc, 5);
8.75 + {
8.76 + PlanarDrawing<Graph> pd(graph);
8.77 + pd.run();
8.78 + checkDrawing(graph, pd);
8.79 + }
8.80 +
8.81 + {
8.82 + PlanarColoring<Graph> pc(graph);
8.83 + pc.runFiveColoring(pe.embeddingMap());
8.84 + checkColoring(graph, pc, 5);
8.85 + }
8.86 +
8.87 + {
8.88 + PlanarColoring<Graph> pc(graph);
8.89 + pc.runFiveColoring();
8.90 + checkColoring(graph, pc, 5);
8.91 + }
8.92
8.93 } else {
8.94 checkKuratowski(graph, pe);
9.1 --- a/tools/dimacs-to-lgf.cc Fri Mar 23 15:43:30 2018 +0100
9.2 +++ b/tools/dimacs-to-lgf.cc Wed Oct 17 19:22:52 2018 +0200
9.3 @@ -73,11 +73,13 @@
9.4 if (!output) {
9.5 throw IoError("Cannot open the file for writing", ap.files()[1]);
9.6 }
9.7 + // fall through
9.8 case 1:
9.9 input.open(ap.files()[0].c_str());
9.10 if (!input) {
9.11 throw IoError("File cannot be found", ap.files()[0]);
9.12 }
9.13 + // fall through
9.14 case 0:
9.15 break;
9.16 default: