当前位置: 首页>>代码示例>>C++>>正文


C++ CurrentAnalysis类代码示例

本文整理汇总了C++中CurrentAnalysis的典型用法代码示例。如果您正苦于以下问题:C++ CurrentAnalysis类的具体用法?C++ CurrentAnalysis怎么用?C++ CurrentAnalysis使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CurrentAnalysis类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(AnalysisDriverFixture, DDACE_MonteCarlo_MixedOsmIdf_ProjectDatabaseOpen) {

  // RETRIEVE PROBLEM
  Problem problem = retrieveProblem("MixedOsmIdf",false,false);

  // DEFINE SEED
  Model model = model::exampleModel();
  openstudio::path p = toPath("./example.osm");
  model.save(p,true);
  FileReference seedModel(p);

  // CREATE ANALYSIS
  DDACEAlgorithmOptions algOptions(DDACEAlgorithmType::oas);
  algOptions.setSamples(4);
  Analysis analysis("DDACE Monte Carlo Sampling",
                    problem,
                    DDACEAlgorithm(algOptions),
                    seedModel);

  // RUN ANALYSIS
  {
    analysis = Analysis("DDACE Monte Carlo Sampling - MixedOsmIdf",
                        problem,
                        DDACEAlgorithm(algOptions),
                        seedModel);
    ProjectDatabase database = getCleanDatabase("DDACEMonteCarlo_MixedOsmIdf");
    AnalysisDriver analysisDriver = AnalysisDriver(database);
    AnalysisRunOptions runOptions = standardRunOptions(analysisDriver.database().path().parent_path());
    CurrentAnalysis currentAnalysis = analysisDriver.run(analysis,runOptions);
    EXPECT_TRUE(analysisDriver.waitForFinished());
    boost::optional<runmanager::JobErrors> jobErrors = currentAnalysis.dakotaJobErrors();
    ASSERT_TRUE(jobErrors);
    EXPECT_TRUE(jobErrors->errors().empty());
    EXPECT_TRUE(analysisDriver.currentAnalyses().empty());
    Table summary = currentAnalysis.analysis().summaryTable();
    EXPECT_EQ(5u,summary.nRows()); // 4 points
    summary.save(analysisDriver.database().path().parent_path() / toPath("summary.csv"));

    BOOST_FOREACH(const DataPoint& dataPoint,analysis.dataPoints()) {
      EXPECT_TRUE(dataPoint.isComplete());
      EXPECT_FALSE(dataPoint.failed());
    }
  }
  {
    project::OptionalProjectDatabase oDatabase = project::ProjectDatabase::open(toPath("AnalysisDriverFixtureData/DDACEMonteCarloMixedOsmIdf/DDACEMonteCarlo_MixedOsmIdf.osp"));
    ASSERT_TRUE(oDatabase);
    project::AnalysisRecordVector analysisRecords = project::AnalysisRecord::getAnalysisRecords(*oDatabase);
    EXPECT_EQ(1u,analysisRecords.size());
    if (!analysisRecords.empty()) {
      EXPECT_NO_THROW(analysisRecords[0].analysis());
    }
  }

}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:54,代码来源:DDACEAlgorithm_GTest.cpp

示例2: TEST_F

TEST_F(AnalysisDriverFixture, FSUDace_CVT_MixedOsmIdf) {

  // RETRIEVE PROBLEM
  Problem problem = retrieveProblem("MixedOsmIdf",false,false);

  // DEFINE SEED
  Model model = model::exampleModel();
  openstudio::path p = toPath("./example.osm");
  model.save(p,true);
  FileReference seedModel(p);

  // CREATE ANALYSIS
  FSUDaceAlgorithmOptions algOptions(FSUDaceAlgorithmType::cvt);
  algOptions.setSamples(3);
  Analysis analysis("FSUDace CVT",
                    problem,
                    FSUDaceAlgorithm(algOptions),
                    seedModel);

  // RUN ANALYSIS
  analysis = Analysis("FSUDace CVT - MixedOsmIdf",
                      problem,
                      FSUDaceAlgorithm(algOptions),
                      seedModel);
  ProjectDatabase database = getCleanDatabase("FSUDaceCVT_MixedOsmIdf");
  AnalysisDriver analysisDriver = AnalysisDriver(database);
  AnalysisRunOptions runOptions = standardRunOptions(analysisDriver.database().path().parent_path());
  CurrentAnalysis currentAnalysis = analysisDriver.run(analysis,runOptions);
  EXPECT_TRUE(analysisDriver.waitForFinished());
  boost::optional<runmanager::JobErrors> jobErrors = currentAnalysis.dakotaJobErrors();
  ASSERT_TRUE(jobErrors);
  EXPECT_TRUE(jobErrors->errors().empty());
  EXPECT_TRUE(analysisDriver.currentAnalyses().empty());
  Table summary = currentAnalysis.analysis().summaryTable();
  // EXPECT_EQ(10u,summary.nRows()); // 9 points
  summary.save(analysisDriver.database().path().parent_path() / toPath("summary.csv"));

  BOOST_FOREACH(const DataPoint& dataPoint,analysis.dataPoints()) {
    EXPECT_TRUE(dataPoint.isComplete());
    EXPECT_FALSE(dataPoint.failed());
  }

}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:43,代码来源:FSUDaceAlgorithm_GTest.cpp

示例3: TEST_F

TEST_F(AnalysisDriverFixture,RuntimeBehavior_StopDakotaAnalysis) {
  // Tests for stopping time < 20s.

  // RETRIEVE PROBLEM
  Problem problem = retrieveProblem("SimpleHistogramBinUQ",true,false);

  // DEFINE SEED
  Model model = model::exampleModel();
  openstudio::path p = toPath("./example.osm");
  model.save(p,true);
  FileReference seedModel(p);

  // CREATE ANALYSIS
  SamplingAlgorithmOptions algOptions;
  algOptions.setSamples(100);
  Analysis analysis("Stop Dakota Analysis",
                    problem,
                    SamplingAlgorithm(algOptions),
                    seedModel);

  // RUN ANALYSIS
  if (!dakotaExePath().empty()) {
    ProjectDatabase database = getCleanDatabase("StopDakotaAnalysis");
    AnalysisDriver analysisDriver(database);
    AnalysisRunOptions runOptions = standardRunOptions(analysisDriver.database().path().parent_path());
    StopWatcher watcher(analysisDriver);
    watcher.watch(analysis.uuid());
    CurrentAnalysis currentAnalysis = analysisDriver.run(analysis,runOptions);
    analysisDriver.waitForFinished();
    EXPECT_FALSE(analysisDriver.isRunning());
    EXPECT_GE(watcher.nComplete(),watcher.stopNum());
    EXPECT_LE(watcher.stoppingTime(),openstudio::Time(0,0,0,20));

    // check conditions afterward
    boost::optional<runmanager::JobErrors> jobErrors = currentAnalysis.dakotaJobErrors();
    ASSERT_TRUE(jobErrors);
    EXPECT_FALSE(jobErrors->errors().empty());
    EXPECT_FALSE(currentAnalysis.analysis().dataPoints().empty());
    EXPECT_FALSE(currentAnalysis.analysis().algorithm()->isComplete());
    EXPECT_FALSE(currentAnalysis.analysis().algorithm()->failed());
    EXPECT_EQ(0u,analysisDriver.currentAnalyses().size());
  }
}
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:43,代码来源:RuntimeBehavior_GTest.cpp

示例4: TEST_F

TEST_F(AnalysisDriverFixture, DDACE_CentralComposite_Continuous) {

  // RETRIEVE PROBLEM
  Problem problem = retrieveProblem("Continuous",true,false);

  // DEFINE SEED
  Model model = model::exampleModel();
  openstudio::path p = toPath("./example.osm");
  model.save(p,true);
  FileReference seedModel(p);

  // CREATE ANALYSIS
  DDACEAlgorithmOptions algOptions(DDACEAlgorithmType::central_composite);
  Analysis analysis("DDACE Central Composite",
                    problem,
                    DDACEAlgorithm(algOptions),
                    seedModel);

  // RUN ANALYSIS
  if (!dakotaExePath().empty()) {
    ProjectDatabase database = getCleanDatabase("DDACECentralComposite");
    AnalysisDriver analysisDriver(database);
    AnalysisRunOptions runOptions = standardRunOptions(analysisDriver.database().path().parent_path());
    CurrentAnalysis currentAnalysis = analysisDriver.run(analysis,runOptions);
    EXPECT_TRUE(analysisDriver.waitForFinished());
    boost::optional<runmanager::JobErrors> jobErrors = currentAnalysis.dakotaJobErrors();
    ASSERT_TRUE(jobErrors);
    EXPECT_TRUE(jobErrors->errors().empty());

    // output csv summary of data points
    Table summary = currentAnalysis.analysis().summaryTable();
    summary.save(analysisDriver.database().path().parent_path() / toPath("summary.csv"));
    EXPECT_EQ(DDACEAlgorithmOptions::samplesForCentralComposite(problem),int(summary.nRows()-1));

    BOOST_FOREACH(const DataPoint& dataPoint,analysis.dataPoints()) {
      EXPECT_TRUE(dataPoint.isComplete());
      EXPECT_FALSE(dataPoint.failed());
      EXPECT_FALSE(dataPoint.responseValues().empty());
    }
  }
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:40,代码来源:DDACEAlgorithm_GTest.cpp

示例5: TEST_F

TEST_F(AnalysisDriverFixture,RuntimeBehavior_StopOpenStudioAnalysis) {
  // Tests for stopping time < 20s.

  // RETRIEVE PROBLEM
  Problem problem = retrieveProblem("IdfOnly",false,false);

  // DEFINE SEED
  FileReference seedModel(resourcesPath() / openstudio::toPath("energyplus/5ZoneAirCooled/in.idf"));

  // CREATE ANALYSIS
  DesignOfExperimentsOptions algOptions(DesignOfExperimentsType::FullFactorial);
  Analysis analysis("Stop OpenStudio Analysis",
                    problem,
                    DesignOfExperiments(algOptions),
                    seedModel);

  // RUN ANALYSIS
  ProjectDatabase database = getCleanDatabase("StopOpenStudioAnalysis");
  AnalysisDriver analysisDriver(database);
  AnalysisRunOptions runOptions = standardRunOptions(analysisDriver.database().path().parent_path());
  runOptions.setQueueSize(2);
  StopWatcher watcher(analysisDriver);
  watcher.watch(analysis.uuid());
  CurrentAnalysis currentAnalysis = analysisDriver.run(analysis,runOptions);
  EXPECT_EQ(2,currentAnalysis.numQueuedJobs());
  EXPECT_EQ(0,currentAnalysis.numQueuedDakotaJobs());
  EXPECT_GE(currentAnalysis.totalNumJobsInOSIteration(),10);
  EXPECT_EQ(0,currentAnalysis.numCompletedJobsInOSIteration());
  analysisDriver.waitForFinished();
  EXPECT_FALSE(analysisDriver.isRunning());
  EXPECT_GE(watcher.nComplete(),watcher.stopNum());
  EXPECT_LE(watcher.stoppingTime(),openstudio::Time(0,0,0,20));

  // check conditions afterward
  EXPECT_TRUE(currentAnalysis.numCompletedJobsInOSIteration() > 0);
  EXPECT_TRUE(currentAnalysis.analysis().dataPointsToQueue().size() > 0u);
  EXPECT_TRUE(currentAnalysis.analysis().dataPointsToQueue().size() <
              currentAnalysis.analysis().dataPoints().size());
  EXPECT_EQ(0u,analysisDriver.currentAnalyses().size());
}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:40,代码来源:RuntimeBehavior_GTest.cpp

示例6: TEST_F

TEST_F(AnalysisDriverFixture,RuntimeBehavior_StopAndRestartDakotaAnalysis) {

  // RETRIEVE PROBLEM
  Problem problem = retrieveProblem("SimpleHistogramBinUQ",true,false);

  // DEFINE SEED
  Model model = model::exampleModel();
  openstudio::path p = toPath("./example.osm");
  model.save(p,true);
  FileReference seedModel(p);

  // CREATE ANALYSIS
  SamplingAlgorithmOptions algOptions;
  algOptions.setSamples(10);
  Analysis analysis("Stop and Restart Dakota Analysis",
                    problem,
                    SamplingAlgorithm(algOptions),
                    seedModel);

  // RUN ANALYSIS
  ProjectDatabase database = getCleanDatabase("StopAndRestartDakotaAnalysis");
  AnalysisDriver analysisDriver(database);
  AnalysisRunOptions runOptions = standardRunOptions(analysisDriver.database().path().parent_path());
  StopWatcher watcher(analysisDriver);
  watcher.watch(analysis.uuid());
  CurrentAnalysis currentAnalysis = analysisDriver.run(analysis,runOptions);
  analysisDriver.waitForFinished();
  EXPECT_FALSE(analysisDriver.isRunning());

  // check conditions afterward
  boost::optional<runmanager::JobErrors> jobErrors = currentAnalysis.dakotaJobErrors();
  ASSERT_TRUE(jobErrors);
  EXPECT_FALSE(jobErrors->errors().empty());
  EXPECT_FALSE(currentAnalysis.analysis().dataPoints().empty());
  EXPECT_FALSE(currentAnalysis.analysis().dataPointsToQueue().empty());
  EXPECT_FALSE(currentAnalysis.analysis().completeDataPoints().empty());
  EXPECT_FALSE(currentAnalysis.analysis().successfulDataPoints().empty());
  EXPECT_TRUE(currentAnalysis.analysis().failedDataPoints().empty());
  EXPECT_FALSE(currentAnalysis.analysis().algorithm()->isComplete());
  EXPECT_FALSE(currentAnalysis.analysis().algorithm()->failed());
  EXPECT_EQ(0u,analysisDriver.currentAnalyses().size());
  LOG(Debug,"After initial stop, there are " << currentAnalysis.analysis().dataPoints().size()
      << " data points, of which " << currentAnalysis.analysis().completeDataPoints().size()
      << " are complete.");

  // try to restart from database contents
  analysis = AnalysisRecord::getAnalysisRecords(database)[0].analysis();
  ASSERT_TRUE(analysis.algorithm());
  EXPECT_FALSE(analysis.algorithm()->isComplete());
  EXPECT_FALSE(analysis.algorithm()->failed());
  currentAnalysis = analysisDriver.run(analysis,runOptions);
  analysisDriver.waitForFinished();
  EXPECT_EQ(10u,analysis.dataPoints().size());
  EXPECT_EQ(0u,analysis.dataPointsToQueue().size());
  EXPECT_EQ(10u,analysis.completeDataPoints().size());
  EXPECT_EQ(10u,analysis.successfulDataPoints().size());
  EXPECT_EQ(0u,analysis.failedDataPoints().size());
}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:58,代码来源:RuntimeBehaviorDakota_GTest.cpp


注:本文中的CurrentAnalysis类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。