You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,19 @@
1
+
cppRouting v4.0
2
+
===============
3
+
Major changes
4
+
5
+
- Customizable Contraction Hierarchies (CCH) support, via `cpp_contract(..., customizable = TRUE)` and `cpp_customize()`. CCH separates preprocessing (topology) from customization (edge weights), so a prepared topology can be reused across many weight updates (e.g. congestion assignment) without a full re-contraction.
6
+
-`get_distance_pair`, `get_distance_matrix`, `get_path_pair` and `get_aon` all support CCH graphs, in addition to normal and classically-contracted graphs.
7
+
-`makegraph()`'s `aux` argument now accepts a `data.frame` with one or more named columns, in addition to a single vector. `aggregate_aux` in `get_distance_pair`/`get_distance_matrix` accepts `TRUE` (all columns) or a character vector of column names, and is now supported on normal, contracted (CH) and CCH graphs, and on graphs simplified with `cpp_simplify`. Aggregation runs inline in C++ during the shortest-path search itself, no path reconstruction needed.
8
+
-`assign_traffic(..., aon_method = "cch", cch = cch)` uses a prepared CCH topology for repeated traffic assignment iterations, avoiding a full re-contraction at each run.
9
+
10
+
Minor changes
11
+
12
+
-`cpp_simplify()` result is now classed (`cppRouting_simplified`), fixing downstream functions that silently failed on a simplified graph.
13
+
-`cpp_simplify()` now correctly aggregates multiple auxiliary columns across merged edges (previously single-column only).
14
+
-`cpp_contract(..., customizable = TRUE)` shows progress, like classical contraction.
15
+
- Various CCH correctness and performance fixes: `get_path_pair` on CCH graphs, elimination ordering (near-linear instead of quadratic), many-to-many distance matrix on CCH graphs.
Copy file name to clipboardExpand all lines: R/assign_traffic.R
+48-31Lines changed: 48 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,8 @@
7
7
#' @param algorithm character. \code{msa}, \code{fw}, \code{cfw}, \code{bfw} or \code{dial}. Default to \code{bfw}. See details.
8
8
#' @param max_gap Numeric. Relative gap to achieve. Default to 0.001.
9
9
#' @param max_it Numeric. Maximum number of iterations. Default to \code{.Machine$integer.max}
10
-
#' @param aon_method Character.\code{d}, \code{bi}, \code{nba}, \code{cphast} or \code{cbi}. Default to \code{bi}. See details.
10
+
#' @param aon_method Character.\code{d}, \code{bi}, \code{nba}, \code{cphast}, \code{cbi} or \code{cch}. Default to \code{bi}. See details.
11
+
#' @param cch Optional CCH topology generated by \code{cpp_contract(Graph, customizable = TRUE)}. Use it with \code{aon_method = "cch"} to prepare the road topology once and reuse it across many congestion runs.
11
12
#' @param constant numeric. Constant to maintain the heuristic function admissible in NBA* algorithm. Default to 1, when cost is expressed in the same unit than coordinates. See details
12
13
#' @param dial_params List. Named list of hyperparameters for \code{dial} algorithm. See details.
13
14
#' @param verbose Logical. If \code{TRUE} (default), progression is displayed.
#' \item \code{cch} : customizable contraction hierarchies with RoutingKit-style elimination-tree grouped queries. The topology is prepared once, then edge costs are customized at each assignment iteration.
65
67
#' }
66
68
#' These AON algorithm can be decomposed into two families, depending the sparsity of origin-destination matrix : \itemize{
67
69
#' \item recursive pairwise : \code{bi}, \code{nba} and \code{cbi}. Optimal for high sparsity. One-to-one algorithm is called N times, with N being the length of from.
68
-
#' \item recursive one-to-many : \code{d}and \code{cphast}. Optimal for dense matrix. One-to-many algorithm is called N times, with N being the number of unique from (or to) nodes
70
+
#' \item recursive one-to-many : \code{d}, \code{cphast} and \code{cch}. Optimal for dense or repeated-endpoint matrices. One-to-many algorithm is called N times, with N being the number of unique from (or to) nodes.
69
71
#' }
70
72
#'
73
+
#' CCH is most useful when the same graph topology is reused with changing edge
74
+
#' costs, for example during congestion assignment. In that case, run
75
+
#' \code{cch <- cpp_contract(graph, customizable = TRUE)} once, save it if needed, and pass
76
+
#' \code{cch = cch} with \code{aon_method = "cch"}. The assignment will
77
+
#' then customize the CCH at each iteration instead of rebuilding a full
78
+
#' contraction hierarchy.
79
+
#'
71
80
#' For large instance, it may be appropriate to test different \code{aon_method} for few iterations and choose the fastest one for the final estimation.
72
81
#'
73
82
#' Hyperparameters for algorithm-b are : \itemize{
@@ -120,7 +129,7 @@
120
129
121
130
122
131
assign_traffic<-function(Graph, from, to, demand, algorithm="bfw", max_gap=0.001, max_it=.Machine$integer.max,
if (length(Graph) !=5) stop("Graph object must be generated by makegraph() function")
141
+
if (!inherits(Graph, "cppRouting_graph")) stop("Graph object must be generated by makegraph() function")
133
142
if (is.null(Graph$attrib$alpha) | is.null(Graph$attrib$beta)| is.null(Graph$attrib$cap)) stop("alpha, beta and capacity must be defined during graph construction")
0 commit comments