Description Usage Arguments Details Value Author(s) See Also
An objective function provides a measure of least cost used in evaluating equilibrium conditions during highway assignment. This help section describes strategies for building objective functions.
1 2 | build.general.objective.function(aset, ff.vol, ff.cost, tol = 1e-04, max.depth = 14)
cost.integrator(cost.function,ff.vol,ff.cost,cong.vol,cong.cost,tol=1e-8,max.depth=14)
|
aset |
An |
ff.vol |
Free flow (or lower bound) volumes (vector or matrix depending on type of cost function) |
ff.cost |
Link costs corresponding to free-flow (or lower bound) volumes |
tol |
Convergence tolerance for cost function integration using adaptive quadrature |
max.depth |
Maximum allowed recursion level during cost integration (a maximum of |
cost.function |
The cost function (volume/delay) that relates link volume to link cost |
cong.vol |
Congested (or upper bound) volumes |
cong.cost |
Link costs corresponding to congested (or upper bound) volumes) |
Objective functions are called from within the assignment algorithms (highway.assign
like this:
1 | objective.function(volume)
|
Parameter:
volume
volumes for which the objective function is to be computed; see below
The objective function returns a numeric scalar value that is used to assess equilibrium (which is presumed to be reached when the objective function has been minimized).
It is important to note that the objective function is not directly minimized by any of the equilibrium assignment methods currently implemented in travelr: the actual search direction toward a “better” solution is built from a linear approximation based on the cost function. The objective function is used simply to evaluate the quality of the current solution. The ability to change that strategy at will is, of course, one of the beauties of open software. Anyone who has a deeper understanding of these issues is welcome to suggest or implement improvements to the travelr algorithms.
The helper function build.general.objective.function
will construct a usable objective.function
from an arbitrary cost.function
. The free-flow volumes and costs are ordinarily computed by
new.assignment.set
and are available as the ff.flow
and ff.cost
elements, respectively.
The resulting objective function uses cost.integrator
to perform numerical integration. The cost function is
integrated from free-flow to congested volumes. While the resulting objective function is reasonably accurate and will
work with almost any cost function, it will always be faster (and possibly much more accurate) to build an analytic
objective function (see the helper function build.BPR.objective.function
for an example of how to do that
for the common BPR functional form.
The cost.integrator
function is also available as a general-purpose R utility which will evaluate integrals for
functions taking a vector of parameters. In the case of a vector value, the function to be integrated is presumed to be
the summation of the cost.function evaluated for each of the vector values. This is considerably more flexible than the
standard integrate
function, but also a very much slower since the integration will be performed repeatedly
during the equilibrium line search. The cost.integrator
function uses adaptive quadrature and Simpson's rule for
approximating definite integrals.
It is possible to write objective functions that ignore certain assignment classes (for example, if loading a certain class always at free-flow conditions). It is nevertheless usually more efficient in those cases to construct multiple assignment sets and load the classes separately.
Helper functions are also available to construct cost (and objective) functions in the classic form known as the BPR formula (BPR stands for “Bureau of Public Roads”, a precursor of the Federal Highway Administration).
The objective.function
required by highway.assign
returns a numeric vector or data.frame of the same shape as volume
build.general.objective.function
returns a function that can be used as an objective function in equilibrium highway assighment
cost.integrator
returns a (scalar) numeric value that results from integrating the supplied function between lower and upper bounds
Jeremy Raw
assignment.set
for a description of how the objective function is supplied.
bpr.functions
for BPR helper functions.
highway.assign
for how objective functions are used.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.