I have the following code in C++:

Code: Select all

```
#include <polymake/Main.h>
#include <polymake/Matrix.h>
#include <polymake/SparseMatrix.h>
#include <polymake/Rational.h>
using namespace polymake;
int main(int argc, const char* argv[]) {
try {
const int dim = 4;
Main pm;
pm.set_application("polytope");
BigObject p("Polytope<Rational>");
std::vector<std::string> CoordinateLabels = { "x1", "x2", "x3" };
std::vector<std::vector<int>> Points;
std::vector<int> point = { 0,0,0 }; Points.push_back(point);
point = { 0,0,1 }; Points.push_back(point);
point = { 0,1,0 }; Points.push_back(point);
point = { 0,1,1 }; Points.push_back(point);
point = { 1,0,0 }; Points.push_back(point);
point = { 1,0,1 }; Points.push_back(point);
point = { 1,1,0 }; Points.push_back(point);
point = { 1,1,1 }; Points.push_back(point);
p.take("VERTICES") << (ones_vector<Rational>() | 3*unit_matrix<Rational>(dim));//How to make p "take" or load the points from Points?
const Matrix<Rational> f = p.give("FACETS");
cout << "facets" << endl << f << endl;
const Matrix<Rational> affine_hull = p.give("AFFINE_HULL");
cout << "affine hull is " << endl << affine_hull<<endl;
//How to access details of f and affine_hull object such as, how many facets are returned? In the example with Points,
//is there something like f.size() which returns the number of facets?
//f does not seem to have method size() implemented. Hence this query.
//How should the user access the coefficient of x1 in the first facet, what is the rhs of the facet,
//what is the sense of the facet ?
//Essentially, can I iterate through the list of facets using something equivalent to an STL Iterator?
//Similar query regarding accessing coefficients and right hand side of the affine hull equations.
}
catch (const std::exception& ex) {
std::cerr << "ERROR: " << ex.what() << endl; return 1;
}
return 0;
}
```

(1)What is the syntax to populate the "VERTICES" property of a BigObject p("Polytope<Rational>") from the user's data structures such as say an array or std::vector of points? In the code example above, for instance, I have the eight vertices of a unit cube stored in a Points data structure that I would like to somehow pass into "VERTICES".

(2)Once polymake computes the facets and the affine hull, how can the user query details such as, how many facets / affine hull equations are there in the convex hull? f.size(), in the above code, for instance, does not compile as f does not seem to have the size() method. Similarly, how can one find out for the 3rd facet, what is the coefficient of variable x2, say, whether the facet inequality is a <= or a >= and what the rhs of the specific facet / affine hull is.

Thank you.