Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a proper equality check for polyhedron representation objects #30954

Closed
kliem opened this issue Nov 23, 2020 · 15 comments
Closed

Implement a proper equality check for polyhedron representation objects #30954

kliem opened this issue Nov 23, 2020 · 15 comments

Comments

@kliem
Copy link
Contributor

kliem commented Nov 23, 2020

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)
<ipython-input-16-d0a8f3fbfdbb> 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 full-dimensional and inequalities aren't unique (only after affine_hull_projection).

CC: @jplab @LaisRast

Component: geometry

Keywords: scalars, polyhedra

Author: Jonathan Kliem

Branch/Commit: 9ee3335

Reviewer: Jean-Philippe Labbé

Issue created by migration from https://trac.sagemath.org/ticket/30954

@kliem kliem added this to the sage-9.3 milestone Nov 23, 2020
@kliem
Copy link
Contributor Author

kliem commented Nov 23, 2020

Commit: 4c1f295

@kliem
Copy link
Contributor Author

kliem commented Nov 23, 2020

New commits:

4c1f295scale rays, lines, inequalities and equations for comparison

@kliem
Copy link
Contributor Author

kliem commented Nov 23, 2020

Branch: public/30954

@kliem kliem changed the title Implement a proper equality check for representation objects Implement a proper equality check for polyhedron representation objects Nov 23, 2020
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2020

Changed commit from 4c1f295 to b1eac2c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2020

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

b1eac2cimplement is_facet_defining_inequality

@kliem

This comment has been minimized.

@jplab
Copy link

jplab commented Nov 24, 2020

Reviewer: Jean-Philippe Labbé

@jplab
Copy link

jplab commented Nov 24, 2020

comment:4

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]])

@kliem
Copy link
Contributor Author

kliem commented Nov 24, 2020

comment:5

Replying to @jplab:

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.

@kliem
Copy link
Contributor Author

kliem commented Nov 24, 2020

comment:6

It's just a new example, I redefine P, I redefine Q.

@jplab
Copy link

jplab commented Nov 24, 2020

comment:7

You forgot # optional - pynormaliz in the test-block.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2020

Changed commit from b1eac2c to 9ee3335

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2020

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

9ee3335reviewers comments

@jplab
Copy link

jplab commented Nov 25, 2020

comment:9

Thanks! Looks good and will be useful!

@vbraun
Copy link
Member

vbraun commented Dec 5, 2020

Changed branch from public/30954 to 9ee3335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants