void bpbToWig(const isaac::options::BpbToWigOptions &options) { isaac::workflow::BpbToWigWorkflow workflow( options.wigDefaultValue_, options.sortedReferenceMetadata_, options.inputFilePath_, options.outputFormatString_, options.bitsPerValue_, options.knownSitesOnly_, options.bedPrintAllPositions_ ); workflow.run(); }
int main() { GaInitialize(); { Chromosome::GaMatingConfig matingConfiguration( Chromosome::GaCrossoverSetup( &crossover, &Chromosome::GaCrossoverParams( 0.8f, 2 ), NULL ), Chromosome::GaMutationSetup( &mutation, &Chromosome::GaMutationParams( 0.03f, false ), NULL ) ); float gridSize[] = { 0.5, 0.5 }; Algorithm::Stubs::GaPAESStub paesStub( WDID_POPULATION, WDID_POPULATION_STATS, Chromosome::GaInitializatorSetup( &initializator, NULL, &Chromosome::GaInitializatorConfig() ), Population::GaPopulationFitnessOperationSetup( &populationFitnessOperation, NULL, &Fitness::GaFitnessOperationConfig( &Fitness::Representation::GaMVFitnessParams( 2 ) ) ), Fitness::GaFitnessComparatorSetup( &fitnessComparator, &Fitness::Comparators::GaSimpleComparatorParams( Fitness::Comparators::GACT_MINIMIZE_ALL ), NULL ), Population::GaPopulationParams( 33, 1 ), Chromosome::GaMutationSetup( &mutation, &Chromosome::GaMutationParams( 0.03f, false ), NULL ), Multiobjective::PAES::GaPAESSelectionParams( PTID_CURRENT_SOLUTION, PTID_CROSSOVER_BUFFER), Multiobjective::PAES::GaPAESParams( CTID_DOMINANCE, CTID_HYPERBOX, CTID_HYPERBOX_INFO, PTID_HYPERBOX_INFO_BUFFER, PTID_CURRENT_SOLUTION, PTID_CROWDING_STORAGE ), Common::Grid::GaHyperGrid<Fitness::GaFitness, float, Multiobjective::GaFitnessCoordiantesGetter<float> >( gridSize, 2 ) ); Common::Workflows::GaWorkflow workflow( NULL ); workflow.RemoveConnection( *workflow.GetFirstStep()->GetOutboundConnections().begin(), true ); Common::Workflows::GaWorkflowBarrier* br1 = new Common::Workflows::GaWorkflowBarrier(); paesStub.Connect( workflow.GetFirstStep(), br1 ); Common::Workflows::GaBranchGroup* bg1 = (Common::Workflows::GaBranchGroup*)workflow.ConnectSteps( br1, workflow.GetLastStep(), 0 ); Algorithm::StopCriteria::GaStopCriterionStep* stopStep = new Algorithm::StopCriteria::GaStopCriterionStep( Algorithm::StopCriteria::GaStopCriterionSetup( &stopCriterion, &Algorithm::StopCriteria::GaGenerationCriterionParams( 1000 ), NULL ), workflow.GetWorkflowData(), WDID_POPULATION_STATS ); Common::Workflows::GaBranchGroupTransition* bt1 = new Common::Workflows::GaBranchGroupTransition(); bg1->GetBranchGroupFlow()->SetFirstStep( stopStep ); bg1->GetBranchGroupFlow()->ConnectSteps( stopStep, bt1, 0 ); workflow.ConnectSteps( bt1, paesStub.GetStubFlow().GetFirstStep(), 1 ); Common::Workflows::GaDataCache<Population::GaPopulation> population( workflow.GetWorkflowData(), WDID_POPULATION ); population.GetData().GetEventManager().AddEventHandler( Population::GaPopulation::GAPE_NEW_GENERATION, &newGenHandler ); workflow.Start(); workflow.Wait(); } GaFinalize(); }
int main() { GaInitialize(); { Chromosome::GaMatingConfig matingConfiguration( Chromosome::GaCrossoverSetup( &crossover, &Chromosome::GaCrossoverParams( 0.8f, 2 ), NULL ), Chromosome::GaMutationSetup( &mutation, &Chromosome::GaMutationParams( 0.03f, false ), NULL ) ); Algorithm::Stubs::GaSPEAStub speaStub( WDID_POPULATION, WDID_POPULATION_STATS, Chromosome::GaInitializatorSetup( &initializator, NULL, &Chromosome::GaInitializatorConfig() ), Population::GaPopulationFitnessOperationSetup( &populationFitnessOperation, NULL, &Fitness::GaFitnessOperationConfig( &Fitness::Representation::GaMVFitnessParams( 2 ) ) ), Fitness::GaFitnessComparatorSetup( &fitnessComparator, &Fitness::Comparators::GaSimpleComparatorParams( Fitness::Comparators::GACT_MINIMIZE_ALL ), NULL ), Population::GaPopulationParams( 64, 0 ), Chromosome::GaMatingSetup( &mating, NULL, &matingConfiguration ), Population::GaCouplingSetup(), Population::SelectionOperations::GaTournamentSelectionParams( 32, PTID_CROSSOVER_BUFFER, -1, 2, Population::SelectionOperations::GaTournamentSelectionParams::GATST_ROULETTE_WHEEL_SELECTION ), Multiobjective::SPEA::GaSPEAParams( CTID_DOMINANCE_LIST, CTID_STRENGTH, CTID_DOMINATED, PTID_CLUSTER_STORAGE ) ); Common::Workflows::GaWorkflow workflow( NULL ); workflow.RemoveConnection( *workflow.GetFirstStep()->GetOutboundConnections().begin(), true ); Common::Workflows::GaWorkflowBarrier* br1 = new Common::Workflows::GaWorkflowBarrier(); speaStub.Connect( workflow.GetFirstStep(), br1 ); Common::Workflows::GaBranchGroup* bg1 = (Common::Workflows::GaBranchGroup*)workflow.ConnectSteps( br1, workflow.GetLastStep(), 0 ); Algorithm::StopCriteria::GaStopCriterionStep* stopStep = new Algorithm::StopCriteria::GaStopCriterionStep( Algorithm::StopCriteria::GaStopCriterionSetup( &stopCriterion, &Algorithm::StopCriteria::GaGenerationCriterionParams( 100 ), NULL ), workflow.GetWorkflowData(), WDID_POPULATION_STATS ); Common::Workflows::GaBranchGroupTransition* bt1 = new Common::Workflows::GaBranchGroupTransition(); bg1->GetBranchGroupFlow()->SetFirstStep( stopStep ); bg1->GetBranchGroupFlow()->ConnectSteps( stopStep, bt1, 0 ); workflow.ConnectSteps( bt1, speaStub.GetStubFlow().GetFirstStep(), 1 ); Common::Workflows::GaDataCache<Population::GaPopulation> population( workflow.GetWorkflowData(), WDID_POPULATION ); population.GetData().GetEventManager().AddEventHandler( Population::GaPopulation::GAPE_NEW_GENERATION, &newGenHandler ); workflow.Start(); workflow.Wait(); } GaFinalize(); }
int main(int argc, const char * argv[]) { try { init_logger(); parse_options(argc, argv); Workflow workflow(options); workflow.run(); } catch (const std::exception & ex) { std::cerr << "TealTree failed with exception:" << std::endl; std::cerr << ex.what() << std::endl; std::cerr.flush(); destroy_logger(); exit(1); } destroy_logger(); return 0; }
void MainWindow::queueSimulation(const openstudio::path &t_input, const openstudio::path &t_epw) { try { // Build list of jobs to create std::string jobsstring = toString(ui.cbWorkflow->currentText()); if (jobsstring == "<Custom>") { openstudio::path expecteddb = t_input.parent_path() / t_input.stem() / openstudio::toPath("run.db"); if (!boost::filesystem::exists(expecteddb)) { QMessageBox::critical(this, "Unable to launch job", "Db containing custom workflow for OpenStudio UI created OSM not found at the expected location: " + openstudio::toQString(expecteddb)); } else { try { m_runmanager.loadJobs(expecteddb); statusBar()->showMessage("Job Queued - " + openstudio::toQString(t_input)); } catch (const std::exception &e) { QMessageBox::critical(this, "Unable to launch job", e.what()); } } } else { // parse the string list with the workflow constructor openstudio::runmanager::Workflow workflow(jobsstring); // Build list of tools openstudio::runmanager::Tools tools; ConfigOptions co = m_runmanager.getConfigOptions(); tools.append(co.getTools()); workflow.add(tools); workflow.setInputFiles(t_input, t_epw); openstudio::runmanager::Job job = workflow.create(getOutDir(t_input, workflow, jobsstring, co.getSimpleName())); m_runmanager.enqueue(job, false); statusBar()->showMessage("Job Queued - " + openstudio::toQString(job.description())); } } catch (const std::exception &e) { QMessageBox::critical(this, "Unable to launch job", e.what()); } }
int main() { GaInitialize(); { int values[ Problems::TNG::TNG_NUMBER_COUNT ]; values[ 0 ] = GaGlobalRandomIntegerGenerator->Generate( 1, 9 ); values[ 1 ] = GaGlobalRandomIntegerGenerator->Generate( 1, 9 ); values[ 2 ] = GaGlobalRandomIntegerGenerator->Generate( 1, 9 ); values[ 3 ] = GaGlobalRandomIntegerGenerator->Generate( 1, 9 ); values[ 4 ] = ( 10 + GaGlobalRandomIntegerGenerator->Generate( 0, 2 ) * 5 ); values[ 5 ] = ( 25 + GaGlobalRandomIntegerGenerator->Generate( 0, 3 ) * 25 ); int target = ( GaGlobalRandomIntegerGenerator->Generate( 100, 999 ) ); Chromosome::GaMatingConfig matingConfiguration( Chromosome::GaCrossoverSetup( &crossover, &Chromosome::GaCrossoverPointParams( 0.8f, 2, 1 ), NULL ), Chromosome::GaMutationSetup( &mutation, &Chromosome::GaMutationSizeParams( 0.3f, true, 2L ), NULL ) ); Chromosome::GaInitializatorSetup initializatorSetup( &initializator, NULL, &Chromosome::GaInitializatorConfig( &Problems::TNG::TngConfigBlock( values, target, &Chromosome::Representation::GaBinaryChromosomeParams() ) ) ); Fitness::GaFitnessComparatorSetup fitnessComparatorSetup( &fitnessComparator, &Fitness::Comparators::GaSimpleComparatorParams( Fitness::Comparators::GACT_MAXIMIZE_ALL ), NULL ); Algorithm::Stubs::GaSimpleGAStub::GaStatTrackersCollection trackers; trackers[ Population::GaPopulationSizeTracker::TRACKER_ID ] = &sizeTracker; trackers[ Population::GaRawFitnessTracker::TRACKER_ID ] = &rawTracker; trackers[ Population::GaScaledFitnessTracker::TRACKER_ID ] = &scaledTracker; Population::GaSelectionSetup selectionSetup( &selection, &Population::SelectionOperations::GaDuplicatesSelectionParams( 8, 1, 2 ), &Population::GaCouplingConfig( Chromosome::GaMatingSetup( &mating, NULL, &matingConfiguration ) ) ); Population::GaReplacementSetup replacementSetup( &replacement, &Population::ReplacementOperations::GaRandomReplacementParams( 8, 4, 3 ), &Population::GaReplacementConfig( Chromosome::GaChromosomeComparatorSetup( &chromosomeComparator, NULL, NULL ) ) ); Population::GaScalingSetup scalingSetup( &scaling, &Population::ScalingOperations::GaScalingFactorParams( 2.0f )/*&Population::ScalingOperations::GaShareFitnessParams( 0.2f, 1.0f, 4 )*/, &Population::ScalingOperations::GaShareFitnessScalingConfig( NULL, Chromosome::GaChromosomeComparatorSetup( &chromosomeComparator, NULL, NULL ) ) ); /* Population::GaPopulation* population = new Population::GaPopulation( Population::GaPopulationParams( 32, 0, Population::GaPopulationParams::GAPFO_FILL_ON_INIT ), Chromosome::GaInitializatorSetup( &initializator, NULL, &Chromosome::GaInitializatorConfig( &Problems::TNG::TngConfigBlock( values, target, &Chromosome::Representation::GaBinaryChromosomeParams() ) ) ), Population::GaPopulationFitnessOperationSetup( &populationFitnessOperation, NULL, &Fitness::GaFitnessOperationConfig() ), fitnessComparatorSetup ); */ Algorithm::Stubs::GaSimpleGAStub simpleGA( WDID_POPULATION, WDID_POPULATION_STATS, initializatorSetup, Population::GaPopulationFitnessOperationSetup( &populationFitnessOperation, NULL, &Fitness::GaFitnessOperationConfig() ), fitnessComparatorSetup, Population::GaPopulationParams( 32, 0, Population::GaPopulationParams::GAPFO_FILL_ON_INIT ), trackers, Chromosome::GaMatingSetup(), selectionSetup, Population::GaCouplingSetup(), replacementSetup, scalingSetup, Population::GaFitnessComparatorSortingCriteria( fitnessComparatorSetup, Population::GaChromosomeStorage::GAFT_RAW ) ); /* Common::Workflows::GaWorkflow workflow( NULL ); Common::Workflows::GaDataStorage* storage = workflow.GetWorkflowData(); storage->AddData( new Common::Workflows::GaDataEntry<Population::GaPopulation>( 1, population ), Common::Workflows::GADSL_WORKFLOW ); storage->AddData( new Common::Workflows::GaDataEntry<Statistics::GaStatistics>( 2, Common::Memory::GaAutoPtr<Statistics::GaStatistics>( &population->GetStatistics(), Common::Memory::GaNoDeletionPolicy<Statistics::GaStatistics>::GetInstance() ) ), Common::Workflows::GADSL_WORKFLOW ); storage->AddData( new Common::Workflows::GaDataEntry<Population::GaChromosomeGroup>( 3, new Population::GaChromosomeGroup( false ) ), Common::Workflows::GADSL_WORKFLOW ); Common::Workflows::GaWorkflowBarrier* br1 = new Common::Workflows::GaWorkflowBarrier(); Common::Workflows::GaWorkflowBarrier* br2 = new Common::Workflows::GaWorkflowBarrier(); Common::Workflows::GaBranchGroup* bg1 = (Common::Workflows::GaBranchGroup*)workflow.ConnectSteps( workflow.GetFirstStep(), br1, 0 ); Common::Workflows::GaBranchGroup* bg2 = (Common::Workflows::GaBranchGroup*)workflow.ConnectSteps( br1, br2, 0 ); Common::Workflows::GaBranchGroup* bg3 = (Common::Workflows::GaBranchGroup*)workflow.ConnectSteps( br2, workflow.GetLastStep(), 0 ); Common::Workflows::GaFlowStep* initStep = new Common::Workflows::GaSimpleMethodExecStep<Population::GaPopulation, Common::Workflows::GaMethodExecIgnoreBranch<Population::GaPopulation> >( &Population::GaPopulation::Initialize, storage, 1 ); bg1->GetBranchGroupFlow()->SetFirstStep( initStep ); Common::Workflows::GaFlowStep* sortStep = new Population::GaSortPopulationStep<Population::GaFitnessSortingCriteria>( storage, 1, Population::GaFitnessSortingCriteria( population ) ); Common::Workflows::GaFlowStep* scalingStep = new Population::GaScalingStep( Population::GaScalingSetup( &scaling, &Population::ScalingOperations::GaScalingFactorParams( 2.0f ), //&Population::ScalingOperations::GaShareFitnessParams( 0.2f, 1.0f, 4 ), &Population::ScalingOperations::GaShareFitnessScalingConfig( NULL, Chromosome::GaChromosomeComparatorSetup( &chromosomeComparator, NULL, NULL ) ) ), storage, 1 ); Chromosome::GaMatingConfig matingConfiguration( Chromosome::GaCrossoverSetup( &crossover, &Chromosome::GaCrossoverPointParams( 0.8f, 2, 1 ), NULL ), Chromosome::GaMutationSetup( &mutation, &Chromosome::GaMutationSizeParams( 0.3f, true, 2L ), NULL ) ); Common::Workflows::GaFlowStep* selectionStep = new Population::GaSelectionStep( Population::GaSelectionSetup( &selection, &Population::SelectionOperations::GaDuplicatesSelectionParams( 8, 1, 2 ), &Population::GaCouplingConfig( Chromosome::GaMatingSetup( &mating, NULL, &matingConfiguration ) ) ), storage, 1, storage, 3 ); Common::Workflows::GaFlowStep* replacementStep = new Population::GaReplacementStep( Population::GaReplacementSetup( &replacement, &Population::ReplacementOperations::GaRandomReplacementParams( 8, 4, 3 ), &Population::GaReplacementConfig( Chromosome::GaChromosomeComparatorSetup( &chromosomeComparator, NULL, NULL ) ) ), storage, 3, storage, 1 ); Common::Workflows::GaFlowStep* nextGenStep = new Common::Workflows::GaSimpleMethodExecStep<Population::GaPopulation>( &Population::GaPopulation::NextGeneration, storage, 1 ); Common::Workflows::GaBranchGroupFlow* flow2 = bg2->GetBranchGroupFlow(); flow2->SetFirstStep( sortStep ); flow2->ConnectSteps( sortStep, scalingStep, 0 ); flow2->ConnectSteps( scalingStep, nextGenStep, 0 ); flow2->ConnectSteps( selectionStep, replacementStep, 0 ); flow2->ConnectSteps( replacementStep, sortStep, 0 ); Fitness::Representation::GaSVFitness<float> targetFitness( 1.0f, Common::Memory::GaSmartPtr<const Fitness::GaFitnessParams>::NullPtr ); Algorithm::StopCriteria::GaStopCriterionStep* stopStep = new Algorithm::StopCriteria::GaStopCriterionStep( Algorithm::StopCriteria::GaStopCriterionSetup( &stopCriterion, &Algorithm::StopCriteria::GaStatsCriterionParams<Fitness::GaFitness>( Population::GADV_BEST_FITNESS, targetFitness, Algorithm::StopCriteria::GAST_STOP_IF_EQUAL_TO, Algorithm::StopCriteria::GaStatsCriterionComparator<Fitness::GaFitness>( fitnessComparatorSetup ) ), NULL ), storage, 2 ); Common::Workflows::GaBranchGroupTransition* bt32 = new Common::Workflows::GaBranchGroupTransition(); Common::Workflows::GaBranchGroupFlow* flow3 = bg3->GetBranchGroupFlow(); flow3->SetFirstStep( stopStep ); flow3->ConnectSteps( stopStep, bt32, 0 ); workflow.ConnectSteps( bt32, selectionStep, 1 ); population->GetEventManager().AddEventHandler( Population::GaPopulation::GAPE_NEW_GENERATION, &newGenHandler ); workflow.Start(); workflow.Wait(); */ Common::Workflows::GaWorkflow workflow( NULL ); workflow.RemoveConnection( *workflow.GetFirstStep()->GetOutboundConnections().begin(), true ); Common::Workflows::GaWorkflowBarrier* br1 = new Common::Workflows::GaWorkflowBarrier(); simpleGA.Connect( workflow.GetFirstStep(), br1 ); Common::Workflows::GaBranchGroup* bg1 = (Common::Workflows::GaBranchGroup*)workflow.ConnectSteps( br1, workflow.GetLastStep(), 0 ); Fitness::Representation::GaSVFitness<float> targetFitness( 1.0f, Common::Memory::GaSmartPtr<const Fitness::GaFitnessParams>::NullPtr ); Algorithm::StopCriteria::GaStopCriterionStep* stopStep = new Algorithm::StopCriteria::GaStopCriterionStep( Algorithm::StopCriteria::GaStopCriterionSetup( &stopCriterion, &Algorithm::StopCriteria::GaStatsCriterionParams<Fitness::GaFitness>( Population::GADV_BEST_FITNESS, targetFitness, Algorithm::StopCriteria::GAST_STOP_IF_EQUAL_TO, Algorithm::StopCriteria::GaStatsCriterionComparator<Fitness::GaFitness>( fitnessComparatorSetup ) ), NULL ), workflow.GetWorkflowData(), WDID_POPULATION_STATS ); Common::Workflows::GaBranchGroupTransition* bt1 = new Common::Workflows::GaBranchGroupTransition(); bg1->GetBranchGroupFlow()->SetFirstStep( stopStep ); bg1->GetBranchGroupFlow()->ConnectSteps( stopStep, bt1, 0 ); workflow.ConnectSteps( bt1, simpleGA.GetStubFlow().GetFirstStep(), 1 ); Common::Workflows::GaDataCache<Population::GaPopulation> population( workflow.GetWorkflowData(), WDID_POPULATION ); population.GetData().GetEventManager().AddEventHandler( Population::GaPopulation::GAPE_NEW_GENERATION, &newGenHandler ); workflow.Start(); workflow.Wait(); } GaFinalize(); return 0; }