[opengm] 01/40: minor changes

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 14 16:06:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository opengm.

commit 819601aafaf685741a89fb4a00be80497b802f8d
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date:   Tue Oct 13 19:15:48 2015 +0200

    minor changes
---
 .../fusion_move/permutable_label_fusion_mover.hxx  |   5 +-
 .../python/opengm/inference/inference.cpp          |   4 +-
 src/interfaces/python/opengm/inference/pyCgc.cxx   | 166 +++++++++++++++++++--
 src/interfaces/python/opengm/inference/pyCgc.hxx   |   5 +-
 .../opengm/inference/pyIntersectionBased.cxx       |   6 +-
 5 files changed, 162 insertions(+), 24 deletions(-)

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 39f28e5..c57b601 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
@@ -3,12 +3,15 @@
 
 
 #include <opengm/inference/inference.hxx>
+#ifdef WITH_CPLEX
 #include <opengm/inference/multicut.hxx>
 #include <opengm/inference/dmc.hxx>
+#endif
 #include "opengm/inference/auxiliary/fusion_move/fusion_mover.hxx"
 
-// FIXME
+#if defined(WITH_QPBO) || (defined(WITH_PLANARITY) && defined(WITH_BLOSSOM5)) 
 #include <opengm/inference/cgc.hxx>
+#endif 
 
 #include <opengm/graphicalmodel/graphicalmodel.hxx>
 #include <opengm/graphicalmodel/space/simplediscretespace.hxx>
diff --git a/src/interfaces/python/opengm/inference/inference.cpp b/src/interfaces/python/opengm/inference/inference.cpp
index fe40e89..c87ff5e 100644
--- a/src/interfaces/python/opengm/inference/inference.cpp
+++ b/src/interfaces/python/opengm/inference/inference.cpp
@@ -70,7 +70,7 @@
 
 
 
-#if defined(WITH_QPBO) || defined(WITH_CPLEX) || defined(WITH_BLOSSOM5) && defined(WITH_PLANARITY)
+#if !defined(NOVIGRA) && (defined(WITH_QPBO) || (defined(WITH_BLOSSOM5) && defined(WITH_PLANARITY) ) )
 #include "pyCgc.hxx"
 #include "pyIntersectionBased.hxx"
 #endif
@@ -182,7 +182,7 @@ BOOST_PYTHON_MODULE_INIT(_inference) {
 
 
 
-        #if defined(WITH_QPBO) || defined(WITH_CPLEX) || defined(WITH_BLOSSOM5) && defined(WITH_PLANARITY)
+        #if  !defined(NOVIGRA) && (defined(WITH_QPBO) || (defined(WITH_BLOSSOM5) && defined(WITH_PLANARITY) ) )
         export_cgc<opengm::python::GmAdder,opengm::Minimizer>();
         //export_intersection_based<opengm::python::GmAdder,opengm::Minimizer>();
         #endif
diff --git a/src/interfaces/python/opengm/inference/pyCgc.cxx b/src/interfaces/python/opengm/inference/pyCgc.cxx
index 79b5538..0f8c7c4 100644
--- a/src/interfaces/python/opengm/inference/pyCgc.cxx
+++ b/src/interfaces/python/opengm/inference/pyCgc.cxx
@@ -1,4 +1,4 @@
-#if defined(WITH_QPBO) || defined(WITH_BLOSSOM5) && defined(WITH_PLANARITY)
+#if !defined(NOVIGRA) && (defined(WITH_QPBO) || (defined(WITH_BLOSSOM5) && defined(WITH_PLANARITY) ) )
 #include <boost/python.hpp>
 #include <string>
 #include "inf_def_visitor.hxx"
@@ -8,30 +8,166 @@
 #include <opengm/inference/cgc.hxx>
 #include <param/cgc_param.hxx>
 
+#include <opengm/inference/intersection_based_inf.hxx>
+#include <param/intersection_based_param.hxx>
+
+#ifdef WITH_CPLEX
+#include "opengm/inference/auxiliary/fusion_move/permutable_label_fusion_mover.hxx"
+#endif
+
+#include <opengm/inference/intersection_based_inf.hxx>
+#include <param/intersection_based_param.hxx>
+#include "opengm/inference/auxiliary/fusion_move/permutable_label_fusion_mover.hxx"
+
+
+
+template<class GEN>
+void export_intersection_based_t( InfSetup & setup, const std::string & genName){
+
+    typedef opengm::IntersectionBasedInf<typename GEN::GraphicalModelType, GEN> INF; 
+    setup.hyperParameters= StringVector(1,genName);
+    const std::string baseName("IntersectionBased");
+    const std::string tBaseName = baseName +  std::string("_") + genName;
+    const std::string name = std::string("_")+tBaseName; 
+    exportInfParam<INF>(name.c_str()); // "IntersectionBased"
+    // export inferencePyIntersectionBasedInf
+    class_< INF>(name.c_str(),init<const typename GEN::GraphicalModelType & >())  
+    .def(InfSuite<INF>(baseName,setup))
+    ;
+}
+
+template<class GEN>
+void export_intersection_based_proposal_param( InfSetup & setup, const std::string & genName){
+
+    setup.hyperParameters= StringVector(1,genName);
+    const std::string baseName("FusionBased");
+    const std::string tBaseName = baseName +  std::string("_") + genName;
+    const std::string name = std::string("_")+tBaseName+std::string("_ProposalParam"); 
+    exportInfParam<GEN>(name.c_str()); // "IntersectionBased"
+}
 
 
 
 
 template<class GM,class ACC>
+void export_intersection_based(){
+    using namespace boost::python;
+    import_array();
+    append_subnamespace("solver");
+
+    // documentation 
+    InfSetup setup;
+    setup.cite       = "";
+    setup.algType    = "fusion-moves";
+    setup.hyperParameterKeyWords        = StringVector(1,std::string("generator"));
+    setup.hyperParametersDoc            = StringVector(1,std::string("proposal generator"));
+    // parameter of inference will change if hyper parameter changes
+    setup.hasInterchangeableParameter   = false;
+
+
+
+    #ifndef NOVIGRA
+    typedef opengm::proposal_gen::RandomizedHierarchicalClustering<GM, opengm::Minimizer>   RHCGen;
+    typedef opengm::proposal_gen::RandomizedWatershed<GM, opengm::Minimizer>                RWSGen;
+    #endif
+
+
+    typedef opengm::proposal_gen::QpboBased<GM, opengm::Minimizer>                QpboGen;
+
+
+    typedef opengm::proposal_gen::WeightRandomization<typename GM::ValueType> WeightRand;
+
+    typedef typename  WeightRand::Parameter PyWeightRand;
+
+
+
+
+
+
+
+    enum_<typename PyWeightRand::NoiseType> ("_WeightRandomization_NoiseType_")
+        .value("normalAdd",    PyWeightRand::NormalAdd)
+        .value("uniformAdd",   PyWeightRand::UniformAdd)
+        .value("normalMult",  PyWeightRand::NormalMult)
+        .value("none",  PyWeightRand::None)
+    ;
+
+    class_<PyWeightRand>("_WeightRandomizerParameter_", init<>())
+        .def_readwrite("noiseType",&PyWeightRand::noiseType_)
+        .def_readwrite("noiseParam",&PyWeightRand::noiseParam_)
+        .def_readwrite("seed",&PyWeightRand::seed_)
+        .def_readwrite("ignoreSeed",&PyWeightRand::ignoreSeed_)
+    ;
+
+
+    exportInfParam<  opengm::PermutableLabelFusionMove<GM, ACC> >("_PermutableLabelFusionMove"); // "IntersectionBased"
+
+    
+
+
+    #ifndef NOVIGRA
+    // RandomizedHierarchicalClustering
+    {   
+        setup.isDefault=true;
+        const std::string genName("randomizedHierarchicalClustering");
+        typedef RHCGen GEN;
+
+        export_intersection_based_proposal_param<GEN>(setup, genName);
+        export_intersection_based_t<GEN>(setup, genName);
+    }
+    // RandomizedHierarchicalClustering
+    {   
+        setup.isDefault=false;
+        const std::string genName("randomizedWatershed");
+        typedef RWSGen GEN;
+
+        export_intersection_based_proposal_param<GEN>(setup, genName);
+        export_intersection_based_t<GEN>(setup, genName);
+    }
+    #endif
+     // Qpbo Based
+    #ifdef WITH_QPBO
+    {   
+        setup.isDefault=false;
+        const std::string genName("qpboBased");
+        typedef QpboGen GEN;
+
+        export_intersection_based_proposal_param<GEN>(setup, genName);
+        export_intersection_based_t<GEN>(setup, genName);
+    }
+    #endif
+    
+}
+
+
+
+template<class GM,class ACC>
 void export_cgc(){
-   using namespace boost::python;
-   import_array();
-   append_subnamespace("solver");
 
-   // setup 
-   InfSetup setup;
-   setup.cite       = "Thorsten Beier";
-   setup.algType    = "multicut";
 
+   {
+      using namespace boost::python;
+      import_array();
+      append_subnamespace("solver");
+
+      // setup 
+      InfSetup setup;
+      setup.cite       = "Thorsten Beier";
+      setup.algType    = "multicut";
+
+
+
+      // export parameter
+      typedef opengm::CGC<GM, ACC>  PyInf;
+      exportInfParam<PyInf>("_Cgc");
+      // export inference
+      class_< PyInf>("_Cgc",init<const GM & >())  
+      .def(InfSuite<PyInf>(std::string("Cgc"),setup))
+      ;
 
+   }
+   export_intersection_based<GM, ACC>();
 
-   // export parameter
-   typedef opengm::CGC<GM, ACC>  PyInf;
-   exportInfParam<PyInf>("_Cgc");
-   // export inference
-   class_< PyInf>("_Cgc",init<const GM & >())  
-   .def(InfSuite<PyInf>(std::string("Cgc"),setup))
-   ;
 }
 
 template void export_cgc<opengm::python::GmAdder,opengm::Minimizer>();
diff --git a/src/interfaces/python/opengm/inference/pyCgc.hxx b/src/interfaces/python/opengm/inference/pyCgc.hxx
index 4a81b21..38bd078 100644
--- a/src/interfaces/python/opengm/inference/pyCgc.hxx
+++ b/src/interfaces/python/opengm/inference/pyCgc.hxx
@@ -1,2 +1,5 @@
+
+#if !defined(NOVIGRA) && (defined(WITH_QPBO) || (defined(WITH_BLOSSOM5) && defined(WITH_PLANARITY) ) )
 template<class GM,class ACC>
-void export_cgc();
\ No newline at end of file
+void export_cgc();
+#endif
\ No newline at end of file
diff --git a/src/interfaces/python/opengm/inference/pyIntersectionBased.cxx b/src/interfaces/python/opengm/inference/pyIntersectionBased.cxx
index 33777dd..6197def 100644
--- a/src/interfaces/python/opengm/inference/pyIntersectionBased.cxx
+++ b/src/interfaces/python/opengm/inference/pyIntersectionBased.cxx
@@ -5,12 +5,8 @@
 
 #include <opengm/inference/intersection_based_inf.hxx>
 #include <param/intersection_based_param.hxx>
-
-
-
-#ifdef WITH_CPLEX
 #include "opengm/inference/auxiliary/fusion_move/permutable_label_fusion_mover.hxx"
-#endif
+
 
 template<class GEN>
 void export_intersection_based_t( InfSetup & setup, const std::string & genName){

-- 
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