sadraddini / pypolycontain Goto Github PK
View Code? Open in Web Editor NEWA Toolbox For Polytopic Objects, Operations, and Containment Problems
A Toolbox For Polytopic Objects, Operations, and Containment Problems
I have a minor suggestion for your doc. In "Getting Started" line [8], you can replace sum_polytope=pp.operations.minkowski_sum(my_triangle,my_zonotope)
with sum_polytope=pp.minkowski_sum(my_triangle,my_zonotope)
to make it more consistent with other commands. https://github.com/sadraddini/pypolycontain/blob/master/doc/source/Getting%20Started.ipynb
When given a query point q
and zonotope z=zonotope(x,G)
, zonotope_distance_point(z,x)
may return something larger than distance(x,q)
. Example code:
import numpy as np
from pypolycontain.lib.zonotope import zonotope,zonotope_distance_point
iterations = 100
for i in range(iterations):
centroid_range = iterations
generator_range = 3
dimension = 2
m = np.random.random_integers(dimension, 10)
G = (np.random.rand(dimension, m) - 0.5) * generator_range
x = (np.random.rand(dimension, 1) - 0.5) * centroid_range
z1=zonotope(x,G,color="red")
query_point = (np.random.rand(1, dimension) - 0.5) * centroid_range
query_point = query_point.reshape(-1, 1)
d_centroid_query_point = np.subtract(np.ndarray.flatten(x), \
np.ndarray.flatten(query_point))
d_zonotope_query_point = zonotope_distance_point(z1,query_point)
print('x: ',x, 'query_point: ', query_point)
print('dist(x,q): %d, dist(zonotope, q): %d' %(np.linalg.norm(d_centroid_query_point),d_zonotope_query_point))
assert(d_zonotope_query_point <= np.linalg.norm(d_centroid_query_point))
Example output:
...
('x: ', array([[-11.8958544 ],
[-15.76381685]]), 'query_point: ', array([[-27.91779239],
[ 37.10888876]]))
dist(x,q): 55, dist(zonotope, q): 72
Traceback (most recent call last):
File ".../bounding_box_closest_polytope/pypolycontain/tests/test_zonotope_distance_2.py", line 27, in <module>
assert(d_zonotope_query_point <= np.linalg.norm(d_centroid_query_point))
AssertionError
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.