Skip to contents

This function is the C++ implementation of run_model, it will run a singly constrained model there must be a match in the dimensions, when running a production constrained model, any(dim(distance) == length(flows)) must be TRUE if no values for weight are provided, a vector with ones is used

Usage

run_model_single(flows, distance, weight = NULL, beta = 0.25)

Arguments

flows

A vector of either origin (production constrained) or destination (attraction constrained) flows.

distance

a distance matrix between origins and destinations, provide distance in km.

weight

a vector of weights for the unconstrained part of the model.

beta

Exponent to use when calculating the cost function, default .25.

Value

A list containing a matrix with predicted values.

Examples


data(flows_test)
data(distance_test)

flows_test <- apply(flows_test,MARGIN = 1,FUN = sum)

model_test <- run_model_single(flows_test,distance_test)