HiPOP 2.0.0__tar.gz → 4.0.0__tar.gz
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.
- {hipop-2.0.0 → hipop-4.0.0}/.clang-tidy +7 -0
- {hipop-2.0.0 → hipop-4.0.0}/.github/workflows/ci.yaml +1 -1
- {hipop-2.0.0 → hipop-4.0.0}/.github/workflows/deploy.yaml +2 -2
- {hipop-2.0.0 → hipop-4.0.0}/PKG-INFO +1 -1
- hipop-4.0.0/VERSION.txt +1 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/examples/ParallelKShortestPath.cpp +11 -16
- hipop-4.0.0/cpp/include/hipop/create.h +62 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/include/hipop/graph.h +313 -141
- hipop-4.0.0/cpp/include/hipop/graph_path.h +452 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/include/hipop/graph_path_cost.h +10 -17
- hipop-4.0.0/cpp/include/hipop/iterator_util.h +134 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/include/hipop/shortest_path.h +70 -45
- hipop-4.0.0/cpp/src/graph.cpp +433 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/src/graph_path_cost.cpp +5 -6
- {hipop-2.0.0 → hipop-4.0.0}/cpp/src/shortest_path.cpp +295 -315
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/CMakeLists.txt +2 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/helpers.h +40 -27
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/sample_graphs.h +35 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testAStar.cpp +20 -18
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testDijkstra.cpp +60 -35
- hipop-4.0.0/cpp/tests/testDijkstraSingleSource.cpp +248 -0
- hipop-4.0.0/cpp/tests/testGraph.cpp +833 -0
- hipop-4.0.0/cpp/tests/testGraphPath.cpp +577 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testKShortestPath.cpp +4 -3
- hipop-4.0.0/cpp/tests/testProjectionRange.cpp +271 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testYenKShortestPath.cpp +4 -3
- {hipop-2.0.0 → hipop-4.0.0}/pyproject.toml +1 -1
- {hipop-2.0.0 → hipop-4.0.0}/python/examples/UpdateCosts.py +1 -1
- hipop-4.0.0/python/hipop/cpp/graph.cpp +484 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/hipop/cpp/shortest_path.cpp +16 -3
- {hipop-2.0.0 → hipop-4.0.0}/python/hipop/graph.py +8 -2
- hipop-4.0.0/python/tests/test_Graph.py +537 -0
- hipop-4.0.0/python/tests/test_GraphPath.py +222 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/tests/test_ShortestPath.py +39 -24
- hipop-2.0.0/VERSION.txt +0 -1
- hipop-2.0.0/cpp/include/hipop/create.h +0 -8
- hipop-2.0.0/cpp/src/graph.cpp +0 -216
- hipop-2.0.0/cpp/tests/testDijkstraSingleSource.cpp +0 -173
- hipop-2.0.0/cpp/tests/testGraph.cpp +0 -612
- hipop-2.0.0/python/hipop/cpp/graph.cpp +0 -281
- hipop-2.0.0/python/tests/test_Graph.py +0 -366
- {hipop-2.0.0 → hipop-4.0.0}/.gitattributes +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/.gitignore +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/.pre-commit-config.yaml +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/CMakeLists.txt +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/CONTRIBUTING.md +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/DEVELOPMENT.md +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/LICENSE +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/README.md +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cmake/ClangTidySettings.cmake +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cmake/IPOSettings.cmake +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cmake/MainSettings.cmake +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/conda/env.yaml +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/CMakeLists.txt +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/cmake/HipopConfig.cmake.in +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/examples/.clang-tidy +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/examples/CMakeLists.txt +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/include/hipop/string_util.h +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/src/create.cpp +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/.clang-tidy +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testGraphMerge.cpp +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testManhattan.cpp +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testStringUtil.cpp +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/cpp/tests/testparallelKShortestPath.cpp +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/pyrefly.toml +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/pytest.toml +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/CMakeLists.txt +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/examples/ksp.py +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/examples/merge.py +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/examples/render.py +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/examples/test.py +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/hipop/__init__.py.template +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/hipop/cpp/main.cpp +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/hipop/py.typed +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/hipop/render.py +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/hipop/shortest_path.py +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/python/tests/test_VersionConsistency.py +0 -0
- {hipop-2.0.0 → hipop-4.0.0}/ruff.toml +0 -0
|
@@ -7,6 +7,7 @@ Checks: # See https://clang.llvm.org/extra/clang-tidy/checks/list.html
|
|
|
7
7
|
|
|
8
8
|
- cppcoreguidelines-*
|
|
9
9
|
- misc-include-cleaner # The other misc-* are worth enabling, but that would mean significant code refactoring.
|
|
10
|
+
- misc-non-private-member-variables-in-classes
|
|
10
11
|
- modernize-*
|
|
11
12
|
- performance-*
|
|
12
13
|
|
|
@@ -49,3 +50,9 @@ CheckOptions:
|
|
|
49
50
|
# The nanobind STL headers provide the C++ <-> Python type casters through template specializations:
|
|
50
51
|
# no symbol from them is referenced directly, but they must be included where the conversions happen.
|
|
51
52
|
misc-include-cleaner.IgnoreHeaders: 'nanobind/stl/.*'
|
|
53
|
+
|
|
54
|
+
# Classes whose fields are ALL public are accepted as plain data structures (to avoid writing
|
|
55
|
+
# trivial getters). Still, this exception to the general rule should be reserved for simple small classes,
|
|
56
|
+
# with no abstraction, and no non-trivial logic implemented in the class.
|
|
57
|
+
# Complex classes MUST keep their fields private (although this check will miss them if they are all public).
|
|
58
|
+
misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: true
|
|
@@ -41,7 +41,7 @@ jobs:
|
|
|
41
41
|
os: # See https://docs.github.com/en/actions/reference/runners/github-hosted-runners
|
|
42
42
|
- ubuntu-latest # Arch: x64
|
|
43
43
|
- ubuntu-24.04-arm # Arch: arm64
|
|
44
|
-
- windows-
|
|
44
|
+
- windows-2022 # Arch: x64 FIXME Rollback to windows-latest once the fix for https://github.com/actions/runner-images/issues/15368 is available.
|
|
45
45
|
- macos-latest # Arch: arm64
|
|
46
46
|
python-version:
|
|
47
47
|
- '3.10' # Oldest supported version (must be kept consistent with the classifiers in `pyproject.toml`).
|
|
@@ -36,8 +36,8 @@ jobs:
|
|
|
36
36
|
os: # See https://docs.github.com/en/actions/reference/runners/github-hosted-runners
|
|
37
37
|
- ubuntu-latest # Arch: x64
|
|
38
38
|
- ubuntu-24.04-arm # Arch: arm64
|
|
39
|
-
- windows-
|
|
40
|
-
- macos-
|
|
39
|
+
- windows-2022 # Arch: x64 FIXME Rollback to windows-latest once the fix for https://github.com/actions/runner-images/issues/15368 is available.
|
|
40
|
+
- macos-15 # Arch: arm64
|
|
41
41
|
# Do not use the latest macOS runner to ensure backward compatibility.
|
|
42
42
|
# See comment on MACOSX_DEPLOYMENT_TARGET in pyproject.toml for more details.
|
|
43
43
|
|
hipop-4.0.0/VERSION.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.0
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include <cstdlib>
|
|
5
5
|
#include <iostream>
|
|
6
6
|
#include <limits>
|
|
7
|
+
#include <optional>
|
|
7
8
|
#include <string>
|
|
8
9
|
#include <unordered_map>
|
|
9
10
|
#include <vector>
|
|
@@ -41,15 +42,12 @@ int main()
|
|
|
41
42
|
|
|
42
43
|
//auto paths = hipop::parallelKShortestPath(G, origins, destinations, "time", vecMapLabelCosts, {}, 0.1, 0.95, 10, 10, kPaths, 4);
|
|
43
44
|
auto paths = hipop::parallelDijkstra(G, origins, destinations, vecMapLabelCosts, "time", 1, {});
|
|
45
|
+
const std::optional<hipop::PathCost> &path = paths[0];
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
std::cout << "Cost: " << paths[0].second << std::endl;
|
|
51
|
-
|
|
52
|
-
std::cout << "Path size: " << paths[0].first.size()<< std::endl;
|
|
47
|
+
if (path.has_value()) {
|
|
48
|
+
std::cout << "Cost: " << path->second << std::endl;
|
|
49
|
+
std::cout << "Path size (i.e. number of links): " << path->first.size() << std::endl;
|
|
50
|
+
std::cout << "Path: " << path->first << std::endl;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
// Update costs
|
|
@@ -58,15 +56,12 @@ int main()
|
|
|
58
56
|
G.UpdateCosts( maplinkcosts );
|
|
59
57
|
|
|
60
58
|
auto paths2 = hipop::parallelDijkstra(G, origins, destinations, vecMapLabelCosts, "time", 1, {});
|
|
59
|
+
const std::optional<hipop::PathCost> &path2 = paths2[0];
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
std::cout << "Cost: " << paths2[0].second << std::endl;
|
|
68
|
-
|
|
69
|
-
std::cout << "Path size: " << paths2[0].first.size()<< std::endl;
|
|
61
|
+
if (path2.has_value()) {
|
|
62
|
+
std::cout << "Cost: " << path2->second << std::endl;
|
|
63
|
+
std::cout << "Path size (i.e. number of links): " << path2->first.size() << std::endl;
|
|
64
|
+
std::cout << "Path: " << path2->first << std::endl;
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
return EXIT_SUCCESS;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <hipop/graph.h>
|
|
4
|
+
#include <hipop/graph_path.h>
|
|
5
|
+
#include <hipop/string_util.h>
|
|
6
|
+
|
|
7
|
+
#include <stdexcept>
|
|
8
|
+
#include <string>
|
|
9
|
+
#include <utility>
|
|
10
|
+
#include <vector>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
namespace hipop {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
OrientedGraph makeManhattan(int n, double linkLength);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate an empty path (i.e. a path with no link) relating the node corresponding to originNodeId
|
|
21
|
+
* to itself in the given graph.
|
|
22
|
+
*
|
|
23
|
+
* @throws std::invalid_argument if the given node ID does not exist in the graph.
|
|
24
|
+
*/
|
|
25
|
+
inline OrientedGraphPath makeEmptyPath(const OrientedGraph &graph, const std::string &originNodeId) {
|
|
26
|
+
const Node *originNode = graph.findNode(originNodeId);
|
|
27
|
+
if (originNode == nullptr) {
|
|
28
|
+
throw std::invalid_argument(StrCat("[makeEmptyPath] Unknown node ID [", originNodeId, "]."));
|
|
29
|
+
}
|
|
30
|
+
return OrientedGraphPath(originNode);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generate a path made of the links corresponding to the given link IDs in the given graph.
|
|
36
|
+
*
|
|
37
|
+
* @param linkIds Must not be empty.
|
|
38
|
+
* @throws std::invalid_argument if linkIds is empty, if any link ID does not exist in the graph,
|
|
39
|
+
* or if the sequence of links has inconsistent up/down nodes.
|
|
40
|
+
*/
|
|
41
|
+
inline OrientedGraphPath makePath(const OrientedGraph &graph, const std::vector<std::string> &linkIds) {
|
|
42
|
+
|
|
43
|
+
if (linkIds.empty()) {
|
|
44
|
+
throw std::invalid_argument("[makePath] Link list cannot be empty.");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
std::vector<const Link *> links;
|
|
48
|
+
links.reserve(linkIds.size());
|
|
49
|
+
for (const std::string &linkId : linkIds) {
|
|
50
|
+
const Link *link = graph.findLink(linkId);
|
|
51
|
+
if (link == nullptr) {
|
|
52
|
+
throw std::invalid_argument(StrCat("[makePath] Unknown link ID [", linkId, "]."));
|
|
53
|
+
}
|
|
54
|
+
links.emplace_back(link);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const Node *origin = links[0]->up();
|
|
58
|
+
return { origin, std::move(links) };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
} // namespace hipop
|