本文整理汇总了C++中Experiment类的典型用法代码示例。如果您正苦于以下问题:C++ Experiment类的具体用法?C++ Experiment怎么用?C++ Experiment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Experiment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: raw2
void raw2()
{
typedef double Scalar;
Experiment<Scalar> *x = new LorenzExperiment();
// RungeKutta4 *rk4 = dynamic_cast<RungeKutta4*>(x->integrator);
// rk4->setRealParamValue("stepSize", .001);
x->setIntegrator("rk4");
std::cout << x->integrator->getName() << std::endl;
std::cout << "New Vector\n";
DTS::Vector<Scalar> v(4), v2(4);
v[0] = 1;
v[1] = 1;
v[2] = 1;
v[3] = 0;
for (int i =0; i < 100000000; i++) {
// for (int i =0; i < 10; i++) {
x->integrator->step( v, v2 );
v2 += v;
v = v2;
}
std::cout << v2 << std::endl;
x->model->printRealParams();
delete x;
}
示例2: Experiment
void MainWindowImpl::openModel(QTreeWidgetItem *item) {
Experiment *experiment = new Experiment("/home/ahlatimer/vset");
std::vector<Model> models = experiment->getModels();
std::string model_type = "";
std::string iteration = "";
std::string step = "";
if(item->text(0) == "Coverage") {
model_type = "icov";
} else if(item->text(0) == "Time") {
model_type = "time";
} else if(item->text(0) == "Vel Perturbation") {
model_type = "dusum";
} else if(item->text(0) == "Smoother 1") {
model_type = "velaa";
} else if(item->text(9) == "Smoother 2") {
model_type = "dvaa";
}
for(int i = 0; i < models.size(); i++) {
iteration = intToString(models[i].getIteration());
step = intToString(models[i].getStep());
if(models[i].getName() == model_type && item->text(1) == QString::fromStdString(iteration) && item->text(2) == QString::fromStdString(step)) {
models[i].render();
return;
}
}
}
示例3: readFromFile
// function that reads in data from file into data maps
static bool readFromFile(DataManager<T>& data,
const std::string& dataPath) {
// declare vector for saving file names
std::vector<std::string> fileList;
try {
// get file list
getFileList(fileList, dataPath);
// count number of files
size_t noOfFiles{fileList.size()};
// loop through all files
for (size_t i{}; i < noOfFiles; ++i) {
// declare experiment object
Experiment<T> userExperiment;
// pass file name to experiment read from file function
userExperiment.readFromFile(fileList[i]);
// insert data into maps
data.insertExperiment(userExperiment);
}
}
catch (const std::invalid_argument& e) {
ErrorMsg::print(e.what());
return false;
}
return true;
}
示例4: readFromScreen
// function that reads in data from screen into data maps
static bool readFromScreen(DataManager<T>& data) {
bool finished{false};
while (!finished) {
// declare experiment object
Experiment<T> experiment;
try {
// call read from screen function
experiment.readFromScreen();
}
catch (const std::invalid_argument& e) {
ErrorMsg::print(e.what());
return false;
}
// insert data into maps
data.insertExperiment(experiment);
ScreenMsg::print("Type <y> to add another experiment ");
ScreenMsg::print("or any other letter to finish >> ");
std::string reply{getInput<std::string>()};
// convert to uppercase letters in case user used upper case
std::transform(reply.begin(), reply.end(), reply.begin(), ::toupper);
// check reply
if (reply == "Y") {
continue;
} else {
finished = true;
break;
}
}
return true;
}
示例5: thanks
//SELECTION
void Viewer::postSelection(const QPoint& point){
int experimentState=0;
// Compute orig and dir, used to draw a representation of the intersecting line
//camera()->convertClickToLine(point, orig, dir);
//Click and returns the state of the experiment:
//- 0: The Experiment doesn't have started
//- 1: The Experiment has started, shows the current block
//- 2: Finished Experiment, doesn't show anything
experimentState=exper.click(point);
if(experimentState==2){
thanks();
}
addMessage("click x: ",point.x(),2);
addMessage("click y: ",point.y(),3);
clicks++;
addMessage("Clicks: ",clicks,4);
addMessage("Experiment state: ",experimentState,5);
addMessage("Block: ",exper.getCurrentBlock(),6);
addMessage("Trial: ",exper.getCurrentTrial(),7);
}
示例6: run_experiment
double run_experiment(const Experiment & experiment, Generator gen, int n)
{
generic_counter<std::vector<int> > v(experiment.classes());
experiment.run(gen, v, n);
return chi_square_value(v.begin(), v.end(),
std::bind1st(std::mem_fun_ref(&Experiment::probability),
experiment));
}
示例7: main
int main(int argc, char *argv[]){
if(argc!=2){
cerr<<"Argument 1 required"<<endl;
return -1;
}
if(SRAND_ON){
srand(time(NULL));
}
vector<string> server_list = SERVER_LIST; //{"10.129.26.246:8091", "10.129.28.141:8091", "10.129.26.81:8091"};
vector<string> key = DataSetGenerator::getRandomStrings(DATASET_SIZE,KEY_SIZE);
vector<string> value = DataSetGenerator::getRandomStrings(DATASET_SIZE,VALUE_SIZE);
int thread_count = THREAD_COUNT;
int run_time = RUN_TIME;
vector<string> conn = CONN;
Experiment e = Experiment(key, value, conn, thread_count, run_time,DIST==ZIPF); //vector<string> &k, vector<string> &v, string con, int tc, int rt, int dist
string sep="/";
string DATE=currentDateTime("%Y-%m-%d");
string iter_num = string(argv[1]);
string folder=string(DS)+sep+DATE+sep+"TC"+to_string(thread_count)+sep+iter_num+sep;
cout<<folder<<endl;
system((string("mkdir -p ")+folder).c_str());
SystemMonitor sm(server_list,folder);
// e.setReadProb(0.5);
// e.runExperiment(folder + "RP_"+to_string(e.getReadProb()));
//
// e.setReadProb(1);
// e.runExperiment(folder + "RP_"+to_string(e.getReadProb()));
sm.startMonitoring();
e.setReadProb(READPROB);
e.runExperiment(folder + "RP_"+to_string(e.getReadProb()));
sm.stopMonitoring();
// sm.startMonitoring();
// e.setReadProb(0.95);
// e.runExperiment(folder + "RP_"+to_string(e.getReadProb()));
// sm.stopMonitoring();
// long num_cpus = std::thread::hardware_concurrency();
// string detailes = "CPU count, CPU util, NW rx(KBps), NW tx(KBps), NW util, Mem Size, Mem util, Disk util, Page Faults";
return 0;
}
示例8: main
int main()
{
printf("Running EagleTree\n");
set_small_SSD_config();
string name = "/demo_output/";
Experiment::create_base_folder(name.c_str());
Experiment* e = new Experiment();
Workload_Definition* workload = new Example_Workload();
e->set_workload(workload);
e->set_io_limit(1000000);
e->run("test");
e->draw_graphs();
delete workload;
return 0;
}
示例9: calculateEstimatedDuration
void ExperimentController::calculateEstimatedDuration()
{
Experiment experiment = this->experiment();
double duration = (boost::posix_time::microsec_clock::local_time() - experiment.startedAt()).total_milliseconds() - (experiment.pausedDuration() * 1000);
double previousTargetTemp = HeatBlockInstance::getInstance()->temperature();
do
{
Stage *stage = experiment.protocol()->currentStage();
std::time_t holdTime = stage->currentStep()->holdTime();
double temperature = stage->currentStep()->temperature();
if (stage->autoDelta() && stage->currentCycle() > stage->autoDeltaStartCycle())
{
holdTime += stage->currentStep()->deltaDuration() * (stage->currentCycle() - stage->autoDeltaStartCycle());
if (holdTime < 0)
holdTime = 0;
temperature += stage->currentStep()->deltaTemperature() * (stage->currentCycle() - stage->autoDeltaStartCycle());
if (temperature < HeatBlockInstance::getInstance()->minTargetTemperature())
temperature = HeatBlockInstance::getInstance()->minTargetTemperature();
else if (temperature > HeatBlockInstance::getInstance()->maxTargetTemperature())
temperature = HeatBlockInstance::getInstance()->maxTargetTemperature();
}
double rate = stage->currentRamp()->rate();
rate = rate > 0 && rate <= kDurationCalcHeatBlockRampSpeed ? rate : kDurationCalcHeatBlockRampSpeed;
if (previousTargetTemp < temperature)
duration += (((temperature - previousTargetTemp) / rate) + holdTime) * 1000;
else
duration += (((previousTargetTemp - temperature) / rate) + holdTime) * 1000;
previousTargetTemp = temperature;
}
while (experiment.protocol()->advanceNextStep());
{
Poco::RWLock::ScopedWriteLock lock(*_machineMutex);
_experiment.setEstimatedDuration(std::round(duration / 1000));
}
}
示例10: insertRow
bool ExperimentModel::insertRow(int row, Experiment& e, const QModelIndex & parent)
{
beginInsertRows(parent, row, row);
if(row > qExpMap.size() || row < 0)
return false;
qExpMap[e.getName()] = &e;
endInsertRows();
return true;
}
示例11: PrintNthExperiment
void ScenarioConverter::PrintNthExperiment( int n )
{
char old_start, old_goal;
int start_x, start_y, goal_x, goal_y;
Experiment exp = this->scen->GetNthExperiment( n );
start_x = exp.GetStartX();
start_y = exp.GetStartY();
goal_x = exp.GetGoalX();
goal_y = exp.GetGoalY();
old_start = this->map[start_y][start_x];
old_goal = this->map[goal_y][goal_x];
this->map[start_y][start_x] = '@';
this->map[goal_y][goal_x] = '*';
this->PrintMap();
this->map[start_y][start_x] = old_start;
this->map[goal_y][goal_x] = old_goal;
}
示例12: operator
/// @brief Evaluation of the metric in CPU cycles
template<typename Experiment> inline
double operator() ( Experiment const& e
, std::string const& name
, details::times_set const&
, details::cycles_set const& c
) const
{
double m = Stat::evaluate(c) / e.size();
details::measures_map[details::identify_result(name,e,*this)] = m;
return m;
}
示例13: sizeof
ScenarioConverter::ScenarioConverter( ScenarioLoader *scen )
{
this->scen = scen;
ifstream in;
char scrap[256], type[256];
int rows, columns, i, j;
Experiment exp = scen->GetNthExperiment( 0 );
/*cout << "map " << exp.GetMapName() << "\n";*/
in.open( exp.GetMapName(), ifstream::in );
in >> scrap;
in >> type;
in >> scrap;
in >> rows;
in >> scrap;
in >> columns;
in >> scrap;
/*cout << "type " << type << "\n";
cout << "rows " << rows << "\n";
cout << "columns " << columns << "\n";*/
this->rows = rows;
this->columns = columns;
this->map = (char**)malloc( sizeof(char*) * rows );
for( i = 0; i < rows; i++ )
this->map[i] = (char*)malloc( sizeof(char) * columns );
in.get(); /*newline*/
for( i = 0; i < rows; i++ )
{
for( j = 0; j < columns; j++ )
this->map[i][j] = in.get();
in.get(); /*newline*/
}
}
示例14: main
int main()
{
printf("Running EagleTree\n");
set_small_SSD_config();
// set_big_SSD_config();
//gogo greedy
// GARBAGE_COLLECTION_POLICY = 0;
// string name = "/greedy_demo_output/";
// gogo LRU
GARBAGE_COLLECTION_POLICY = 1;
string name = "/lru_demo_output/";
//gogo dj
// GARBAGE_COLLECTION_POLICY = 2;
// string name = "/demo_output_500/";
FTL_DESIGN = 1; // using DFTL
SCHEDULING_SCHEME = 7;
PRINT_LEVEL = 0;
MAX_SSD_QUEUE_SIZE = 16;
ftl_cache::CACHED_ENTRIES_THRESHOLD = pow(2,15); // SRAM fitting 256 kb, or 2^25 entries,
DFTL::ENTRIES_PER_TRANSLATION_PAGE = 128;
Experiment::create_base_folder(name.c_str());
Experiment* e = new Experiment();
Workload_Definition* workload = new Example_Workload();
e->set_workload(workload);
printf("NUMBER_OF_ADDRESSABLE_PAGES: %d %d\n", NUMBER_OF_ADDRESSABLE_PAGES(), (int)(NUMBER_OF_ADDRESSABLE_PAGES() * OVER_PROVISIONING_FACTOR));
e->set_io_limit(3000000);
// e->set_io_limit(30000000);
// e->set_io_limit(pow(2,0));
e->run("test");
e->draw_graphs();
delete workload;
return 0;
}
示例15: string
void MainFrame::analyzeIndividual( wxCommandEvent& event )
{
int generation = generationSpinner->GetValue();
int individual = individualSpinner->GetValue();
string title;
title +=
populationFileName +
string("_") +
string("Generation: ") +
toString(generation) +
string(" Individual: ") +
toString(individual);
mutex *populationMutex = experimentRun.getPopulationMutex();
{
mutex::scoped_lock scoped_lock(*populationMutex);
Experiment *experiment = experimentRun.getExperiment()->clone();
shared_ptr<NEAT::GeneticIndividual> indiv(
new NEAT::GeneticIndividual(
*(experimentRun.getIndividual(generation-1,individual-1).get())
)
);
experiment->processIndividualPostHoc(indiv);
if (indiv->getUserData().length())
{
cout_ << "PRINTING USER DATA RESULTS:\n";
cout_ << indiv->getUserData() << endl;
}
delete experiment;
}
}