Opened 2 years ago
Closed 2 years ago
#30954 closed enhancement (fixed)
Implement a proper equality check for polyhedron representation objects
Reported by:  ghkliem  Owned by:  

Priority:  major  Milestone:  sage9.3 
Component:  geometry  Keywords:  scalars, polyhedra 
Cc:  JeanPhilippe Labbé, Laith Rastanawi  Merged in:  
Authors:  Jonathan Kliem  Reviewers:  JeanPhilippe Labbé 
Report Upstream:  N/A  Work issues:  
Branch:  9ee3335 (Commits, GitHub, GitLab)  Commit:  9ee33351d8a20008f4ed6d24205962917c180561 
Dependencies:  Stopgaps: 
Description (last modified by )
sage: P = (1/2)*polytopes.cube() sage: Q = (1/2)*polytopes.cube(backend='field') sage: for p in P.inequalities(): ....: assert p in Q.inequalities() ....:  AssertionError Traceback (most recent call last) <ipythoninput16d0a8f3fbfdbb> in <module> 1 for p in P.inequalities(): > 2 assert p in Q.inequalities() 3 AssertionError:
This isn't acceptable. Those inequalites are the same, only the defining vector differs by a positive scalar.
We also define a method is_facet_defining_inequality
that checks whether self
could replace an inequality of the polyhedron other
. This is useful, when other
is not fulldimensional and inequalities aren't unique (only after affine_hull_projection
).
Change History (10)
comment:1 Changed 2 years ago by
Branch:  → public/30954 

Commit:  → 4c1f2950e60a4d0a0ff4f46ebf5adb4247c20a7b 
Summary:  Implement a proper equality check for representation objects → Implement a proper equality check for polyhedron representation objects 
comment:2 Changed 2 years ago by
Commit:  4c1f2950e60a4d0a0ff4f46ebf5adb4247c20a7b → b1eac2c770c01961979580283c4500c42b56971b 

Branch pushed to git repo; I updated commit sha1. New commits:
b1eac2c  implement is_facet_defining_inequality

comment:3 Changed 2 years ago by
Description:  modified (diff) 

Status:  new → needs_review 
comment:4 followup: 5 Changed 2 years ago by
Reviewers:  → JeanPhilippe Labbé 

Minor things:
 cross_slack_matrix = self_matrix*hom_Vrep + cross_slack_matrix = self_matrix * hom_Vrep
 if any(self.A()*line.vector() for line in other.lines()): + if any(self.A() * line.vector() for line in other.lines()):
In the TEST block, I would remove the QQ(*)
to save some space... (could you also indent/line split?)
Why is there a lonely ::
?:
+ False
+
+ ::
+
+ sage: P = Polyhedron(vertices=[[0,0,0],[0,1,0]], lines=[[1,0,0]])
comment:5 Changed 2 years ago by
Replying to jipilab:
Why is there a lonely
::
?:+ False + + :: + + sage: P = Polyhedron(vertices=[[0,0,0],[0,1,0]], lines=[[1,0,0]])
People use it to group examples, when they are too lazy to write down a nice sentence for each example.
comment:8 Changed 2 years ago by
Commit:  b1eac2c770c01961979580283c4500c42b56971b → 9ee33351d8a20008f4ed6d24205962917c180561 

Branch pushed to git repo; I updated commit sha1. New commits:
9ee3335  reviewers comments

comment:9 Changed 2 years ago by
Status:  needs_review → positive_review 

Thanks! Looks good and will be useful!
comment:10 Changed 2 years ago by
Branch:  public/30954 → 9ee33351d8a20008f4ed6d24205962917c180561 

Resolution:  → fixed 
Status:  positive_review → closed 
New commits:
scale rays, lines, inequalities and equations for comparison