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


C++ CurrentAnalysis::dakotaJobErrors方法代码示例

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


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

示例1: seedModel

TEST_F(AnalysisDriverFixture, DDACE_MonteCarlo_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::random);
  Analysis analysis("DDACE Monte Carlo Sampling",
                    problem,
                    DDACEAlgorithm(algOptions),
                    seedModel);

  // RUN ANALYSIS
  {
    ProjectDatabase database = getCleanDatabase("DDACEMonteCarlo_Continuous_NoSamples");
    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_FALSE(jobErrors->errors().empty()); // require specification of number of samples
    EXPECT_TRUE(analysisDriver.currentAnalyses().empty());
    Table summary = currentAnalysis.analysis().summaryTable();
    EXPECT_EQ(1u,summary.nRows()); // no points
  }

  {
    algOptions.setSamples(6);
    analysis = Analysis("DDACE MonteCarlo Sampling",
                        problem,
                        DDACEAlgorithm(algOptions),
                        seedModel);
    ProjectDatabase database = getCleanDatabase("DDACEMonteCarlo_Continuous");
    AnalysisDriver analysisDriver = AnalysisDriver(database);
    AnalysisRunOptions runOptions = standardRunOptions(analysisDriver.database().path().parent_path());
    runOptions.setQueueSize(4);
    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(7u,summary.nRows()); // 6 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());
      // EXPECT_FALSE(dataPoint.responseValues().empty());
    }
  }
}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:59,代码来源:DDACEAlgorithm_GTest.cpp

示例2: seedModel

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
  if (!dakotaExePath().empty()) {
    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 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:Rahjou,项目名称:OpenStudio,代码行数:60,代码来源:RuntimeBehavior_GTest.cpp

示例3: seedModel

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

示例4: seedModel

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


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