Skip to contents

Computes the shortest round-trip distance in km starting and ending at the origin, visiting each destination exactly once, via brute-force enumeration of all permutations. Distances are computed via OR.Google.distance().

Usage

OR.Google.TSP(origin, destinations, key, echo = FALSE)

Arguments

origin

String starting and ending address.

destinations

String vector of addresses to visit.

key

String Google API key.

echo

Boolean indicating whether to print progress and summary to console. Default = FALSE.

Value

Numeric scalar shortest round-trip distance in km.

See also

Other GoogleMapsPlatform: OR.Google.address(), OR.Google.distance()