-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Containers for families of geometric objects #32170
Comments
comment:1
The precision of interval values in Package They did not claim it explicitly, but I found it from
|
comment:2
OK, the next step would be to find out whether the library does any arithmetic with these |
This comment has been minimized.
This comment has been minimized.
comment:4
The library
and etc. Besides, the library
|
comment:6
A few test codes have been made for testing arithmetic precision. The conclusions are as follows, more details and codes can be found from this(https://github.com/DRKWang/Data-structure-for-piecewise-linear-function/blob/main/log35.ipynb).
|
comment:7
I have made some debugs for this library. I would like to list the key points below. The entire log file can be found here https://github.com/DRKWang/Data-structure-for-piecewise-linear-function/blob/main/logsfile/log36.ipynb.
|
comment:8
|
comment:9
I am trying to build a subclass called The intention of building this subclass is to keep the interface of this class, (I feel basically the interface can be considered as functions), the same and use |
comment:10
Replying to @DRKWang:
That's right, we are not replacing the internal representation of We are only adding an index data structure to it. |
comment:11
Since the |
comment:12
As the boxes overestimate the true objects, a |
comment:13
For |
comment:14
Replying to @mkoeppe:
Yes, I think |
comment:15
I am thinking about changing the internal code of function |
comment:16
Replying to @DRKWang:
Yes, I agree. This is a general change that should be made throughout the |
comment:17
I see. I have made the changes inside the
Specifically, the functions I made the change are |
comment:18
Replying to @DRKWang:
Try changing these methods to And push the branch please to the ticket |
Commit: |
Branch: public/32170 |
New commits:
|
comment:20
Got it. I have made the change inside the
The above changes, including whole changes for |
comment:21
Since I also want to take a test to check whether it performs correctly and since it has been changed under the |
comment:22
Also, I always have a question on how to pushing the latest changes correctly for the sagemath. Assuming there are no previous branches was uploaded for a ticket, If I want to upload a new initial branch for it, either should I merge to the latest version, for example, currently it is sage-9.5, before uploading, or is it ok to keep an old version only if we can run the code without errors? |
comment:23
Yes, your current branch has a merge conflict with the current |
comment:46
Replying to @mkoeppe:
I agree that "the normal vectors of all facets of all cones could also be good candidates for separating these cones". In some sense, those facets can be basically categorized into 2 types, either a facet including an intersection of two maximal cones, or just a pure facet without any intersection. Comparing those two types with each other, the first one seems to be more important and "separating", since the first one focuses on neighbor separating, whereas the second one does not show any information. Thus, we could generate some projecting directions based on the normal vectors of some facets of cones. Generally, the facets including an intersection can still be categorized into more subtypes based on what is the dimension of the intersection. And heuristically, the higher dimension of the intersection is, the more efficient this normal vector is. But, due to the complexity problem, I feel it is not necessary to categorize those facets at that level. Even though the above method seems to be efficient, it could be weak when it comes to the case where all cones of a given do not have any intersection except the original points. In that case, there is no "first type of facets" at all. Thus, if that happens, we may need other ways to generate those directions. A good way is to use the direction coming from 2 center points of the tokens of two neighboring cones as supplied directions. |
comment:48
For the |
comment:49
For the static construction, we may build the rtree by 3 ways, top-down, bottom-up or hybrid. Supposedly, there are The idea of top-down should be made by recursive operation, which means the parent tree will be built after their children's trees were built. My expectation will be something like an H tree (https://en.wikipedia.org/wiki/H_tree), which has a property of self-similar fractal, or like a
For the bottom-up, we may use the greedy strategy to do the local optimization on each step. We can always merge two boxes based on some criteria, like merging the two boxes that have minimal 1-norm distance. And replace the 2 boxes with merged box, so that the size of the input will be decreased by 1, (now the number of boxes will be The complexity will be at least For the hybrid one, we can build the rtree partially by top-down and partially by bottom-up in certain steps. But, how to combining them adaptively is still a hard problem for me. I would like to implement the first two before thinking about the third one. |
comment:50
The following content in latex form can be checked in this link.(https://github.com/DRKWang/cutgeneratingfunctions_new/blob/main/logsfile/log48.ipynb) To determine whether a given fan is a pointed fan or not, we may encode it into an linear optimization. Observation:If a fan is pointed, then there exists a containing-the-original-point hyperplane that could divide the space into 2 half-spaces, one containing the fan and the other not. Analysis:We may think about finding the normal vector of this hyperplane via optimzation. Supposing that the normal vector of this hyperplane is then we may have let the constraints be: Since we do not hope to get If we can not find any solution for this system, then the fan is not pointed. In practice, in order to give a initial solution for simplex method, we may change the system into the following form: max. : s.t. As is desired, A better hyperplane for generating better projectionSeemingly, we may have optional hyperplanes for the same system. The ideal hyperplane would be constraints are all Similarly, in order to have a initial solution, we may change the system into the following form: max. :$ b_0$ As is desired, |
comment:51
Except for the above view, we may think differently from the view of the convex hull of the fan, but it will be much harder than the above one, in terms of implementation and theory. Based on the following observation, we can have: If the convex hull of the fan is the universal space, then it is not pointed; otherwise, it is pointed. Thus, we can figure out the convex hull to determine whether it is pointed or not. In the beginning, my imagination to compute the convex hull will be the "Graham scan method", a popular method for computing the convex hull in 2 dimensions. But when it comes to high dimensions, this algorithm will fail and be replaced by an algorithm called "Quickhull", (https://en.wikipedia.org/wiki/Quickhull), for computing the convex hull. This algorithm is a little randomized for initial selection and a little bit complicated understanding. And in terms of performance, although this algorithm may recursively get the convex hull, we still need to compute the normal vector for the hyperplane, onto which the fan will be projected, based on the above optimization. |
comment:52
As is enlightened by your idea for considering the double descriptions of cones, facets, and generating rays, we may have a facets-based method to find the proper normal vector of the separating hyperplane for a pointed fan. Observation: For a cone, a ray is in the (interior or boundary) of its polar cone, if and only if, the ray can induce (an interior or a boundary) separating hyperplane, whose normal vector is the ray, for this cone. Note that the polar cone of cone the polar cone of cone Thus, to figure out the separating hyperplane for a fan, the polar cones of cones in this fan can provide help. Observation: For a fan, a ray is in the interior points of the common intersection of all polar cones of the fan, if and only if, the ray can induce an interior separating hyperplane for the fan. Proof A ray is in the interior points of the common intersection of all polar cones, Thus, we can have a better understanding of the location of the normal vector of separating hyperplane for a fan. Meanwhile, we can also use it to determine whether a fan is a pointed fan or not. |
comment:53
Based on these testing records https://github.com/DRKWang/cutgeneratingfunctions_new/blob/main/test_for_facets_and_generating_rays_based_methods.ipynb, in terms of time, the generating-rays-based method has significantly outperformed the facets-based method. In my two cents, since LP-solver only takes a little time and the solution for the linear programming can be easily verified, we may use the LP-solver first to try to get a solution, if it fails or it only gives zero solution, then we use the facets-based method instead; otherwise, if the solution is non-zero, we may verify its correctness, and if the solution is correct, then we are home and we do not need the facets-based method. This mixed-method is better than the pure facets-based method especially in the case that the fan is pointed because in that case, it is really difficult to compute common intersection for all cones with keeping in analytical status according to the testing records. |
comment:54
Apart from the function |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Author: Binshuai Wang |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:60
Docbuild fails
|
Dependencies: #34277 |
Work Issues: Rebase on #34277 |
We define APIs for static and dynamic containers storing finite families of geometric objects, extending
Container
,Set
,MutableSet
,Mapping
,MutableMapping
https://docs.python.org/3/library/collections.abc.htmlThe family must define a collection of "measurement maps"
B_i
, each sending an object to anInternalRealInterval
.The product of these intervals can be thought of as a "generalized bounding box".
Ideally the maps would be inclusion-preserving.
The implementation is provided by
rtree
/libspatialindex
(#32000).The Sage-specific class will take care of:
InternalRealInterval
by a rescaling or inclusion-preserving overestimation, making the coordinates suitable for the underlying library.intersection
when the result will be empty,__contains__
when the result will beFalse
.Geometric lookup operations to be supported:
Applications:
RationalPolyhedralFan
PolyhedralComplex
(PolyhedralComplex #31748)B_i
comes from the coordinates of covering charts, using(-oo, oo)
for coordinates for which no coordinate definition for the subset is knownDepends on #34277
CC: @DRKWang
Component: geometry
Work Issues: Rebase on #34277
Author: Binshuai Wang
Branch/Commit: public/32170 @
05ea99d
Issue created by migration from https://trac.sagemath.org/ticket/32170
The text was updated successfully, but these errors were encountered: