void VsStorageOverheadThreshold::process() { cerr << "This is an experiment with name: " << this->getClassName() << endl; SimulationConf simConf; SchemaStats stats; Cost cost(stats); util::AutoTimer timer; ExperimentalData queryIOExp("QueryIOVsStorageOverheadThreshold"); ExperimentalData runningTimeExp("RunningTimeVsStorageOverheadThreshold"); ExperimentalData storageExp("StorageOverheadVsStorageOverheadThreshold"); auto expData = { &queryIOExp, &runningTimeExp, &storageExp }; makeQueryIOExp(&queryIOExp); makeRunningTimeExp(&runningTimeExp); makeStorageExp(&storageExp); for (auto exp : expData) exp->open(); auto solvers = { SolverFactory::instance().makeSinglePartition(), SolverFactory::instance().makePartitionPerAttribute(), SolverFactory::instance().makeOptimalOverlapping(), SolverFactory::instance().makeOptimalNonOverlapping(), SolverFactory::instance().makeHeuristicOverlapping(), SolverFactory::instance().makeHeuristicNonOverlapping() }; vector<double> storageOverheadThresholds = { 0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0 }; double total = solvers.size() * storageOverheadThresholds.size() * numRuns; double completed = 0; vector<util::RunningStat> io; vector<util::RunningStat> storage; vector<util::RunningStat> times; vector<std::string> names; vector<bool> errorFlags; for (auto solver : solvers) { io.push_back(util::RunningStat()); storage.push_back(util::RunningStat()); times.push_back(util::RunningStat()); names.push_back(solver->getClassName()); vector<std::string> names; errorFlags.push_back(false); } int j; for (double sot : storageOverheadThresholds) { for (int i = 0; i < numRuns; i++) { vector<std::unique_ptr<Attribute>> allAttributes; auto workloadAndStats = simConf.getQueryWorkloadAndStats(allAttributes); QueryWorkload workload = workloadAndStats.first; stats = workloadAndStats.second; j = 0; for (auto solver : solvers) { timer.start(); Partitioning partitioning; try { partitioning = solver->solve(workload, sot, stats); } catch (const runtime_error& error) { cerr << "Unable to find a solution" << endl; errorFlags.at(j) = true; } timer.stop(); if (!errorFlags.at(j)) { io.at(j).push(cost.getIOCost(partitioning, workload)); storage.at(j).push( cost.getStorageOverhead(partitioning, workload)); times.at(j).push( timer.getRealTimeInSeconds()); } j++; cerr << "."; completed++; } } int j = 0; for (auto solver : solvers) { if (!errorFlags.at(j)) { runningTimeExp.addRecord(); runningTimeExp.setFieldValue("solver", solver->getClassName()); runningTimeExp.setFieldValue( "storageOverheadThreshold", boost::str(boost::format("%.2f") % sot)); runningTimeExp.setFieldValue("time", times.at(j).getMean()); runningTimeExp.setFieldValue( "deviation", times.at(j).getStandardDeviation()); times.at(j).clear(); queryIOExp.addRecord(); queryIOExp.setFieldValue("solver", solver->getClassName()); queryIOExp.setFieldValue( "storageOverheadThreshold", boost::str(boost::format("%.2f") % sot)); queryIOExp.setFieldValue("io", io.at(j).getMean()); queryIOExp.setFieldValue( "deviation", io.at(j).getStandardDeviation()); io.at(j).clear(); storageExp.addRecord(); storageExp.setFieldValue("solver", solver->getClassName()); storageExp.setFieldValue( "storageOverheadThreshold", boost::str(boost::format("%.2f") % sot)); storageExp.setFieldValue("storage", storage.at(j).getMean()); storageExp.setFieldValue( "deviation", storage.at(j).getStandardDeviation()); storage.at(j).clear(); } else { runningTimeExp.addRecord(); runningTimeExp.setFieldValue("solver", solver->getClassName()); runningTimeExp.setFieldValue( "storageOverheadThreshold", boost::str(boost::format("%.2f") % sot)); runningTimeExp.setFieldValue("time", "n/a"); runningTimeExp.setFieldValue("deviation", "n/a"); times.at(j).clear(); queryIOExp.addRecord(); queryIOExp.setFieldValue("solver", solver->getClassName()); queryIOExp.setFieldValue( "storageOverheadThreshold", boost::str(boost::format("%.2f") % sot)); queryIOExp.setFieldValue("io", "n/a"); queryIOExp.setFieldValue("deviation", "n/a"); io.at(j).clear(); storageExp.addRecord(); storageExp.setFieldValue("solver", solver->getClassName()); storageExp.setFieldValue( "storageOverheadThreshold", boost::str(boost::format("%.2f") % sot)); storageExp.setFieldValue("storage", "n/a"); storageExp.setFieldValue("deviation", "n/a"); storage.at(j).clear(); errorFlags.at(j) = false; } j++; } cerr << " (" << (completed / total) * 100 << "%)" << endl; } for (auto exp : expData) exp->close(); };
void VsNumAttributes::process() { cerr << "This is an experiment with name: " << this->getClassName() << endl; SimulationConf simConf; SchemaStats stats; Cost cost(stats); util::AutoTimer timer; ExperimentalData queryIOExp("QueryIOVsNumAttributes"); ExperimentalData runningTimeExp("RunningTimeVsNumAttributes"); ExperimentalData storageExp("StorageOverheadVsNumAttributes"); auto expData = { &queryIOExp, &runningTimeExp, &storageExp }; makeQueryIOExp(&queryIOExp); makeRunningTimeExp(&runningTimeExp); makeStorageExp(&storageExp); for (auto exp : expData) exp->open(); auto solvers = { SolverFactory::instance().makeSinglePartition(), SolverFactory::instance().makePartitionPerAttribute(), SolverFactory::instance().makeOptimalOverlapping(), SolverFactory::instance().makeOptimalNonOverlapping(), SolverFactory::instance().makeHeuristicOverlapping(), SolverFactory::instance().makeHeuristicNonOverlapping() }; //auto attributeCounts = {2, 4, 6, 8, 10, 12, 14, 16 }; auto attributeCounts = {32, 48, 64, 80, 96, 112, 128}; double total = solvers.size() * attributeCounts.size() * numRuns; double completed = 0; vector<util::RunningStat> io; vector<util::RunningStat> storage; vector<util::RunningStat> times; vector<std::string> names; for (auto solver : solvers) { io.push_back(util::RunningStat()); storage.push_back(util::RunningStat()); times.push_back(util::RunningStat()); names.push_back(solver->getClassName()); vector<std::string> names; } int j; for (double attributeCount : attributeCounts) { for (int i = 0; i < numRuns; i++) { simConf.setAttributeCount(attributeCount); vector<unique_ptr<Attribute>> allAttributes; auto workloadAndStats = simConf.getQueryWorkloadAndStats(allAttributes); QueryWorkload const& workload = workloadAndStats.first; stats = workloadAndStats.second; j = 0; for (auto solver : solvers) { timer.start(); Partitioning partitioning = solver->solve( workload, storageOverheadThreshold, stats); timer.stop(); io.at(j).push(cost.getIOCost(partitioning, workload)); storage.at(j).push(cost.getStorageOverhead( partitioning, workload)); times.at(j).push(timer.getRealTimeInSeconds()); j++; cerr << "."; completed++; } } int j = 0; for (auto solver : solvers) { runningTimeExp.addRecord(); runningTimeExp.setFieldValue("solver", solver->getClassName()); runningTimeExp.setFieldValue("attributes", attributeCount); runningTimeExp.setFieldValue("time", times.at(j).getMean()); runningTimeExp.setFieldValue( "deviation", times.at(j).getStandardDeviation()); times.at(j).clear(); queryIOExp.addRecord(); queryIOExp.setFieldValue("solver", solver->getClassName()); queryIOExp.setFieldValue("attributes", attributeCount); queryIOExp.setFieldValue("io", io.at(j).getMean()); queryIOExp.setFieldValue( "deviation", io.at(j).getStandardDeviation()); io.at(j).clear(); storageExp.addRecord(); storageExp.setFieldValue("solver", solver->getClassName()); storageExp.setFieldValue("attributes",attributeCount); storageExp.setFieldValue("storage", storage.at(j).getMean()); storageExp.setFieldValue( "deviation", storage.at(j).getStandardDeviation()); storage.at(j).clear(); j++; } cerr << " (" << (completed / total) * 100 << "%)" << endl; } for (auto exp : expData) exp->close(); };