void randomMove_sa(Allocation &a) { //srand(time(NULL)); int type = rand()%4; long offset; TaskSet* ts; if(type != 3) { do{ offset = rand()%a.getCoreNum(); ts = a.getTaskSet(offset); }while((*ts).getTaskSetSize() == 0); } switch(type){ case 0: //std::cout<<"Swap...."<<std::endl; (*ts).randomSwapPriorities(); break; case 1: //std::cout<<"Merge...."<<std::endl; (*ts).randomMerge(); break; case 2: //std::cout<<"Partition..."<<std::endl; (*ts).randomPartition(); break; case 3: //std::cout<<"Allocation..."<<std::endl; a.randomMoveAllocation(); //int cnt=0; //Allocation a_tmp(a); //do{ // a_tmp.randomMoveAllocation(); //}while(a_tmp.cycleDetection() && cnt < 10); //if(cnt < 10) // a = a_tmp; break; } }