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

dump()/dumps() fails for class Polyhedron #10024

Closed
sagetrac-terhorst mannequin opened this issue Sep 27, 2010 · 8 comments
Closed

dump()/dumps() fails for class Polyhedron #10024

sagetrac-terhorst mannequin opened this issue Sep 27, 2010 · 8 comments

Comments

@sagetrac-terhorst
Copy link
Mannequin

sagetrac-terhorst mannequin commented Sep 27, 2010

Polyhedra (objects of class Polyhedron) cannot be dumped or saved:

sage: polytopes.dodecahedron(QQ).dumps()
---------------------------------------------------------------------------
PicklingError                             Traceback (most recent call last)

/home/terhorst/<ipython console> in <module>()

/opt/sage/local/lib/python2.6/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.SageObject.dumps (sage/structure/sage_object.c:2108)()

PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed

As a workaround, I pickle a hash of the rays, vertices, and lines defining the polyhedron.

CC: @vbraun

Component: geometry

Keywords: polyhedron polyhedra pickle dumps dump

Author: Volker Braun

Reviewer: Andrey Novoseltsev

Merged: sage-4.6.1.alpha0

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

@novoselt
Copy link
Member

Changed author from polyhedron polyhedra pickle dumps dump to none

@novoselt
Copy link
Member

Changed keywords from none to polyhedron polyhedra pickle dumps dump

@vbraun
Copy link
Member

vbraun commented Oct 24, 2010

Attachment: trac_10024_dump_fails_for_Polyhedron.patch.gz

Initial patch

@vbraun
Copy link
Member

vbraun commented Oct 24, 2010

comment:2

Patch fixes load/dump and adds comparisons, for example, P<=Q means P is a not-necessarily-strict subpolyhedron of Q.

@vbraun
Copy link
Member

vbraun commented Oct 24, 2010

Author: Volker Braun

@vbraun vbraun added this to the sage-4.6.1 milestone Oct 24, 2010
@novoselt
Copy link
Member

comment:3
  1. I think __setstate__ would look better without checks for exclude_keys which is unnecessary.
    1. Equality/"non-equality" tests seem to be not the most efficient ones, although for generic polyhedra it is not obvious what one should do instead.
    2. Chosen definition of ==, i.e. equality as sets of points, fits nicely together with other containment checks, but is inconsistent with the current situation for cones and fans. This bugs me a little bit, but not too much and I still prefer cones to take into account the ray order.

Anyway, all this is more like just thinking aloud, I am satisfied with the patch as is and switching it to positive review! (But feel free to address the first issue if you want ;-))

@novoselt
Copy link
Member

Reviewer: Andrey Novoseltsev

@jdemeyer
Copy link

jdemeyer commented Nov 1, 2010

Merged: sage-4.6.1.alpha0

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