本文整理汇总了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());
}
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
示例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());
}