SimpleMSSP 1.0__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,99 @@
1
+ Metadata-Version: 2.4
2
+ Name: SimpleMSSP
3
+ Version: 1.0
4
+ Summary: Fast tools for single source shortest path routing on geometric weighted surfaces.
5
+ Author: Max Croucher
6
+ Author-email: Max Croucher <mpccroucher@gmail.com>
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: COPYING
10
+ Requires-Dist: numpy
11
+ Dynamic: author
12
+ Dynamic: license-file
13
+
14
+ ## Python Interface
15
+ The extension module `SimpleMSSP` is designed to expose the primary functionality of the routing tools to a Python program. Input and outputs are done using Python lists or NumPy arrays, with the latter being the preferred choice.
16
+ ### Dependencies
17
+ The following modules or libraries are required to build, use or test the Python interface.
18
+ #### Python Modules:
19
+ * [build](https://pypi.org/project/build/) (building)
20
+ * [numpy>=2.0](https://pypi.org/project/numpy/) (using and testing)
21
+ #### Libraries:
22
+ The NumPy C API is required to build this module from source, and is not required to use a compiled build.
23
+ * [numpy C API](https://numpy.org/doc/stable/reference/c-api/index.html) (building)
24
+ The NumPy C API should be automatically downloaded when downloading the Python module.
25
+ * On windows, you may need [Microsoft Visual C++](https://visualstudio.microsoft.com/visual-cpp-build-tools/). Python's build tool will complain if you need it.
26
+ ### Usage
27
+ Everything is done using the `Surface` class, which exposes the routing algorithms used by this module.
28
+ #### Initialisation
29
+
30
+ An instance of the `Surface` class is initialised with a 2-dimensional iterable such as a Python list of lists or a NumPy array. This array represents the search space, which a `Surface`'s routing algorithms will traverse during the execution of a search algorithm.
31
+ ```Python
32
+ >>> from SimpleMSSP import Surface
33
+ >>> S = Surface([[1,2,3],[4,5,6]])
34
+ ```
35
+ #### Attributes
36
+
37
+ After initialisation, a `Surface` object has a number of read-only attributes available to the programmer. They are as follows:
38
+ * Integers `Surface.height` and `Surface.width`. These values represent the dimensions of the search space, or the lengths of the outer and inner arrays (respectively) that comprise a search space. For example, the `Surface` object initialised in the previous code block has a width of 3 and a height of 2.
39
+ * Tuple `Surface.shape`. This tuple is simply a wrapper for the height and width of the search space.
40
+ * NumPy Array `Surface.cost_surface`. This read-only floating-point array directly references the search space stored in a `Surface` object, and can thus be used to refer back to a search space after the object used to initialise the `Surface` object has been destroyed.
41
+ * NumPy Array `Surface.distances`. This read-only floating-point array contains the distances from each point in a search space to the starting point of the last search executed. If no searches have been executed, accessing this attribute raises an exception.
42
+ * NumPy Array `Surface.parents`. For each point `p` in the search space, this read-only integer array stores the coordinates of the last point visited on the shortest path from the starting point of the last search to `p`. If no searches have been executed, accessing this attribute raises an exception.
43
+ #### Methods
44
+ Dijkstra's algorithm is the primary algorithm used by this module, and is invoked with `Surface.dijkstra()`. This method requires a start point (represented by a tuple) and a Python list of at least one end point. Optionally, the positional argument `max_distance` can be specified to limit the range of Dijkstra's algorithm.
45
+ ```Python
46
+ >>> from SimpleMSSP import Surface
47
+ >>> S = Surface([[1,2,3],[4,5,6]])
48
+ >>> result = S.dijkstra((0,0),[(1,1)]) # Perform a search from the point (0,0) to the point (1,1).
49
+ result = S.dijkstra((1,2),[(1,0),(0,2)]) # Perform a search from the point (0,0) to the points (1,0) and (0,2).
50
+ result = S.dijkstra((0,0),[(1,2)], max_distance=3) # perform a search from the point (0,0) to the point (1,2), but halt early if the length of any shortest path is greater than 3.
51
+ ```
52
+ The return value of `Surface.dijkstra()` is a list of tuples, with one tuple per specified end point. Each tuple is a `(distance, trace)` pair. `distance` is a float representing the calculated minimum distance between the start point and an end point. `trace` is a NumPy array containing a sequence of coordinates of the points on the shortest path between the start point and the end point.
53
+
54
+ After running a search algorithm, the `Surface.distances` and `Surface.parents` arrays will be active, exposing results obtained for other points in the search space to the programmer. WARNING: points further away from the start point than all specified end points may not report the best-case shortest path.
55
+
56
+ In addition to this, the methods `Surface.traceback_cost()` and `Surface.traceback_path()` are used to produce output identical to the tuples returned by `Surface.dijkstra()` for any point. These methods take a single point (represented by a tuple) as input and are recommended over accessing `Surface.distances` and `Surface.parents` as they are more memory efficient. These methods will raise exceptions if used before running a search algorithm.
57
+
58
+ Finally the A* algorithm, equipped with Euclidean Distance as a heuristic, can be used as an alternative search algorithm using `Surface.astar()`. This method has identical input and output as `Surface.dijkstra()`, except for the following caveats:
59
+ * The positional argument `max_distance` cannot be used.
60
+ * The A* algorithm requires additional initialisation. This can be done by calling `Surface.astar_init()` before executing a search algorithm or by including the optional positional argument `astar_init=True` when first creating a `Surface` object.
61
+
62
+ #### Notes about the Python Interface
63
+ For ease-of-programming, Dijkstra's or the A* algorithms can sometimes be sequentially executed without significant re-computation. This happens only if the start point and underlying algorithm is the same.
64
+
65
+ When executing A* with several end points, extra computational overhead is required to ensure the heuristics remain accurate. For this reason, Dijkstra's Algorithm is usually preferred for multi-destination searches.
66
+
67
+ The `Surface_from_file()` function exists, and can be used to directly create and initialise a `Surface object` from a file. It accepts a filename, width and height as parameters and returns a `Surface object`. This function is not completely tested, and may cause crashes or memory issues. Currently, the only file format supported is a binary dump of consecutive 64-bit floating point numbers.
68
+
69
+ ## CLI interface
70
+ In addition to the Python interface, a minimal CLI interface is also provided, and can be built without any dependencies. It has a wide range of compile-time options, which can be tuned for the desired use case. Details of these options and usage instructions can be found in `src/cli.c`.
71
+
72
+ ## Building
73
+ The aforementioned tools can be built and/or installed on Linux using the makefile. Available targets are as follows:
74
+ * `make all`: build and install the Python interface. The `SimpleMSSP` module can then be freely imported into a Python project
75
+ * `make python`: build and install the Python interface. The `SimpleMSSP` module can then be freely imported into a Python project
76
+ * `make CLI`: build the CLI interface.
77
+ * `make clean`: remove any temporary files created by another build target.
78
+ ### No make? No problem!
79
+ If the makefile isn't working for you, the Python interface can be built and installed using the command line. To build the Python interface, run the following:
80
+ ```
81
+ python3 -m build
82
+ ```
83
+ Next, the interface can be installed with the following command, where `<module-wheel>` is the filename of the `.whl` file which has appeared in the `dist` directory.
84
+ ```
85
+ python3 -m pip install install dist/<module-wheel> --force-reinstall
86
+ ```
87
+ For example, on `x86_64` Linux and Python 3.11, the compiled wheel is called `simplemssp-1.0-cp311-cp311-linux_x86_64.whl`.
88
+
89
+ ## Contact
90
+ The author of this module, Max Croucher, is contactable at [mpccroucher@gmail.com](mailto:mpccroucher@gmail.com)
91
+
92
+ ## License
93
+ This file is part of Simple MSSP.
94
+
95
+ Simple MSSP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
96
+
97
+ Simple MSSP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
98
+
99
+ You should have received a copy of the GNU General Public License along with Foobar. If not, see <https://www.gnu.org/licenses/>.
@@ -0,0 +1,11 @@
1
+ SimpleMSSP.cp311-win_amd64.pyd,sha256=fZap14loKOERO9uxBEWaRLbNiXPxlszdGH_Rvw5RRFQ,29184
2
+ simplemssp-1.0.dist-info/licenses/COPYING,sha256=ov5ku3NDGpytFOhWD4d2_fLASoWWy4SyB_uUCQpe-vg,35806
3
+ src/heap.c,sha256=uq_lB1ksBubd1rfM83y5FMqkYOc2bfjAVKDYUq89KxA,2523
4
+ src/heap.h,sha256=gxnivVsPC3TLClSoaMhAH6VqfzM9Mdyxz9ziZALjHdw,5830
5
+ src/pathfinding.c,sha256=LnNBF3K5Ws6cGM51TrqnoVpVSaYH4bcCfmF_twAT4qE,36447
6
+ src/sssplib.c,sha256=sAEb0-xNuy8xuYzD4NYrnlCEQd7R3jIT5LD_gGrXnEs,19768
7
+ src/sssplib.h,sha256=41MJAy7c09jqCCmahpAAautXH_ctn_qi0bZWl3RpTIc,7072
8
+ simplemssp-1.0.dist-info/METADATA,sha256=uFMXttF_LvAOropJIRvSlY7VatJG7G6Q_yGQAPQsRfE,8798
9
+ simplemssp-1.0.dist-info/WHEEL,sha256=Gp86XeEC8ZvwAF0N5UXenlzFa5hMKrX8iP-Ck-9cwsI,101
10
+ simplemssp-1.0.dist-info/top_level.txt,sha256=9baE7IHcS5xyDyv7bHAICxsY3WQmi68_sSsT4nprVKw,15
11
+ simplemssp-1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-cp311-win_amd64
5
+