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

Transition of combinatorial computations of Polyhedron to Combinatorial Type #27063

Closed
kliem opened this issue Jan 15, 2019 · 46 comments
Closed

Comments

@kliem
Copy link
Contributor

kliem commented Jan 15, 2019

In #26887 we created a new class, that handles the calculations depending only on the combinatorial type more quickly.

The goal of this ticket is to make use of this class throughout Polyhedron_base.

Add methods:

Replace the existing computation:

Migrate code to CombinatorialPolyhedron:

NOTE: The remaining bulletins are taken care of by exposing the adjacency matrices.

Depends on #28621
Depends on #28625
Depends on #28626

CC: @jplab @mkoeppe

Component: geometry

Keywords: polyhedron, face lattice

Author: Jonathan Kliem

Reviewer: Matthias Koeppe

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

@kliem kliem added this to the sage-8.6 milestone Jan 15, 2019
@embray
Copy link
Contributor

embray commented Jan 15, 2019

comment:1

Retarging tickets optimistically to the next milestone. If you are responsible for this ticket (either its reporter or owner) and don't believe you are likely to complete this ticket before the next release (8.7) please retarget this ticket's milestone to sage-pending or sage-wishlist.

@embray embray modified the milestones: sage-8.6, sage-8.7 Jan 15, 2019
@jplab jplab modified the milestones: sage-8.7, sage-8.8 Mar 14, 2019
@kliem
Copy link
Contributor Author

kliem commented Jun 14, 2019

Changed dependencies from #26887 to #26887, #27987

@kliem
Copy link
Contributor Author

kliem commented Jun 14, 2019

Branch: public/27063

@kliem
Copy link
Contributor Author

kliem commented Jun 14, 2019

Commit: 25407f8

@kliem

This comment has been minimized.

@kliem
Copy link
Contributor Author

kliem commented Jun 14, 2019

Last 10 new commits:

9b69f50added documentation and examples to each module
4e8fd8ccorrect hyperlinks
72ac3b0documentation fix
611099fDo not iterate twice for CombinatorialPolyhedron.facets()
d38e130added combinatorial face
ca60665improved docstring in list_of_all_faces
abe00b6fixed small issues
8765313A number of small edits.
d419d72Merge branch 'public/26887' of git://trac.sagemath.org/sage into public/27063
25407f8faces, f_vector, vertex_graph, vertex_digraph, neighborliness now use CombinatorialPolyhedron

@kliem
Copy link
Contributor Author

kliem commented Jun 14, 2019

Author: Jonathan Kliem

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 14, 2019

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

c4ccf86face lattice by CombinatorialPolyhedron

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 14, 2019

Changed commit from 25407f8 to c4ccf86

@embray
Copy link
Contributor

embray commented Jun 14, 2019

comment:5

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

@embray embray removed this from the sage-8.8 milestone Jun 14, 2019
@kliem kliem added this to the sage-8.9 milestone Jul 1, 2019
@jplab
Copy link

jplab commented Aug 27, 2019

comment:7

Concerning the .faces() method. Currently, .iter_face only deals with proper faces. ... is that the intended behavior?

From an old list (so maybe some of them are renamed), I also saw the following methods make use of .face_lattice, and probably would benefit from the combinatorial polyhedra:

  • adjacency_matrix
  • facet_adjacency_matrix
  • facial_adjacencies
  • is_simple
  • vertex_adjacency_matrix

It would be nice to make a thorough checking of which methods make use of "old style face lattice" things. It would be bad to not make the whole Polyhedron objects not benefit from this new class...

@jplab jplab removed this from the sage-8.9 milestone Aug 27, 2019
@jplab jplab added the pending label Aug 27, 2019
@kliem
Copy link
Contributor Author

kliem commented Aug 27, 2019

comment:8

Replying to @jplab:

Concerning the .faces() method. Currently, .iter_face only deals with proper faces. ... is that the intended behavior?

This is simply, because my method of intersecting faces and avoiding double counting has no guarantee to hit the empty face in the unbounded case. So one has to manually add it anyway. I would prefer leaving it like this in FaceIterator. But I can see that one wants to add those two extra faces (or only one for the empty polyhedron) when wrapping the class.

From an old list (so maybe some of them are renamed), I also saw the following methods make use of .face_lattice, and probably would benefit from the combinatorial polyhedra:

  • adjacency_matrix
  • facet_adjacency_matrix
  • facial_adjacencies

what does it do, I can't find it

  • is_simple

not anymore

  • vertex_adjacency_matrix

It would be nice to make a thorough checking of which methods make use of "old style face lattice" things. It would be bad to not make the whole Polyhedron objects not benefit from this new class...

Yes, that's my plan. If I actually go through with it and make CombinatorialPolyhedron a parent of Polyhedron_base, as was proposed in #10777, then CombinatorialPolyhedron should do all calculations that depend only on the incidence matrix.

@jplab
Copy link

jplab commented Aug 27, 2019

comment:9

Replying to @kliem:

Replying to @jplab:

Concerning the .faces() method. Currently, .iter_face only deals with proper faces. ... is that the intended behavior?

This is simply, because my method of intersecting faces and avoiding double counting has no guarantee to hit the empty face in the unbounded case. So one has to manually add it anyway. I would prefer leaving it like this in FaceIterator. But I can see that one wants to add those two extra faces (or only one for the empty polyhedron) when wrapping the class.

Sounds good.

From an old list (so maybe some of them are renamed), I also saw the following methods make use of .face_lattice, and probably would benefit from the combinatorial polyhedra:

  • adjacency_matrix
  • facet_adjacency_matrix
  • facial_adjacencies

what does it do, I can't find it

Then, fine.

  • is_simple

not anymore

Good

  • vertex_adjacency_matrix

It would be nice to make a thorough checking of which methods make use of "old style face lattice" things. It would be bad to not make the whole Polyhedron objects not benefit from this new class...

Yes, that's my plan. If I actually go through with it and make CombinatorialPolyhedron a parent of Polyhedron_base, as was proposed in #10777, then CombinatorialPolyhedron should do all calculations that depend only on the incidence matrix.

Great! Then, one should also take care to not let the Polyhedron_base overwrite them, but duh... I'm sure you know what your doing... :)

@kliem
Copy link
Contributor Author

kliem commented Aug 27, 2019

comment:10

Replying to @jplab:

Great! Then, one should also take care to not let the Polyhedron_base overwrite them, but duh... I'm sure you know what your doing... :)

Well, you can always access overwritten methods using super.

Does it make sense to leave a method as e.g. simple in Polyhedron_base just to have a more specific docstring? Otherwise we would eventually end up with docstrings gathering all examples from Polyhedron, LatticePolytope and Cone.

@jplab
Copy link

jplab commented Sep 1, 2019

comment:11

Replying to @kliem:

Replying to @jplab:

Great! Then, one should also take care to not let the Polyhedron_base overwrite them, but duh... I'm sure you know what your doing... :)

Well, you can always access overwritten methods using super.

Does it make sense to leave a method as e.g. simple in Polyhedron_base just to have a more specific docstring? Otherwise we would eventually end up with docstrings gathering all examples from Polyhedron, LatticePolytope and Cone.

I am not 100% sure about this. I believe that the method would stay in Polyhedron_base (think about the documentation online too) because one expects to see it there (and one does not directly think about the CombinatorialPolyhedron class directly, maybe) and the method would be only a couple of lines long and calling the combinatorial algorithm using super with the appropriate parameters.

On the long run, CombinatorialPolyhedron will contain the bulk of codes that strictly makes use of combinatorial data and Polyhedron_base things that use the geometry.

Further, concerning the present ticket, I believe it would make sense to make it a preparation ticket. Then each method would have 1 ticket. This way the changes will be more manageable.

Another open question: currently how is the relation between a Polyhedron object and a CombinatorialPolyhedron object? I guess that as of now, since the double description is computed by default, it is worth maybe creating the combinatorial counter part as an attribute and make it accessible via a method say named .combinatorial_polyhedron. This might make it easier to then transfer the computations to the combinatorial type.

When I create a combinatorial polyhedron from a polyhedron, it seems to keep the polyhedron object. Ideally, it would be nice to be able to go back and forth between them like it is for LP and Polyhedron (okay, it is not fully bakc and forth but still).

... and it would be nice if the methods of CombinatorialPolyhedron have exactly the same names for the same things H_representation vs Hrepr.

@kliem
Copy link
Contributor Author

kliem commented Sep 1, 2019

comment:12

Ok, this is a bunch of things. I realized that at some point it makes sense to create some sort of meta ticket for CombinatorialPolyhedron, also I realize that this ticket is more an agenda than anything else.

First of all, we should figure out, whether Polyhedron shall inherit from CombinatorialPolyhedron as a base class or whether its better to have it as a (lazy) method available.

Having it as a base class was proposed in #10777.

Maybe I should start a discussion on sage-devel to see what (interested) people think.

@kliem
Copy link
Contributor Author

kliem commented Oct 18, 2019

comment:13

I'm going to put this on needs review, so that people looking at #22420 will notice.

This way I can avoid adding each of the tickets to #22420.

If there is a better way of doing it, please tell me.

@kliem
Copy link
Contributor Author

kliem commented Oct 18, 2019

Changed dependencies from #26887, #27987 to #28621

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@jplab
Copy link

jplab commented Oct 26, 2019

comment:22

Concerning the face lattice, when it is going to be done, it would be nice to verify if some functions are then obsolete. (For example _make_polyhedron_face which is only used in the face_lattice method.)

@kliem

This comment has been minimized.

@kliem
Copy link
Contributor Author

kliem commented Jan 14, 2020

Changed commit from c4ccf86 to none

@kliem
Copy link
Contributor Author

kliem commented Jan 14, 2020

Changed branch from public/27063 to none

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem
Copy link
Contributor Author

kliem commented May 26, 2020

comment:33

Obtaining a graph that has vertices of the polyhedron as vertices is really slow. If you expose the option to obtain a graph with the vertices being the corresponding indices, that is much much faster.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@mkoeppe
Copy link
Member

mkoeppe commented Mar 31, 2022

comment:38

Mission accomplished!

@mkoeppe
Copy link
Member

mkoeppe commented Mar 31, 2022

Reviewer: Matthias Koeppe

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

4 participants