buildA: Build a Link-path Incidence Matrix

View source: R/buildA.r

buildAR Documentation

Build a Link-path Incidence Matrix

Description

This function builds a link-path incidence matrix, in which feasible routes are determined using stochastic network loading based on user-specified link costs. The routes are based on a probit model, implemented via simulation.

Usage

buildA(Links, Costs, theta = 0, nsim = 100, orig = NA, dest = NA, loops = F)

Arguments

Links

For a network with N nodes, Links is an NxN matrix. The i,j entry of Links is the link number (ID) for the node connecting node i to node j. Entries should be set to NA if there is no link between the node pair in question.

Costs

A 2-column matrix, the first column of which is the link number (ID) and the second the link travel cost. Costs should be strictly positive.

theta

Standard deviation of link costs when apply probit-based stochastic network loading to identify routes. Can be vector of length equal to the number of links, or a scalar (which is then replicated if necessary). Default value is theta=0, so that only shortest paths between OD pairs are generated.

nsim

Number of simulation runs to find routes. In each run, link costs are modified by adding normal error, and the shortest paths computed with respect to these modified costs. nsim defaults to 100.

orig

Set of nodes specified as possible origins of travel. Defaults to all nodes for which there is at least one feasible route to another node.

dest

Set of nodes specified as possible destinations of travel. Defaults to all nodes that are reachable from elsewere by a feasible path.

loops

Include paths with loops? Defaults to FALSE.

Value

A list containing the link-path incidence matrix A, a vector O specifying the origin for each path, and a vector D specifying the destination for each path.

Examples

Links <- matrix(0,nrow=9, ncol=9)
Links[1,7] <- 1
Links[2,7] <- 2
Links[1,5] <- 3
Links[7,8] <- 4
Links[2,6] <- 5
Links[5,8] <- 6
Links[8,5] <- 7
Links[8,6] <- 8
Links[6,8] <- 9
Links[5,3] <- 10
Links[8,9] <- 11
Links[6,4] <- 12
Links[9,3] <- 13
Links[9,4] <- 14
Costs <- cbind(1:14,rep(1,14))
buildA(Links,Costs)
buildA(links,Costs,theta=0.4,orig=c(1,2),dest=c(3,4))

MartinLHazelton/transportation documentation built on Aug. 5, 2023, 10:28 a.m.