bjoern-andres / graph Goto Github PK
View Code? Open in Web Editor NEWGraphs and Graph Algorithms in C++, including Minimum Cost (Lifted) Multicuts
Home Page: http://www.andres.sc/graph.html
Graphs and Graph Algorithms in C++, including Minimum Cost (Lifted) Multicuts
Home Page: http://www.andres.sc/graph.html
When I try to compile it on mac, I get this error:
graph/include/andres/graph/multicut/lp.hxx:31:21: note: 'lp' should be declared prior to the call site or in namespace 'andres::graph' std::vector<double> lp(CompleteGraph<VISITOR> const& graph, ECA const& edgeCosts, VIS& visitor, size_t numberOfIterations = std::numeric_limits<size_t>::max())
I am not sure if I am doing something wrong but there seem to be missing namespace declarations in the lifted multicut unit tests when compiling the project.
I added std namespace declarations so that the code now compiles: jutanke@39edadb
I am working on Ubuntu 16.04 with Gurobi 7.5.1
the lifted graph, in a lifted multicut setting has to contain all edges of the 'orginal-graph',right?
Is there a way to construct a "semi-view" graph which takes all the edges from the orginal-graph, and some additional edges.
One can do that relatively simple, but I was wondering if such a thing is already implemented.
Great well researched with right kind of right-sized abstractions.
But. Not standard C++. 2019Q4 standard C++ is ISO C++17. Some benefits of moving the code completely to standard C++ are:
A big cleaning for good housekeeping in essence ...
are there some real work hdf5 lifted multicut models available.
Would be great to test new solvers on non synthetic models!
Greetings
I'm new to the Cmake things. Is there someone who could provide some guidance and suggestions about how to solve a new problem with the nl-lmp solution here?
I've cloned the repository, and successfully installed by run 'cmake .', 'make', and 'ctest -W', but not clear what's the next step. How to write a script to solve a new nl-lmp problem? Which file should be imported, and which function should be called to solve the problem?
Thanks pretty much.
@bjoern-andres why are the results of lifted mc algorithms passed by edge labels of the lifted graph.
I propose to use the connected comp. labeling of the orginal graph. And there should be the guarantee that this connected comp. labeling is valid wrt. the path constraints / lifted stuff (all nodes with the same number must be connected with a path in the orginal graph).
Also internally, algorithms could use that representation since it should be cheaper in memory.
A graph test is failing on the OSX conda-forge pipeline. The test is test-graph-multicut-greedy-additive
. I have added some debug output to the test, see the patch here:
With the output debug enabled, this is the screen output of the test:
https://travis-ci.org/conda-forge/staged-recipes/builds/220550265#L553
Would you like some python bindings?
I would propose to use https://github.com/DerThorsten/Boost.NumPy to interface with numpy.ndarray (the nd-array of python) and write code on top of that to interface with your marray (where is the latest version ?)
On top of that I would like to add high level bindings for lifted multicuts and other algorithms to python.
Error:
[ 3%] Built target solve-lmp-grid-graph
[ 7%] Built target solve-mp-grid-graph
[ 11%] Built target solve-mp-complete-graph
[ 14%] Built target solve-mp
[ 16%] Building CXX object CMakeFiles/lift-mp-grid-graph.dir/src/command-line-tools/lift-mp-grid-graph.cxx.o
In file included from /home/hanslovskyp/git/graph/src/command-line-tools/lift-mp-grid-graph.cxx:13:
/home/hanslovskyp/git/graph/include/andres/graph/lifting.hxx: In instantiation of ‘void andres::graph::lift(const andres::graph::GridGraph<2, INPUT_GRAPH_VISITOR>&, OUTPUT_GRAPH&, std::size_t, std::size_t, andres::graph::LiftingMetric) [with INPUT_GRAPH_VISITOR = andres::graph::IdleGraphVisitor<long unsigned int>; OUTPUT_GRAPH = andres::graph::Graph<>; std::size_t = long unsigned int]’:
/home/hanslovskyp/git/graph/src/command-line-tools/lift-mp-grid-graph.cxx:124:119: required from here
/home/hanslovskyp/git/graph/include/andres/graph/lifting.hxx:206:62: error: call of overloaded ‘abs(std::size_t)’ is ambiguous
const std::size_t distance = std::abs(x - cv[0]) + std::abs(y - cv[1]);
~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/8.2.1/cstdlib:77,
from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
from /usr/include/c++/8.2.1/string:52,
from /usr/include/c++/8.2.1/stdexcept:39,
from /home/hanslovskyp/git/graph/src/command-line-tools/lift-mp-grid-graph.cxx:1:
/usr/include/c++/8.2.1/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’
abs(long __i) { return __builtin_labs(__i); }
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:70:3: note: candidate: ‘constexpr double std::abs(double)’
abs(double __x)
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:74:3: note: candidate: ‘constexpr float std::abs(float)’
abs(float __x)
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:78:3: note: candidate: ‘constexpr long double std::abs(long double)’
abs(long double __x)
^~~
In file included from /usr/include/c++/8.2.1/cstdlib:75,
from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
from /usr/include/c++/8.2.1/string:52,
from /usr/include/c++/8.2.1/stdexcept:39,
from /home/hanslovskyp/git/graph/src/command-line-tools/lift-mp-grid-graph.cxx:1:
/usr/include/stdlib.h:837:12: note: candidate: ‘int abs(int)’
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^~~
In file included from /home/hanslovskyp/git/graph/src/command-line-tools/lift-mp-grid-graph.cxx:13:
/home/hanslovskyp/git/graph/include/andres/graph/lifting.hxx:206:84: error: call of overloaded ‘abs(std::size_t)’ is ambiguous
const std::size_t distance = std::abs(x - cv[0]) + std::abs(y - cv[1]);
~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/8.2.1/cstdlib:77,
from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
from /usr/include/c++/8.2.1/string:52,
from /usr/include/c++/8.2.1/stdexcept:39,
from /home/hanslovskyp/git/graph/src/command-line-tools/lift-mp-grid-graph.cxx:1:
/usr/include/c++/8.2.1/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’
abs(long __i) { return __builtin_labs(__i); }
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:70:3: note: candidate: ‘constexpr double std::abs(double)’
abs(double __x)
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:74:3: note: candidate: ‘constexpr float std::abs(float)’
abs(float __x)
^~~
/usr/include/c++/8.2.1/bits/std_abs.h:78:3: note: candidate: ‘constexpr long double std::abs(long double)’
abs(long double __x)
^~~
In file included from /usr/include/c++/8.2.1/cstdlib:75,
from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
from /usr/include/c++/8.2.1/string:52,
from /usr/include/c++/8.2.1/stdexcept:39,
from /home/hanslovskyp/git/graph/src/command-line-tools/lift-mp-grid-graph.cxx:1:
/usr/include/stdlib.h:837:12: note: candidate: ‘int abs(int)’
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^~~
make[2]: *** [CMakeFiles/lift-mp-grid-graph.dir/build.make:63: CMakeFiles/lift-mp-grid-graph.dir/src/command-line-tools/lift-mp-grid-graph.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:221: CMakeFiles/lift-mp-grid-graph.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
gcc --version
gcc (GCC) 8.2.1 20181127
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Steps to reproduce:
git clone [email protected]:bjoern-andres/graph
cd graph
mkdir build-1.11
cd build-1.11
git checkout v1.11
cmake .. -DCMAKE_INSTALL_PREFIX=$LOCAL
make
In the file ./include/nl-lmp/problem.hxx : line 5, it includes a file 'andres/marray.h'. But there is no such file in the path.
In the multicut ilp implementation graph/ilp.hxx you search for a path in
(https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/multicut/ilp.hxx#L89)
The path
is filled with edge indices.
(https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L639).
But later on in line 100 the path is used as if it would be filled with node indices.
(https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/multicut/ilp.hxx#L100)
I am running in a compilation failure on 32bit platforms for the shortest-paths.cxx
test. The symptoms are the following:
/home/bluescarni/repos/graph/include/andres/graph/shortest-paths.hxx:1542:22: error: lvalue required as left operand of assignment
distances[v] = infinity;
~~~~~~~~~~~~~^~~~~~~~~~
/home/bluescarni/repos/graph/include/andres/graph/shortest-paths.hxx:1547:19: error: lvalue required as left operand of assignment
distances[vs] = 0;
~~~~~~~~~~~~~~^~~
/home/bluescarni/repos/graph/include/andres/graph/shortest-paths.hxx:1565:45: error: lvalue required as left operand of assignment
distances[it->vertex()] = alternativeDistance;
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
The problem seems to be that, on some 32bit platforms, std::size_t
and unsigned
are the same type. What happens then is that this call:
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1364
resolves to this function (on 32bit platforms)
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1376
rather than this:
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1448
So when the flow finally gets inside this function:
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1516
DISTANCE_ITERATOR
is of type UnitEdgeValueIterator
, and the line distances[v] = infinity;
fails because distances[v]
yields a value rather than a reference.
The issue can be reproduced on 32bit build on MSVC, clang and gcc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.