|
@@ -12,6 +12,7 @@ using namespace std::chrono;
|
|
|
|
|
|
fstream file;
|
|
fstream file;
|
|
|
|
|
|
|
|
+
|
|
void treat(const monoid& m){
|
|
void treat(const monoid& m){
|
|
// int w=m.e*m.left-m.conductor;
|
|
// int w=m.e*m.left-m.conductor;
|
|
int q=ceil(float(m.conductor)/float(m.min));
|
|
int q=ceil(float(m.conductor)/float(m.min));
|
|
@@ -30,13 +31,43 @@ bool cut(const monoid& m){
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
-void walk_children(monoid m)
|
|
|
|
|
|
+void walk(int m,int k)
|
|
{
|
|
{
|
|
monoid data[MAX_GENUS-1], *stack[MAX_GENUS], *current,temp;
|
|
monoid data[MAX_GENUS-1], *stack[MAX_GENUS], *current,temp;
|
|
- monoid **stack_pointer = stack + 1;
|
|
|
|
-
|
|
|
|
- for (ind_t i=1; i<MAX_GENUS; i++) stack[i] = &(data[i-1]); // Nathann's trick to avoid copy
|
|
|
|
- stack[0] = &m;
|
|
|
|
|
|
+ monoid **stack_pointer = stack+1;
|
|
|
|
+ for (ind_t i=1; i<MAX_GENUS; i++) stack[i] = &(data[i-1]);
|
|
|
|
+ init_ordinary(data[0],m);
|
|
|
|
+ for(int i=0;i<k;++i){
|
|
|
|
+ auto it = generator_iter<CHILDREN>(data[i]);
|
|
|
|
+ it.move_next();
|
|
|
|
+ // printq_monoid_gen(data[i]);
|
|
|
|
+ ind_t pos=0;
|
|
|
|
+ if(i==0){
|
|
|
|
+ it.move_next();
|
|
|
|
+ pos=1;
|
|
|
|
+ }
|
|
|
|
+ remove_generator(data[i+1],data[i],it.get_gen(),pos);
|
|
|
|
+ }
|
|
|
|
+ temp=data[k];
|
|
|
|
+ stack[0]=&temp;
|
|
|
|
+ cout<<"Root : ";
|
|
|
|
+ print_monoid_gen(temp);
|
|
|
|
+
|
|
|
|
+ auto it = generator_iter<CHILDREN>(temp);
|
|
|
|
+ it.move_next();
|
|
|
|
+ ind_t pos=1;
|
|
|
|
+ if(k==0){
|
|
|
|
+ it.move_next();
|
|
|
|
+ ++pos;
|
|
|
|
+ }
|
|
|
|
+ while (it.move_next()){
|
|
|
|
+ stack_pointer[0] = stack_pointer[1];
|
|
|
|
+ remove_generator(**stack_pointer, temp, it.get_gen(),pos++);
|
|
|
|
+ cout<<"Pop "<<it.get_gen()<<" : ";
|
|
|
|
+ print_monoid_gen(**stack_pointer);
|
|
|
|
+ treat(**stack_pointer);
|
|
|
|
+ stack_pointer++;
|
|
|
|
+ }
|
|
while (stack_pointer != stack)
|
|
while (stack_pointer != stack)
|
|
{
|
|
{
|
|
--stack_pointer;
|
|
--stack_pointer;
|
|
@@ -56,7 +87,6 @@ void walk_children(monoid m)
|
|
stack_pointer++;
|
|
stack_pointer++;
|
|
}
|
|
}
|
|
*stack_pointer = current;
|
|
*stack_pointer = current;
|
|
-
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -76,17 +106,15 @@ void walk_children(monoid m)
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
int main(int argc, char **argv)
|
|
{
|
|
{
|
|
- monoid O,S;
|
|
|
|
- string nproc = "0";
|
|
|
|
-
|
|
|
|
- if(argc!=3){
|
|
|
|
- cerr<<"Usage : "<<argv[0]<<" [m] [k] with k in [1,m-1]"<<endl;
|
|
|
|
|
|
+ if(argc!=4){
|
|
|
|
+ cerr<<"Usage : "<<argv[0]<<" [m] [k] filename with k in [0,MAX_GENUS-m]"<<endl;
|
|
exit(-1);
|
|
exit(-1);
|
|
}
|
|
}
|
|
int m=atoi(argv[1]);
|
|
int m=atoi(argv[1]);
|
|
int k=atoi(argv[2]);
|
|
int k=atoi(argv[2]);
|
|
- if(k<=0 or k>=m){
|
|
|
|
- cerr<<"k must be in [1,m-1]"<<endl;
|
|
|
|
|
|
+ char* filename_base=argv[3];
|
|
|
|
+ if(k<0 or k>=MAX_GENUS-m){
|
|
|
|
+ cerr<<"k must be in [0,MAX_GENUS-m]"<<endl;
|
|
exit(-2);
|
|
exit(-2);
|
|
}
|
|
}
|
|
unsigned int ax, bx, cx, dx;
|
|
unsigned int ax, bx, cx, dx;
|
|
@@ -108,13 +136,13 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
|
|
cout << "Testing Wilf's conjecture for numerical semigroups of genus <= "
|
|
cout << "Testing Wilf's conjecture for numerical semigroups of genus <= "
|
|
- << MAX_GENUS << " which are sons of O_{"<<m<<"}\\{"<<m+k<<"}."<<endl;
|
|
|
|
|
|
+ << MAX_GENUS << " for m="<<m<<" and k="<<k<<"."<<endl;
|
|
|
|
+ /*cerr << "Testing Wilf's conjecture for numerical semigroups of genus <= "
|
|
|
|
+ << MAX_GENUS << " for m="<<m<<" and k="<<k<<"."<<endl;*/
|
|
auto begin = high_resolution_clock::now();
|
|
auto begin = high_resolution_clock::now();
|
|
- init_ordinary(O,m);
|
|
|
|
- remove_generator(S,O,m+k,k);
|
|
|
|
- string filename="output3/wilf_"+to_string(m)+"_"+to_string(k);
|
|
|
|
|
|
+ string filename=string(filename_base)+"_wilf_"+to_string(m)+"_"+to_string(k);
|
|
file.open(filename.c_str(),ios::out|ios::trunc);
|
|
file.open(filename.c_str(),ios::out|ios::trunc);
|
|
- walk_children(S);
|
|
|
|
|
|
+ walk(m,k);
|
|
auto end = high_resolution_clock::now();
|
|
auto end = high_resolution_clock::now();
|
|
duration<double> ticks = end-begin;
|
|
duration<double> ticks = end-begin;
|
|
cout << " Computation time = " << std::setprecision(4) << ticks.count() << " s." << endl;
|
|
cout << " Computation time = " << std::setprecision(4) << ticks.count() << " s." << endl;
|