[opengm] 335/386: fixed include guards and WITH_*** problems for intersection based
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:38:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository opengm.
commit 20f60dca6766ce9b58ef03c55426aaf1794c53b5
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date: Fri Mar 25 13:31:10 2016 +0100
fixed include guards and WITH_*** problems for intersection based
---
.travis.yml | 149 +++++++++----
.../fusion_move/permutable_label_fusion_mover.hxx | 233 +++------------------
2 files changed, 146 insertions(+), 236 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index e771e47..c92bf48 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,36 +1,115 @@
language: cpp
-compiler:
- - gcc
- - clang
-before_install :
- - sudo add-apt-repository https://launchpad.net/~gnode/+archive/pandora
- - sudo apt-get update -qq
- - sudo apt-get install -qq libhdf5-dev
- - sudo apt-get install python-numpy
- - sudo apt-get install python-pip
- - sudo add-apt-repository ppa:ukplc-team/testing -y
- - sudo apt-get update -qq
- - sudo apt-get install -qq python-nose libboost1.49-dev libboost-python1.49-dev
- #- wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.bz2
- #- tar --bzip2 -xf boost_1_54_0.tar.bz2
- #- cd boost_1_54_0
- #- ./bootstrap.sh --help
- #- sudo ./bootstrap.sh --with-libraries=python
- #- sudo ./b2 install
- #- cd ..
-
-
-
-# Change this to your needs..
-script:
- #- cmake . -DWITH_BOOST=FALSE -DWITH_HDF5=FALSE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=FALSE -DBUILD_COMMANDLINE=FALSE
- #- make -j6
- #- make test ARGS="-V"
- - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
- #- make externalLibs -j4
- - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
- - make -j4
- - make test ARGS="-V"
- - make test-python-wrapper
- - sudo make install
- #- python src/interfaces/python/examples/markov_chain.py
+sudo: false
+cache:
+ directories:
+ - $HOME/.cache/pip
+
+
+addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ #- launchpad.net/~gnode/+archive/pandora
+ - deadsnakes
+ packages:
+ - g++-4.8
+ - g++-4.8-multilib
+ - g++-multilib
+ #- python3.5
+ #- python3.5-dev
+ #- python3.5-venv
+ #- python3.5-dev:i386
+ - libboost-test-dev
+ - libhdf5-dev
+ - python-numpy
+ - python-pip
+ - python-nose
+
+
+
+
+
+matrix:
+ include:
+ - os: linux
+ compiler: gcc-4.8
+ script:
+ - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
+ #- make externalLibs -j4
+ - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
+ - make -j4
+ - make test ARGS="-V"
+ - make test-python-wrapper
+ - sudo make install
+ #
+ - os: osx
+ compiler: clang
+ script:
+ - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
+ #- make externalLibs -j4
+ - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
+ - make -j4
+ - make test ARGS="-V"
+ - make test-python-wrapper
+ - sudo make install
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#################################
+## OLD TRAVIS
+#################################
+
+
+
+
+# compiler:
+# - gcc
+# - clang
+# before_install :
+# - sudo add-apt-repository https://launchpad.net/~gnode/+archive/pandora
+# - sudo apt-get update -qq
+# - sudo apt-get install -qq libhdf5-dev
+# - sudo apt-get install python-numpy
+# - sudo apt-get install python-pip
+# - sudo add-apt-repository ppa:ukplc-team/testing -y
+# - sudo apt-get update -qq
+# - sudo apt-get install -qq python-nose libboost1.49-dev libboost-python1.49-dev
+# #- wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.bz2
+# #- tar --bzip2 -xf boost_1_54_0.tar.bz2
+# #- cd boost_1_54_0
+# #- ./bootstrap.sh --help
+# #- sudo ./bootstrap.sh --with-libraries=python
+# #- sudo ./b2 install
+# #- cd ..
+
+
+
+# # Change this to your needs..
+# script:
+# #- cmake . -DWITH_BOOST=FALSE -DWITH_HDF5=FALSE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=FALSE -DBUILD_COMMANDLINE=FALSE
+# #- make -j6
+# #- make test ARGS="-V"
+# - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
+# #- make externalLibs -j4
+# - cmake . -DWITH_BOOST=TRUE -DWITH_HDF5=TRUE -DWITH_AD3=FALSE -DWITH_TRWS=FALSE -DWITH_QPBO=FALSE -DWITH_MRF=FALSE -DWITH_GCO=FALSE -DWITH_CONICBUNDLE=FALSE -DWITH_MAXFLOW=FALSE -DWITH_MAXFLOW_IBFS=FALSE -DBUILD_PYTHON_WRAPPER=TRUE -DBUILD_COMMANDLINE=FALSE -DCI=TRUE
+# - make -j4
+# - make test ARGS="-V"
+# - make test-python-wrapper
+# - sudo make install
+# #- python src/interfaces/python/examples/markov_chain.py
diff --git a/include/opengm/inference/auxiliary/fusion_move/permutable_label_fusion_mover.hxx b/include/opengm/inference/auxiliary/fusion_move/permutable_label_fusion_mover.hxx
index c57b601..b422a94 100644
--- a/include/opengm/inference/auxiliary/fusion_move/permutable_label_fusion_mover.hxx
+++ b/include/opengm/inference/auxiliary/fusion_move/permutable_label_fusion_mover.hxx
@@ -225,18 +225,11 @@ public:
#endif
if(param_.fusionSolver_ == DefaultSolver){
- #ifdef WITH_QPBO
+ #if defined(WITH_QPBO) || (defined(WITH_PLANARITY) && defined(WITH_BLOSSOM5))
param_.fusionSolver_ = CgcSolver;
#endif
}
if(param_.fusionSolver_ == DefaultSolver){
- #ifdef WITH_ISINF
- if(param_.planar_){
- param_.fusionSolver_ = CgcSolver;
- }
- #endif
- }
- if(param_.fusionSolver_ == DefaultSolver){
#ifndef NOVIGRA
if(param_.planar_){
param_.fusionSolver_ = HierachicalClusteringSolver;
@@ -244,9 +237,24 @@ public:
#endif
}
if(param_.fusionSolver_ == DefaultSolver){
- throw RuntimeError("WITH_CPLEX or WITH_QPBO or WITH_ISINF must be enabled");
+ throw RuntimeError("WITH_CLEX || defined(WITH_QPBO) || (defined(WITH_PLANARITY) && defined(WITH_BLOSSOM5)) must be enabled");
}
}
+ else if(param_.fusionSolver_ == MulticutSolver){
+ #ifndef WITH_CPLEX
+ throw RuntimeError("WITH_CLEX must be enabled for this fusionSolver");
+ #endif
+ }
+ else if(param_.fusionSolver_ == CgcSolver){
+ #if ! (defined(WITH_QPBO) || (defined(WITH_PLANARITY) && defined(WITH_BLOSSOM5)) )
+ throw RuntimeError("defined(WITH_QPBO) || (defined(WITH_PLANARITY) && defined(WITH_BLOSSOM5)) must be enabled for this fusionSolver");
+ #endif
+ }
+ else if(param_.fusionSolver_ == HierachicalClusteringSolver){
+ #ifndef WITH_VIGRA
+ throw RuntimeError("WITH_VIGRA must be enabled for this fusionSolver");
+ #endif
+ }
}
@@ -480,197 +488,8 @@ public:
}
}
- bool fuseMmwc(
- const std::vector<LabelType> & a,
- const std::vector<LabelType> & b,
- std::vector<LabelType> & res,
- const ValueType valA,
- const ValueType valB,
- ValueType & valRes
- ){
- std::vector<LabelType> ab(gm_.numberOfVariables());
- IndexType numNewVar = this->intersect(a, b, ab);
-
- if(numNewVar==1){
- return false;
- }
-
- const ValueType intersectedVal = gm_.evaluate(ab);
-
-
-
- // get the new smaller graph
-
-
- MapType accWeights;
- size_t erasedEdges = 0;
- size_t notErasedEdges = 0;
-
-
- LabelType lAA[2]={0, 0};
- LabelType lAB[2]={0, 1};
-
- size_t ushape[] = { size_t(numNewVar), size_t(gm_.maxNumberOfLabels()) };
-
- marray::Marray<ValueType> accUnaries(ushape, ushape+2,0.0);
-
- for(size_t fi=0; fi< gm_.numberOfFactors(); ++fi){
- if(gm_[fi].numberOfVariables()==2){
- const size_t vi0 = gm_[fi].variableIndex(0);
- const size_t vi1 = gm_[fi].variableIndex(1);
-
- const size_t cVi0 = ab[vi0] < ab[vi1] ? ab[vi0] : ab[vi1];
- const size_t cVi1 = ab[vi0] < ab[vi1] ? ab[vi1] : ab[vi0];
-
- OPENGM_CHECK_OP(cVi0,<,gm_.numberOfVariables(),"");
- OPENGM_CHECK_OP(cVi1,<,gm_.numberOfVariables(),"");
-
-
- if(cVi0 == cVi1){
- ++erasedEdges;
- }
- else{
- ++notErasedEdges;
-
- // get the weight
- ValueType val00 = gm_[fi](lAA);
- ValueType val01 = gm_[fi](lAB);
- ValueType weight = val01 - val00;
-
- //std::cout<<"vAA"<<val00<<" vAB "<<val01<<" w "<<weight<<"\n";
-
- // compute key
- const UInt64Type key = cVi0 + numNewVar*cVi1;
-
- // check if key is in map
- MapIter iter = accWeights.find(key);
-
- // key not yet in map
- if(iter == accWeights.end()){
- accWeights[key] = weight;
- }
- // key is in map
- else{
- iter->second += weight;
- }
-
- }
-
- }
- if(gm_[fi].numberOfVariables()==1){
- const IndexType cVi = ab[gm_[fi].numberOfVariables()];
- for(LabelType l=0 ; l<ushape[1]; ++l){
- accUnaries(cVi,l)+=gm_[fi](&l);
- }
- }
- }
-
-
-
- OPENGM_CHECK_OP(erasedEdges+notErasedEdges, == , gm_.numberOfFactors(),"something wrong");
-
-
-
-
- return doMoveMmcw(accWeights,accUnaries,ab,numNewVar, a, b, res, valA, valB, valRes);
-
-
- }
- bool doMoveMmcw(
- const MapType & accWeights,
- const marray::Marray<ValueType> & accUnaries,
- const std::vector<LabelType> & ab,
- const IndexType numNewVar,
- const std::vector<LabelType> & a,
- const std::vector<LabelType> & b,
- std::vector<LabelType> & res,
- const ValueType valA,
- const ValueType valB,
- ValueType & valRes
- ){
- // make the actual sub graphical model
- SubSpace subSpace(numNewVar, 2);
- SubModel subGm(subSpace);
-
- // reserve space
- subGm. template reserveFunctions<PFunction>(accWeights.size());
- subGm. template reserveFunctions<EFunction>(numNewVar);
-
- subGm.reserveFactors(accWeights.size()+numNewVar);
- subGm.reserveFactorsVarialbeIndices(accWeights.size()*2+numNewVar);
- size_t efshape[] = {accUnaries.shape(1)};
- EFunction ef(efshape,efshape+1);
-
- // unaries
- for(IndexType vi=0; vi<numNewVar; ++vi){
- for(LabelType l=0; l<accUnaries.shape(1); ++l){
- ef(&l) = accUnaries(vi, l);
- }
- subGm.addFactor(subGm.addFunction(ef), &vi, &vi+1);
- }
-
- // higher order
- for(MapCIter i = accWeights.begin(); i!=accWeights.end(); ++i){
- const UInt64Type key = i->first;
- const ValueType weight = i->second;
-
- const UInt64Type cVi1 = key/numNewVar;
- const UInt64Type cVi0 = key - cVi1*numNewVar;
- const UInt64Type vis[2] = {cVi0, cVi1};
-
- PFunction pf(numNewVar, numNewVar, 0.0, weight);
- subGm.addFactor(subGm.addFunction(pf), vis, vis+2);
- }
-
- std::vector<LabelType> subArg;
-
-
- //::cout<<"WITH MC\n";
- typedef Multicut<SubModel, Minimizer> Inf;
- typedef typename Inf::Parameter Param;
- Param p(0,0.0);
-
- if(param_.nThreads_ <= 0){
- p.numThreads_ = 0;
- }
- else{
- p.numThreads_ = param_.nThreads_;
- }
- p.workFlow_ = param_.workflow_;
- p.allowCutsWithin_ = param_.allowCutsWithin_;
-
-
- Inf inf(subGm,p);
- inf.infer();
-
- // special arg
- std::vector<size_t> oarg = inf.getSegmentation();
- // usual arg
- inf.arg(subArg);
-
- for(IndexType vi=0; vi<gm_.numberOfVariables(); ++vi){
- res[vi] = oarg[ab[vi]];
- }
- ValueType resultVal = subGm.evaluate(subArg);
- //std::cout<<"gm val inf "<<resultVal<<"\n";
- // add the weight from the cuts within
- const LabelType lAB[] = {0,1};
- for(size_t f=0; f<subGm.numberOfFactors(); ++f){
- if(gm_.numberOfFactors()==1){
- IndexType vi0 = subGm[f].variableIndex(0);
- IndexType vi1 = subGm[f].variableIndex(1);
-
- if(subArg[vi0] == subArg[vi1] && oarg[vi0] != oarg[vi1]){
- resultVal+=gm_[f](lAB);
- }
- }
- }
- //std::cout<<"mmcw val inf "<<resultVal<<"\n";
- valRes = resultVal;
- return true;
- }
bool doMoveCgc(
const MapType & accWeights,
const std::vector<LabelType> & ab,
@@ -682,7 +501,7 @@ public:
const ValueType valB,
ValueType & valRes
){
-
+ #if defined(WITH_QPBO) || (defined(WITH_PLANARITY) && defined(WITH_BLOSSOM5))
// make the actual sub graphical model
SubSpace subSpace(numNewVar, numNewVar);
@@ -738,7 +557,10 @@ public:
}
}
return true;
-
+ #else
+ throw RuntimeError("defined(WITH_QPBO) || (defined(WITH_PLANARITY) && defined(WITH_BLOSSOM5))");
+ return false;
+ #endif
}
bool doMoveBase(
@@ -771,6 +593,7 @@ public:
const ValueType valB,
ValueType & valRes
){
+ #ifdef WITH_CPLEX
// make the actual sub graphical model
SubSpace subSpace(numNewVar, numNewVar);
SubModel subGm(subSpace);
@@ -852,6 +675,10 @@ public:
}
}
return true;
+ #else
+ throw RuntimeError("needs WITH_CPLEX");
+ return false;
+ #endif
}
@@ -866,7 +693,7 @@ public:
const ValueType valB,
ValueType & valRes
){
-
+ #ifdef WITH_CPLEX
std::vector<LabelType> subArg;
//::cout<<"WITH MC\n";
@@ -908,6 +735,10 @@ public:
}
}
return true;
+ #else
+ throw RuntimeError("needs WITH_CPLEX");
+ return false;
+ #endif
}
bool doMoveHierachicalClustering(
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git
More information about the debian-science-commits
mailing list