|
@@ -10,16 +10,8 @@
|
|
|
#include "treewalk.hpp"
|
|
|
|
|
|
using namespace std;
|
|
|
-using namespace std::chrono;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-bool stack_correct;
|
|
|
-#define SIGNAL_CHECKPOINT SIGUSR2
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-void treat(const Semigroup& m){
|
|
|
+/*void treat(const Semigroup& m){
|
|
|
int q=ceil(float(m.conductor)/float(m.min));
|
|
|
unsigned int rho=q*m.min-m.conductor;
|
|
|
if(m.wilf<=rho){
|
|
@@ -27,107 +19,37 @@ void treat(const Semigroup& m){
|
|
|
//output(m,file_out);
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
|
|
-void walk(Stack& stack,size_t* res){
|
|
|
+void walk(Stack& stack,Results& res){
|
|
|
Semigroup *current,*son;
|
|
|
Semigroup temp;
|
|
|
while(not stack.is_empty()){
|
|
|
current = stack.pop();
|
|
|
size_t g=current->genus;
|
|
|
- if(true or not cut(*current)){
|
|
|
- if(g < MAX_GENUS - 1){
|
|
|
- auto it=generator_iter<CHILDREN>(*current);
|
|
|
- ind_t pos=0;
|
|
|
- while (it.move_next()){
|
|
|
- remove_generator(temp, *current, it.get_gen(),pos++);
|
|
|
- if(is_special(temp)){
|
|
|
- son=stack.pushed();
|
|
|
- *son=temp;
|
|
|
- res[g+1]++;
|
|
|
- }
|
|
|
- //treat(*son);
|
|
|
+ if(g<MAX_GENUS-1){
|
|
|
+ auto it=generator_iter<CHILDREN>(*current);
|
|
|
+ ind_t pos=0;
|
|
|
+ while(it.move_next()){
|
|
|
+ remove_generator(temp, *current, it.get_gen(),pos++);
|
|
|
+ if(not cut(temp)){
|
|
|
+ treat(temp,res);
|
|
|
+ son=stack.pushed();
|
|
|
+ *son=temp;
|
|
|
}
|
|
|
}
|
|
|
- else{
|
|
|
- auto it = generator_iter<CHILDREN>(*current);
|
|
|
- ind_t pos=0;
|
|
|
- while (it.move_next()){
|
|
|
- remove_generator(temp, *current, it.get_gen(),pos++);
|
|
|
- if(is_special(temp)){
|
|
|
- res[g+1]++;
|
|
|
- }
|
|
|
- //treat(temp);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ auto it = generator_iter<CHILDREN>(*current);
|
|
|
+ ind_t pos=0;
|
|
|
+ while(it.move_next()){
|
|
|
+ remove_generator(temp, *current, it.get_gen(),pos++);
|
|
|
+ if(not cut(temp)){
|
|
|
+ treat(temp,res);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-/*int main(int argc, char **argv){
|
|
|
- if(argc!=2){
|
|
|
- cerr<<"Usage : "<<argv[0]<<" tasks/task_file"<<endl;
|
|
|
- exit(-1);
|
|
|
- }
|
|
|
- char* task_filename=argv[1];
|
|
|
- unsigned int ax, bx, cx, dx;
|
|
|
- if (!__get_cpuid(0x00000001, &ax, &bx, &cx, &dx)){
|
|
|
- cerr << "Unable to determine the processor type !" << endl;
|
|
|
- return EXIT_FAILURE;
|
|
|
- }
|
|
|
- if (!(cx & bit_SSSE3)){
|
|
|
- cerr << "This programm require sse3 instructions set !" << endl;
|
|
|
- return EXIT_FAILURE;
|
|
|
- }
|
|
|
- if (!(cx & bit_POPCNT)){
|
|
|
- cerr << "This programm require popcount instruction !" << endl;
|
|
|
- return EXIT_FAILURE;
|
|
|
- }
|
|
|
- fstream file_in;
|
|
|
- file_in.open(task_filename,ios::in|ios::binary);
|
|
|
- string filename=string("tasks/")+task_filename;
|
|
|
- filename+="-out";
|
|
|
- file_out.open(filename,ios::out|ios::trunc);
|
|
|
- Stack stack;
|
|
|
- char d[3*MAX_GENUS+1];
|
|
|
- char c,g,m;
|
|
|
- size_t n;
|
|
|
- file_in.read((char*)&n,8);
|
|
|
- cout<<"Stack size = "<<n<<endl;
|
|
|
- for(size_t i=0;i<n;++i){
|
|
|
- file_in.read(&c,1);
|
|
|
- file_in.read(&g,1);
|
|
|
- file_in.read(&m,1);
|
|
|
- file_in.read(d,3*MAX_GENUS+1);
|
|
|
- Semigroup* S=stack.pushed();
|
|
|
- init(*S,c,g,m,d);
|
|
|
- treat(*S);
|
|
|
- }
|
|
|
- file_in.close();
|
|
|
- checkpoint=false;
|
|
|
- signal(SIGNAL_CHECKPOINT, signal_checkpoint_handler);
|
|
|
- walk(stack);
|
|
|
-
|
|
|
- file_out.close();
|
|
|
- if(checkpoint){
|
|
|
- cout<<"Stoping exploration due to checkpoint signal reception."<<endl;
|
|
|
- filename=string("tasks/checkpoint/")+task_filename+string("-checkpoint");
|
|
|
- fstream file_stack;
|
|
|
- file_stack.open(filename.c_str(),ios::out|ios::binary);
|
|
|
- size_t size=stack.stack_size;
|
|
|
- file_stack.write((char*)(&size),8);
|
|
|
- cout<<"Checkpoint size : "<<size<<endl;
|
|
|
- for(size_t i=0;i<size;++i){
|
|
|
- record(*stack.stack[i],file_stack);
|
|
|
- }
|
|
|
- file_stack.close();
|
|
|
- return 1;
|
|
|
- }
|
|
|
- else{
|
|
|
- return 0;
|
|
|
- }
|
|
|
-}
|
|
|
-*/
|