【问题标题】:Parma Polyhedra Library: Vertex Enumeration帕尔马多面体库:顶点枚举
【发布时间】:2015-07-13 04:01:54
【问题描述】:

我正在尝试使用 Parma Polyhedra Library [1] 来枚举(凸)多面体的顶点,例如,我有一个由四个约束指定的矩形:

Constraint_System cs;
cs.insert(x >= 0);
cs.insert(x <= 3);
cs.insert(y >= 0);
cs.insert(y <= 3);
C_Polyhedron ph(cs);

如何生成顶点?

【问题讨论】:

    标签: c++ discrete-mathematics polyhedra


    【解决方案1】:

    PPL 中的每个形状都有双重表示:1) Constraint_System,2) Generator_System。对于凸多面体,生成器系统将包含一组生成器,它们可以是 1) 点、2) 线、3) 射线。对于凸多面体,生成器集合将是所有点。您可以按如下方式获得生成器表示:

    Generator_System gs = ph.generators(); // Use ph.minimized_generators() to minimal set of points for the polytope
    for(Generator_System::const_iterator it = gs.begin(); it != gs.end(); it++) {
      const Generator& g = *it;
      assert(g.is_point()); // Assertions will fail for unbounded polyhedra
      std::cout << g;
    }
    

    【讨论】:

    • 感谢您的回答。我必须添加using namespace Parma_Polyhedra_Library::IO_Operators; 否则std::cout 不起作用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多