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

Task: CombinatorialPolyhedron: replace attributes by methods, make names more consistent with Polyhedron #28280

Closed
kliem opened this issue Jul 29, 2019 · 49 comments

Comments

@kliem
Copy link
Contributor

kliem commented Jul 29, 2019

This ticket gathers tickets related to the `CombinatorialPolyhedron' class.

The goal is to make this class consistent with the base class Polyhedron_base.

Some of the tickets also take care of minor bug fixes or typos.

CC: @jplab @tscrim @videlec @LaisRast @fchapoton

Component: geometry

Author: Jonathan Kliem

Reviewer: Jean-Philippe Labbé

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

@kliem kliem added this to the sage-8.9 milestone Jul 29, 2019
@kliem
Copy link
Contributor Author

kliem commented Jul 29, 2019

comment:1

Some attributes like bitrep_vertices might have been an unfortunate choice:

As they are accessed by other classes, I'm forced to compute e.g. bitrep_vertices on initialization. If CombinatorialPolyhedron was ever to be a parent of Polyhedron_base (see #10777), this would force a polyhedron to compute the incidence matrix right away.

From my understanding, the decorator @lazy_attribute is not available for extension types directly. I'm thinking of changing those attributes to methods, such that there is a method bitrep_facets and an attribute _bitrep_facets. This way one can later change this to be lazily evaluated.

Any thoughts?

@kliem
Copy link
Contributor Author

kliem commented Jul 29, 2019

Branch: public/28280

@kliem
Copy link
Contributor Author

kliem commented Jul 29, 2019

Dependencies: #27987

@kliem
Copy link
Contributor Author

kliem commented Jul 29, 2019

Author: Jonathan Kliem

@kliem
Copy link
Contributor Author

kliem commented Jul 29, 2019

Commit: 0aed9fd

@kliem
Copy link
Contributor Author

kliem commented Jul 29, 2019

New commits:

d6d663acombinatorial polyhedron uses far face as a bug fix
14d17a8added doctest reporting the bug fix
806a217correct link to trac ticket, if unbounded is False -> if not unbounded
9194627replace attributes by methods
0aed9fdremoved empty folder being created in source

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 6, 2019

Changed commit from 0aed9fd to 2fc4fe0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 6, 2019

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

d597ed3replace attributes by methods
2fc4fe0removed empty folder being created in source

@kliem
Copy link
Contributor Author

kliem commented Aug 6, 2019

Changed dependencies from #27987 to none

@tscrim
Copy link
Collaborator

tscrim commented Aug 7, 2019

comment:7

If a @lazy_attribute doesn't work, then just make it a @cached_method (with no arguments).

@kliem
Copy link
Contributor Author

kliem commented Aug 12, 2019

comment:8

Replying to @tscrim:

If a @lazy_attribute doesn't work, then just make it a @cached_method (with no arguments).

Does either one work with cdef?

Here, I want to give a small example of what I want to do:

sage: cython('''
....: cdef class BaseClass:
....:     cdef public int number
....: 
....:     def __init__(self):
....:         self.number = 2
....: ''')
sage: class NewClass(BaseClass):
....:     def __init__(self):
....:         pass
....:     
sage: example = NewClass()
sage: example.number
0

I'm trying to somehow make number be a lazy attribute. The only solution I came up with, is to replace it by a method. Is there another way?

The background is that CombinatorialPolyhedron does require Polyhedron to compute the incidence matrix for correct initialization. If CombinatorialPolyhedron is to be a base class of Polyhedron_base at some point (#10777), it needs to be lazily initialized.

@kliem

This comment has been minimized.

@kliem
Copy link
Contributor Author

kliem commented Aug 26, 2019

comment:9

Is this the right approach, am I missing something? Is it acceptable to do those name changes? (CombinatorialPolyhedron still was not part of a stable release)

If so, I think the review is rather trivial and I can try to find someone else to do it.

@jplab
Copy link
Contributor

jplab commented Sep 9, 2019

comment:10

Some comments:

Since these methods will then occur in the namespace, perhaps it would make sense to make it consistent with the names of the methods for Polyhedron. For example, unbounded -> is_(un)bounded. Probably it would make more sense to store is_bounded rather than unbounded....

Similar for V and H, having a method with only one letter is not so revealing...

I guess it is important to be careful with the naming at this precise moment as after, changing the name of methods will force the usage of deprecation warnings and that's annoying. (I believe that some methods should be changed to be consistent with Polyhedron...).

@kliem

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 10, 2019

Changed commit from 2fc4fe0 to 5f0f704

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 10, 2019

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

037b3edridge_graph -> facet_graph; some bug fixing
07e4ea7f_vector is a vector now
c18a757abbreavations: Hrepr -> Hrep, Vrepr -> Vrep etc.
4d165f5unbounded -> bounded, bounded(self) -> is_bounded(self)
bbd5c74length_Hrep -> n_Hrepresentation; likewise for Vrep
21b9e03removed attribute Vinv, as its not being used
c844ec5made specification to n_Hrepresentation in combinatorial_face
7403c4bHrep -> facet_names
b8cd255V -> Vrep
5f0f704added docstrings to the new methods

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 10, 2019

Changed commit from 5f0f704 to 7ef7332

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 10, 2019

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

7ef7332meaningful test for graph without edges

@jplab

This comment has been minimized.

@jplab jplab changed the title CombinatorialPolyhedron: replace attributes by methods, make names more consistent with Polyhedron Task: CombinatorialPolyhedron: replace attributes by methods, make names more consistent with Polyhedron Oct 24, 2019
@kliem
Copy link
Contributor Author

kliem commented Oct 25, 2019

Changed dependencies from #28603, #28604, #28605, #28606, #28607, #28608, #28613, #28614, #28615, #28616 to none

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@embray
Copy link
Contributor

embray commented Jan 6, 2020

comment:32

Ticket retargeted after milestone closed

@embray embray modified the milestones: sage-9.0, sage-9.1 Jan 6, 2020
@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@mkoeppe
Copy link
Contributor

mkoeppe commented Apr 14, 2020

comment:35

Batch modifying tickets that will likely not be ready for 9.1, based on a review of the ticket title, branch/review status, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.1, sage-9.2 Apr 14, 2020
@kliem
Copy link
Contributor Author

kliem commented Apr 24, 2020

comment:36

This task is taken care of.

@kliem kliem removed this from the sage-9.2 milestone Apr 24, 2020
@jplab
Copy link
Contributor

jplab commented May 11, 2020

comment:37

Please, close this ticket as it's objectives have been fulfilled! Thanks!

@jplab
Copy link
Contributor

jplab commented May 11, 2020

Reviewer: Jean-Philippe Labbé

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

6 participants