18 #include <boost/filesystem/path.hpp> 19 #include <boost/date_time/posix_time/posix_time.hpp> 35 using boost::posix_time::ptime;
36 using boost::posix_time::time_duration;
37 using boost::filesystem::path;
39 std::vector<ISM::CombinatorialTrainerParameters>
parameters;
46 10, 25, 50, 100, 200, 400
63 params.optimizationStrategy.maxNeighbourCount = 30;
64 params.optimizationStrategy.randomWalkProbability = 0.0;
65 params.optimizationStrategy.randomRestartProbability = 0.0;
72 params.voxelGrid.useVoxelGridFilter =
false;
73 params.voxelGrid.posGridSize = 0.1;
74 params.voxelGrid.angleGridSize = 0.52;
75 params.voxelGrid.posErrTolerance = 0.1;
76 params.voxelGrid.recognitionBinSize = 0.1;
77 params.voxelGrid.tolearnaceDupMethod = ISM::PosOrientVoxelGrid::HandleErrorDuplicates::LEAVE_UNCHANGED;
78 params.voxelGrid.tolDupNumThreshold = 0;
86 void writeFile(
const std::string & directoryPath,
const std::string & filenName, std::ostringstream & content)
88 std::string filePath = directoryPath +
"/" + filenName;
90 std::ios_base::iostate exceptionMask = file.exceptions() | std::ios::failbit | std::ios::badbit;
91 file.exceptions(exceptionMask);
95 file << content.str();
99 catch (std::ios_base::failure& e)
101 std::cerr << e.what() <<
"\n";
107 ptime t1(boost::posix_time::microsec_clock::local_time());
111 combinatorialTrainer->learn();
113 ptime t2(boost::posix_time::microsec_clock::local_time());
114 time_duration td = t2 - t1;
118 long secs = td.total_seconds() % 60;
119 long mins = std::floor(td.total_seconds() / 60.);
121 os <<
", " << mins <<
"." << secs;
139 if(!boost::filesystem::exists(testSetFolderPath))
140 boost::filesystem::create_directories(testSetFolderPath);
142 for (
unsigned int i = 0; i <
parameters.size(); ++i) {
147 path validTestSetsPath(testSetFolderPath +
"/validTestSets_" + dbPath.stem().string() +
".sqlite");
150 path invalidTestSetsPath(testSetFolderPath +
"/invalidTestSets_" + dbPath.stem().string() +
".sqlite");
159 parameters[i].general.storeValidTestSetsTo =
"";
160 parameters[i].general.storeInvalidTestSetsTo =
"";
166 for (
unsigned int i = 0; i <
parameters.size(); ++i) {
170 os << p.stem().string();
197 std::string demoRecordingPath = outputPath +
"/demoRecording.sqlite";
207 std::ostringstream os;
211 os <<
"Scene, Hill Climbing, Simulated Annealing, Record Hunt" << std::endl;
215 tableHelper->dropRecordTables();
244 writeFile(outputPath,
"runtimes.csv", os);
249 std::ostringstream os;
250 os <<
"Scene, Hill Climbing, Simulated Annealing, Record Hunt" << std::endl;
256 writeFile(outputPath,
"runtimes.csv", os);
264 std::string performanceTestPath = outputPath +
"/performanceTest";
265 std::string sceneTestPath = outputPath +
"/sceneTest";
267 if(!boost::filesystem::exists(outputPath))
268 boost::filesystem::create_directories(outputPath);
270 if(!boost::filesystem::exists(performanceTestPath))
271 boost::filesystem::create_directories(performanceTestPath);
273 if(!boost::filesystem::exists(sceneTestPath))
274 boost::filesystem::create_directories(sceneTestPath);
unsigned int treeValidatorId
unsigned int optimizationAlgorithmId
void runSceneTests(std::ostringstream &os)
std::string storeInvalidTestSetsTo
void writeFile(const std::string &directoryPath, const std::string &filenName, std::ostringstream &content)
struct TopologyGeneratorParameters topologyGenerator
std::string outputDataPath
unsigned int topologyGeneratorId
std::vector< unsigned > posesPerObjectCount
struct OptimizationAlgorithmParameters optimizationAlgorithm
struct ISM::CombinatorialTrainerParameters::@0 general
boost::shared_ptr< TableHelper > TableHelperPtr
void runOptimization(ISM::CombinatorialTrainerParameters params, std::ostringstream &os)
double initialAcceptableCostDelta
struct TreeValidatorParameters treeValidator
struct CostFunctionParameters costFunction
double costDeltaDecreaseFactor
void generateDemoRecording(std::string dbfile, unsigned objects, unsigned timesteps, bool genRanOrientsAdditionally)
void initTestSets(const std::string &testSetFolderPath)
boost::shared_ptr< CombinatorialTrainer > CombinatorialTrainerPtr
unsigned int maxTreeHeight
double confidenceThreshold
ISM::CombinatorialTrainerParameters getDefaultParams()
void testScenes(const std::string &outputPath)
void prepareSceneTests(const std::string &outputPath)
std::vector< unsigned > objectCounts
std::vector< ISM::CombinatorialTrainerParameters > parameters
struct EvaluatorParameters evaluator
std::string storeValidTestSetsTo
bool storeStartTopologyISM
void testPerformance(const std::string &outputPath)