This is an example of how to use the netdem library.
#include <filesystem>
#include <iostream>
#include <string>
using namespace std;
void GenDatasetTrimeshPlane(int num_samples = 100);
void TestDatasetTrimeshPlane();
void TrainClassifierTrimeshPlane();
void TestClassifierTrimeshPlane();
void TrainRegressorTrimeshPlane();
void TestRegressorTrimeshPlane(int id_comp = 0);
void TestANNvsGeometricTrimeshPlane();
void GenDatasetTrimesh(int num_samples = 100);
void TestDatasetTrimesh();
void TrainClassifierTrimesh();
void TestClassifierTrimesh();
void TrainRegressorTrimesh();
void TestRegressorTrimesh(int id_comp = 0);
void TestANNvsGeometricTrimesh();
void TestANNvsGeometricTrimesh_v2();
void GenDatasetEllipsoidPlane(int num_samples = 100);
void TestDatasetEllipsoidPlane();
void TrainClassifierEllipsoidPlane();
void TestClassifierEllipsoidPlane();
void TrainRegressorEllipsoidPlane();
void TestRegressorEllipsoidPlane(int id_comp = 0);
void TestANNvsGeometricEllipsoidPlane();
void GenDatasetEllipsoid(int num_samples = 100);
void TestDatasetEllipsoid();
void TrainClassifierEllipsoid();
void TestClassifierEllipsoid();
void TrainRegressorEllipsoid();
void TestRegressorEllipsoid(int id_comp = 0);
void TestANNvsGeometricEllipsoid();
void TestANNvsGeometricEllipsoid_v2();
void RandomPackingTrimesh(int argc, char **argv);
void TriaxialComp();
void AngleOfRepose(int argc, char **argv);
void RandomPackingEllipsoid(int argc, char **argv);
int main(
int argc,
char **argv) {
if (argc == 1) {
cout << "please specify the id of the task. \n"
<< "e.g.: netdem_example_netdem i" << endl;
cout << ">> 00: genertate dataset for trimesh plane case" << endl;
cout << ">> 01: test dataset for trimesh plane case" << endl;
cout << ">> 02: train classifier for trimesh plane case" << endl;
cout << ">> 03: test classifier for trimesh plane case" << endl;
cout << ">> 04: train regressor for trimesh plane case" << endl;
cout << ">> 05: test regressor for trimesh plane case" << endl;
cout << ">> 06: test ann vs geometric for trimesh plane case" << endl;
cout << ">> 10: genertate dataset for trimesh trimesh case" << endl;
cout << ">> 11: test dataset for trimesh trimesh case" << endl;
cout << ">> 12: train classifier for trimesh trimesh case" << endl;
cout << ">> 13: test classifier for trimesh trimesh case" << endl;
cout << ">> 14: train regressor for trimesh trimesh case" << endl;
cout << ">> 15: test regressor for trimesh trimesh case" << endl;
cout << ">> 16: test ann vs geometric for trimesh trimesh case" << endl;
cout << ">> 20: genertate dataset for ellipsoid plane case" << endl;
cout << ">> 21: test dataset for ellipsoid plane case" << endl;
cout << ">> 22: train classifier for ellipsoid plane case" << endl;
cout << ">> 23: test classifier for ellipsoid plane case" << endl;
cout << ">> 24: train regressor for ellipsoid plane case" << endl;
cout << ">> 25: test regressor for ellipsoid plane case" << endl;
cout << ">> 26: test ann vs geometric for ellipsoid plane case" << endl;
cout << ">> 30: genertate dataset for ellipsoid ellipsoid case" << endl;
cout << ">> 31: test dataset for ellipsoid ellipsoid case" << endl;
cout << ">> 32: train classifier for ellipsoid ellipsoid case" << endl;
cout << ">> 33: test classifier for ellipsoid ellipsoid case" << endl;
cout << ">> 34: train regressor for ellipsoid ellipsoid case" << endl;
cout << ">> 35: test regressor for ellipsoid ellipsoid case" << endl;
cout << ">> 36: test ann vs geometric for ellipsoid ellipsoid case" << endl;
cout << ">> 90: random packing" << endl;
cout << ">> 91: triaxial compression" << endl;
cout << ">> 92: angle of repose" << endl;
return -1;
}
string root_dir = "local/examples/netdem/ann_models/";
filesystem::create_directories(root_dir + "trimesh_plane/training/");
filesystem::create_directories(root_dir + "trimesh_trimesh/training/");
filesystem::create_directories(root_dir + "ellipsoid_plane/training/");
filesystem::create_directories(root_dir + "ellipsoid_ellipsoid/training/");
int id = atof(argv[1]);
switch (id) {
case 0:
if (argc == 2) {
GenDatasetTrimeshPlane();
} else {
int num_samples = atof(argv[2]);
GenDatasetTrimeshPlane(num_samples);
}
break;
case 1:
TestDatasetTrimeshPlane();
break;
case 2:
TrainClassifierTrimeshPlane();
break;
case 3:
TestClassifierTrimeshPlane();
break;
case 4:
TrainRegressorTrimeshPlane();
break;
case 5:
if (argc == 2) {
TestRegressorTrimeshPlane();
} else {
int id_comp = atof(argv[2]);
TestRegressorTrimeshPlane(id_comp);
}
break;
case 6:
TestANNvsGeometricTrimeshPlane();
break;
case 10:
if (argc == 2) {
GenDatasetTrimesh();
} else {
int num_samples = atof(argv[2]);
GenDatasetTrimesh(num_samples);
}
break;
case 11:
TestDatasetTrimesh();
break;
case 12:
TrainClassifierTrimesh();
break;
case 13:
TestClassifierTrimesh();
break;
case 14:
TrainRegressorTrimesh();
break;
case 15:
if (argc == 2) {
TestRegressorTrimesh();
} else {
int id_comp = atof(argv[2]);
TestRegressorTrimesh(id_comp);
}
break;
case 16:
TestANNvsGeometricTrimesh();
break;
case 17:
TestANNvsGeometricTrimesh_v2();
break;
case 20:
if (argc == 2) {
GenDatasetEllipsoidPlane();
} else {
int num_samples = atof(argv[2]);
GenDatasetEllipsoidPlane(num_samples);
}
break;
case 21:
TestDatasetEllipsoidPlane();
break;
case 22:
TrainClassifierEllipsoidPlane();
break;
case 23:
TestClassifierEllipsoidPlane();
break;
case 24:
TrainRegressorEllipsoidPlane();
break;
case 25:
if (argc == 2) {
TestRegressorEllipsoidPlane();
} else {
int id_comp = atof(argv[2]);
TestRegressorEllipsoidPlane(id_comp);
}
break;
case 26:
TestANNvsGeometricEllipsoidPlane();
break;
case 30:
if (argc == 2) {
GenDatasetEllipsoid();
} else {
int num_samples = atof(argv[2]);
GenDatasetEllipsoid(num_samples);
}
break;
case 31:
TestDatasetEllipsoid();
break;
case 32:
TrainClassifierEllipsoid();
break;
case 33:
TestClassifierEllipsoid();
break;
case 34:
TrainRegressorEllipsoid();
break;
case 35:
if (argc == 2) {
TestRegressorEllipsoid();
} else {
int id_comp = atof(argv[2]);
TestRegressorEllipsoid(id_comp);
}
break;
case 36:
TestANNvsGeometricEllipsoid();
break;
case 37:
TestANNvsGeometricEllipsoid_v2();
break;
case 90:
RandomPackingTrimesh(argc, argv);
break;
case 91:
TriaxialComp();
break;
case 92:
AngleOfRepose(argc, argv);
break;
case 96:
RandomPackingEllipsoid(argc, argv);
break;
default:
break;
}
return 0;
}
int main(int argc, char *argv[])
Definition main.cpp:18