33 std::random_device rd;
36 boost::uniform_int<> dist(0,RAND_MAX);
37 boost::variate_generator<boost::mt19937,boost::uniform_int<>> gen(eng,dist);
41 std::vector<boost::shared_ptr<TestSet>>
testSets(pTestSetCount);
43 for (
unsigned int i = 0; i < pTestSetCount; i++)
45 testSets[i].reset(
new TestSet());
46 for (std::string objectType:
mTypes)
48 ISM::ObjectPtr object;
50 unsigned int counter = 0;
51 while (!
object && counter < pExamplesList.size())
53 unsigned int newRandomTimestep = gen() % pExamplesList.size();
54 for (ISM::ObjectPtr currentObject: pExamplesList[newRandomTimestep]->objects)
56 if (currentObject->type == objectType)
58 object = ISM::ObjectPtr(
new ISM::Object(*currentObject));
66 throw std::runtime_error(
"In TestSetGenerator::generateTestSets(): Failed to find object of type " + objectType +
" in evidence list.");
68 testSets[i]->mObjectSet->insert(
object);
std::vector< std::string > mTypes
~AbsoluteTestSetGenerator()
#define ROS_INFO_STREAM(args)
virtual std::vector< boost::shared_ptr< TestSet > > generateRandomSets(std::vector< boost::shared_ptr< ISM::ObjectSet >> pExamplesList, unsigned int pTestSetCount)
AbsoluteTestSetGenerator(boost::shared_ptr< AbstractTopologyEvaluator > pEvaluator, boost::shared_ptr< SceneModel::Topology > pFullyMeshedTopology, const std::vector< std::string > &pObjectTypes)