浏览代码

Test conjectures

Fromentin Jean 1 年之前
父节点
当前提交
b8df0ac3c3
共有 10 个文件被更改,包括 45 次插入25 次删除
  1. 2 2
      c++/Makefile
  2. 3 1
      c++/src/config.hpp
  3. 16 5
      c++/src/cuts.hpp
  4. 1 1
      c++/src/main-alone.cpp
  5. 3 2
      c++/src/main-cilk.cpp
  6. 1 1
      c++/src/main-server.cpp
  7. 6 3
      c++/src/results.hpp
  8. 0 7
      c++/src/results_cilk.hpp
  9. 1 1
      c++/src/semigroup.hpp
  10. 12 2
      c++/src/treat.hpp

+ 2 - 2
c++/Makefile

@@ -3,8 +3,8 @@ EXE_S 		= wilf-server
 EXE_I 		= wilf-interface
 EXE_A   	= wilf-alone
 EXE_C		= wilf-cilk
-CPP 		= g++-7  -g
-CPP_CILK	= g++-7 -g
+CPP 		= g++-6  -g
+CPP_CILK	= g++-6 -g
 CFLAGS		= --std=c++11 -march=corei7 -O3 -DNDEBUG
 
 all: $(EXE_S) $(EXE_W) $(EXE_I) $(EXE_A) $(EXE_C)

+ 3 - 1
c++/src/config.hpp

@@ -12,6 +12,8 @@ using namespace std;
 
 #define MAX_GENUS 40
 #define STACK_BOUND 10
-#define CILK_WORKERS "4"
+#define CILK_WORKERS "128"
+#define K_MANUEL 4
+
 
 #endif

+ 16 - 5
c++/src/cuts.hpp

@@ -4,10 +4,14 @@
 #include "semigroup.hpp"
 bool cut(const Semigroup& S);
 bool cut_wilf_left_primitives(const Semigroup& S);
-  
+bool is_special(const Semigroup& S);
+bool wilf1(const Semigroup& S);
+bool wilf2(const Semigroup& S);
+bool wilf3(const Semigroup& S);
+
 inline bool cut(const Semigroup& S){
-  return false;
-  // return cut_wilf_left_primitives(S);
+  //return false;
+  return (not wilf1(S)) or (not wilf2(S));
   // return !is_special(S);
 }
 
@@ -18,8 +22,15 @@ inline bool is_special(const Semigroup& S){
   return S.decs[x]==1;
 }
 
-inline bool cut_wilf_left_primitives(const Semigroup& S){
-  return 3*S.left_primitive>=S.min;
+inline bool wilf1(const Semigroup& S){
+  return K_MANUEL*S.left_primitive<S.min;
+}
+
+inline bool wilf2(const Semigroup& S){
+  return (K_MANUEL*S.e)<S.min+K_MANUEL*(MAX_GENUS-S.genus);
 }
 
+/*inline bool wilf3(const Semigroup& S){
+  return 5*S.min<3*(MAX_GENUS+1);
+}*/
 #endif

+ 1 - 1
c++/src/main-alone.cpp

@@ -16,6 +16,6 @@ int main(int argc,char** argv){
     print_Semigroup_gen(res.S_counter_example);
   }
   for(size_t g=0;g<=MAX_GENUS;++g){
-    cout<<g<<","<<res.n[g]<<endl;
+    cout<<g<<","<<res.n1[g]<<","<<res.n2[g]<<endl;
   }
 }

+ 3 - 2
c++/src/main-cilk.cpp

@@ -13,7 +13,7 @@ void cilk_walk(Semigroup S){
     auto it = generator_iter<CHILDREN>(S);
     ind_t pos=0;
     while (it.move_next()){
-      remove_generator(temp,S, it.get_gen(),pos++);
+      remove_generator(temp,S,it.get_gen(),pos++);
       if(not cut(temp)){
 	cilk_spawn cilk_walk(temp);
       }
@@ -32,7 +32,8 @@ int main(){
   cilk_walk(N);
  
   for (size_t g=0; g<=MAX_GENUS; g++){
-    cout << g << " : " <<cilk_results.get_results().n[g] << endl;
+    cout << g << "," <<cilk_results.get_results().n1[g] 
+	<< "," <<cilk_results.get_results().n2[g]<<endl;
   }
   return 0;
 };

+ 1 - 1
c++/src/main-server.cpp

@@ -94,6 +94,6 @@ int main(int argc,char** argv){
     }
   }
   for(size_t g=0;g<=MAX_GENUS;++g){
-    cout<<g<<","<<res.n[g]<<endl;
+    cout<<g<<","<<res.n1[g]<<","<<res.n2[g]<<endl;
   }
 }

+ 6 - 3
c++/src/results.hpp

@@ -8,7 +8,9 @@ using namespace std;
 
 class Results{
 public:
-  size_t n[MAX_GENUS+1];
+  size_t n1[MAX_GENUS+1];
+  size_t n2[MAX_GENUS+1];
+
   bool has_counter_example;
   Semigroup S_counter_example;
 
@@ -21,7 +23,7 @@ inline
 void Results::clear(){
   has_counter_example=false;
   for(size_t g=0;g<=MAX_GENUS;++g){
-    n[g]=0;
+    n1[g]=0;n2[g]=0;
   }
 }
 
@@ -31,7 +33,8 @@ void Results::add(const Results& res){
     S_counter_example=res.S_counter_example;
   }
   for(size_t g=0;g<=MAX_GENUS;++g){
-    n[g]+=res.n[g];
+    n1[g]+=res.n1[g];
+    n2[g]+=res.n2[g];
   }
 }
 

+ 0 - 7
c++/src/results_cilk.hpp

@@ -15,7 +15,6 @@ private:
   cilk::reducer<Monoid> imp_;
 public:
   ResultsReducer();
-  size_t& n(size_t g);
   void reset();
   Results& get_results();
 };
@@ -35,12 +34,6 @@ ResultsReducer::Monoid::reduce(Results* left,Results* right){
   left->add(*right);
 }
 
-
-inline size_t&
-ResultsReducer::n(size_t g){
-  return imp_.view().n[g];
-}
-
 inline Results&
 ResultsReducer::get_results(){
   return imp_.view();

+ 1 - 1
c++/src/semigroup.hpp

@@ -180,7 +180,7 @@ void copy_blocks(dec_blocks &dst, dec_blocks const &src){
 
 #include <cassert>
 
-inline __attribute__((always_inline))
+inline //__attribute__((always_inline))
 void remove_generator(Semigroup &__restrict__ dst,
 		      const Semigroup &__restrict__ src,
 		      ind_t gen,

+ 12 - 2
c++/src/treat.hpp

@@ -1,13 +1,23 @@
+
+
 #ifndef TREAT_HPP
 #define TREAT_HPP
 
 #include "semigroup.hpp"
 #include "results.hpp"
+#include "cuts.hpp"
+
 void treat(const Semigroup& S,Results& res);
   
 inline void treat(const Semigroup& S,Results& res){
-  //cout<<&res<<endl;
-  res.n[S.genus]++;
+  //cout<<&res<<endl;	
+  res.n1[S.genus]++;
+
+    if(is_special(S)){
+      res.n2[S.genus]++;
+    }
+
+  
 }
 
 #endif