本文整理匯總了Python中sage.libs.ppl.C_Polyhedron.minimized_generators方法的典型用法代碼示例。如果您正苦於以下問題:Python C_Polyhedron.minimized_generators方法的具體用法?Python C_Polyhedron.minimized_generators怎麽用?Python C_Polyhedron.minimized_generators使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sage.libs.ppl.C_Polyhedron
的用法示例。
在下文中一共展示了C_Polyhedron.minimized_generators方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Polyhedron_QQ_ppl
# 需要導入模塊: from sage.libs.ppl import C_Polyhedron [as 別名]
# 或者: from sage.libs.ppl.C_Polyhedron import minimized_generators [as 別名]
#.........這裏部分代碼省略.........
d = lcm([denominator(ieq_i) for ieq_i in ieq])
dieq = [ ZZ(d*ieq_i) for ieq_i in ieq ]
b = dieq[0]
A = dieq[1:]
cs.insert(Linear_Expression(A, b) >= 0)
if eqns is None: eqns = []
for eqn in eqns:
d = lcm([denominator(eqn_i) for eqn_i in eqn])
deqn = [ ZZ(d*eqn_i) for eqn_i in eqn ]
b = deqn[0]
A = deqn[1:]
cs.insert(Linear_Expression(A, b) == 0)
self._ppl_polyhedron = C_Polyhedron(cs)
self._init_Vrepresentation_from_ppl(minimize)
self._init_Hrepresentation_from_ppl(minimize)
def _init_Vrepresentation_from_ppl(self, minimize):
"""
Create the Vrepresentation objects from the ppl polyhedron.
EXAMPLES::
sage: p = Polyhedron(vertices=[(0,1/2),(2,0),(4,5/6)],
... backend='ppl') # indirect doctest
sage: p.Hrepresentation()
(An inequality (1, 4) x - 2 >= 0,
An inequality (1, -12) x + 6 >= 0,
An inequality (-5, 12) x + 10 >= 0)
sage: p._ppl_polyhedron.minimized_constraints()
Constraint_System {x0+4*x1-2>=0, x0-12*x1+6>=0, -5*x0+12*x1+10>=0}
sage: p.Vrepresentation()
(A vertex at (0, 1/2), A vertex at (2, 0), A vertex at (4, 5/6))
sage: p._ppl_polyhedron.minimized_generators()
Generator_System {point(0/2, 1/2), point(2/1, 0/1), point(24/6, 5/6)}
"""
self._Vrepresentation = []
gs = self._ppl_polyhedron.minimized_generators()
for g in gs:
if g.is_point():
d = g.divisor()
Vertex(self, [x/d for x in g.coefficients()])
elif g.is_ray():
Ray(self, g.coefficients())
elif g.is_line():
Line(self, g.coefficients())
else:
assert False
self._Vrepresentation = tuple(self._Vrepresentation)
def _init_Hrepresentation_from_ppl(self, minimize):
"""
Create the Vrepresentation objects from the ppl polyhedron.
EXAMPLES::
sage: p = Polyhedron(vertices=[(0,1/2),(2,0),(4,5/6)],
... backend='ppl') # indirect doctest
sage: p.Hrepresentation()
(An inequality (1, 4) x - 2 >= 0,
An inequality (1, -12) x + 6 >= 0,
An inequality (-5, 12) x + 10 >= 0)
sage: p._ppl_polyhedron.minimized_constraints()
Constraint_System {x0+4*x1-2>=0, x0-12*x1+6>=0, -5*x0+12*x1+10>=0}
sage: p.Vrepresentation()