Difference between revisions of "Enclosing Circle Algorithm"

From edegan.com
Jump to navigation Jump to search
Line 38: Line 38:
 
[http://pypy.org/ PyPy]. [http://doc.pypy.org/en/latest/index.html Documentation here.]
 
[http://pypy.org/ PyPy]. [http://doc.pypy.org/en/latest/index.html Documentation here.]
  
 +
====Cython====
 
[http://cython.org/ Cython]. [http://docs.cython.org/en/latest/ Documentation here.]
 
[http://cython.org/ Cython]. [http://docs.cython.org/en/latest/ Documentation here.]
 
Basic tutorial for Cython is given [http://docs.cython.org/en/latest/src/tutorial/cython_tutorial.html here].
 
Basic tutorial for Cython is given [http://docs.cython.org/en/latest/src/tutorial/cython_tutorial.html here].
 +
 +
Currently, the RDP is missing a compiler to run Cython successfully. The error that appears is "unable to find vcvarsall.bat".
 +
 +
[https://github.com/cython/cython/wiki/InstallingOnWindows Here] is professional commentary on possible fixes.

Revision as of 18:55, 16 February 2017


McNair Project
Enclosing Circle Algorithm
Project logo 02.png
Project Information
Project Title
Start Date
Deadline
Primary Billing
Notes
Has project status
Copyright © 2016 edegan.com. All Rights Reserved.


Overview

This program takes in a set of points and the minimum number that should be included inside a unit, and returns circles of the smallest total area which encompass all of the data points. Function make_circle and all of its helper functions were taken from https://www.nayuki.io/res/smallest-enclosing-circle/smallestenclosingcircle.py.


Input: A sequence of pairs of floats or ints, e.g. [(0,5), (3.1,-2.7)]. Output: A triple of floats representing a circle. Returns the smallest circle that encloses all the given points. Runs in expected O(n) time, randomized.

Algorithm Description

Location

The original script is located in:

E:\McNair\Software\CodeBase\EnclosingCircle.py


Applications

VC Data

The Enclosing Circle Algorithm will be applied to VC data acquired through the SDC Platinum database. The script makes use of the Python GeoPy GeoCoder to get latitude and longitude coordinates to be used by the Enclosing Circle Algorithm.

Geopy Geocoder User Agreements can be found here.

The relevant files are located in:

E:\McNair\Projects\Accelerators\Enclosing_Circle

The results may eventually be plotted to a graph using python as well. Here is documentation for a python library called basemap.

CURRENT STATUS: Bug fixes needed in EnclosingCircle.py. The program errors with a key error on line 187 in cases where n is not a multiple of the length of the dataset. I made some temporary fixes to the enclosing circle file located in the above directory, but I am not certain if it is a permanent fix.

Speeding up with C

With the large amount of VC data we have, the enclosing circle algorithm would take an extremely long amount of time to run (on the order of weeks/months). If we can compile the code into C, we can speed up runtime dramatically. I've listed some possible sources for running python code as C.

PyPy. Documentation here.

Cython

Cython. Documentation here. Basic tutorial for Cython is given here.

Currently, the RDP is missing a compiler to run Cython successfully. The error that appears is "unable to find vcvarsall.bat".

Here is professional commentary on possible fixes.