int main(int argc, char *argv[]){ if(argc < 3) { fprintf(stderr, "Please add drop and corrupt rates\n"); exit(0); } setRates(atoi(argv[1]), atoi(argv[2])); //begin cleint initServer(); printf("Server has begun.\n"); char buffer[PACKET_SIZE]; char testbuffer[PACKET_SIZE]; strcpy(testbuffer, "Testdatafromserver."); int n = 0; while(1){ //check for command comming in checkCommands(buffer); int rsend = (rand() % 100)+1; if(n == 0 && rsend > 95){ //n = dataLinkSend(testbuffer, strlen(testbuffer)); } } return(1); }
CTimer::CTimer() { m_FPSCountTime = m_LoopPS = m_LPS = m_FPS = 0; m_SyncCount = m_LoopCount = m_LogicCount = m_FrameCount = 0; m_FrameCountSkip = m_SkipPS = 0; m_FrameSkip = false; m_Ticks = 0; setRates(DEFAULT_LPS, DEFAULT_FPS, DEFAULT_SYNC); #if defined(WIZ) WIZ_ptimer_init(); #endif m_SyncStartTime = m_LoopStartTime = timerTicks(); g_pLogFile->textOut(GREEN, true, "Starting timer driver...\n"); }
double RateMeyerHaeseler::optimizeParameters(double epsilon) { assert(phylo_tree); double tree_lh = phylo_tree->computeLikelihood(); DoubleVector prev_rates; getRates(prev_rates); if (empty()) { if (rate_file) { readRateFile(rate_file); phylo_tree->clearAllPartialLH(); return phylo_tree->optimizeAllBranches(); } initializeRates(); } optimizeRates(); phylo_tree->clearAllPartialLH(); stringstream best_tree_string; phylo_tree->printTree(best_tree_string, WT_BR_LEN + WT_TAXON_ID); double new_tree_lh = phylo_tree->optimizeAllBranches(1); //double new_tree_lh = phylo_tree->computeLikelihood(); if (new_tree_lh < tree_lh - 1e-5) { cout << "Worse likelihood (" << new_tree_lh << "), roll back site rates..." << endl; setRates(prev_rates); phylo_tree->rollBack(best_tree_string); //phylo_tree->clearAllPartialLh(); new_tree_lh = phylo_tree->computeLikelihood(); //cout << "Backup log-likelihood: " << new_tree_lh << endl; new_tree_lh = tree_lh; } return new_tree_lh; }
void CTimer::setFPS( const int framerate ) { setRates(DEFAULT_LPS, framerate, DEFAULT_SYNC); }