void TimetableGenerateForm::start(){ if(!gt.rules.internalStructureComputed){ if(!gt.rules.computeInternalStructure(this)){ QMessageBox::warning(this, TimetableGenerateForm::tr("FET warning"), TimetableGenerateForm::tr("Data is wrong. Please correct and try again")); return; } } if(!gt.rules.initialized || gt.rules.activitiesList.isEmpty()){ QMessageBox::critical(this, TimetableGenerateForm::tr("FET information"), TimetableGenerateForm::tr("You have entered simulation with uninitialized rules or 0 activities...aborting")); assert(0); exit(1); return; } currentResultsTextEdit->setPlainText(TimetableGenerateForm::tr("Entering simulation....precomputing, please be patient")); gen.abortOptimization=false; bool ok=gen.precompute(this); if(!ok){ currentResultsTextEdit->setPlainText(TimetableGenerateForm::tr("Cannot generate - please modify your data")); currentResultsTextEdit->update(); QMessageBox::information(this, TimetableGenerateForm::tr("FET information"), TimetableGenerateForm::tr("Your data cannot be processed - please modify it as instructed")); return; } startPushButton->setDisabled(true); stopPushButton->setEnabled(true); stopHighestPushButton->setEnabled(true); closePushButton->setDisabled(true); writeResultsPushButton->setEnabled(true); writeHighestStagePushButton->setEnabled(true); seeImpossiblePushButton->setEnabled(true); seeInitialOrderPushButton->setEnabled(true); simulation_running=true; gen.c.makeUnallocated(gt.rules); TimetableExport::writeRandomSeed(this, true); //true represents 'before' state generateThread.start(); }
void TimetableGenerateMultipleForm::start(){ nTimetables=timetablesSpinBox->value(); assert(nTimetables>0); timeLimit=60*minutesSpinBox->value(); //seconds assert(timeLimit>0); QDir dir; QString s2=INPUT_FILENAME_XML.right(INPUT_FILENAME_XML.length()-INPUT_FILENAME_XML.lastIndexOf(FILE_SEP)-1); if(s2.right(4)==".fet") s2=s2.left(s2.length()-4); QString destDir=OUTPUT_DIR+FILE_SEP+"timetables"+FILE_SEP+s2+"-multi"; if(dir.exists(destDir)){ QMessageBox::warning(this, tr("FET information"), tr("Directory %1 exists and might not be empty," " (it might contain old files). You need to manually remove all contents of this directory AND the directory itself (or rename it)" " and then you can generate multiple timetables") .arg(QDir::toNativeSeparators(destDir))); return; } if(!gt.rules.internalStructureComputed){ if(!gt.rules.computeInternalStructure(this)){ QMessageBox::warning(this, TimetableGenerateMultipleForm::tr("FET warning"), TimetableGenerateMultipleForm::tr("Data is wrong. Please correct and try again")); return; } } if(!gt.rules.initialized || gt.rules.activitiesList.isEmpty()){ QMessageBox::critical(this, TimetableGenerateMultipleForm::tr("FET information"), TimetableGenerateMultipleForm::tr("You have entered simulation with uninitialized rules or 0 activities...aborting")); assert(0); exit(1); return; } currentResultsTextEdit->setPlainText(""); bool ok=genMulti.precompute(this); if(!ok){ currentResultsTextEdit->setPlainText(TimetableGenerateMultipleForm::tr("Cannot optimize - please modify your data")); currentResultsTextEdit->update(); QMessageBox::information(this, TimetableGenerateMultipleForm::tr("FET information"), TimetableGenerateMultipleForm::tr("Your data cannot be processed - please modify it as instructed.")); return; } startPushButton->setDisabled(true); stopPushButton->setEnabled(true); minutesGroupBox->setDisabled(true); timetablesGroupBox->setDisabled(true); closePushButton->setDisabled(true); simulation_running_multi=true; for(int qq=0; qq<gt.rules.nInternalActivities; qq++) savedPermutation[qq]=permutation[qq]; genMulti.c.makeUnallocated(gt.rules); generateMultipleThread.start(); }