mdmtspv_ga2: Runs the MTSP solver

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Runs the MTSP solver

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
mdmtspv_ga2(
  xy,
  dmat,
  nSalesmen,
  CostType,
  popSize,
  numIter,
  Epsilon = 1e-10,
  return_all = FALSE
)

Arguments

xy

A n by 2 matrix of coordinate positions. Each row has the x and y position of the n sites to be visited.

dmat

A n by n matrix with the distances between the positions xy.

nSalesmen

An integer giving the number of salespersons (must be >= 2).

CostType

Possible values are the integers 1 or 2; 1 minimises the total distance travelled and 2 minimises the maximum distance travelled across the salepersons.

popSize

The population size / search space of the GA (should be divisible by 8 but this is corrected within program).

numIter

is the number of desired iterations for the algorithm to run after a new best solution is found.

Epsilon

A double giving a multiplier on blancing the costs beteen total distance and minmax (only used for costType 2).

return_all

Logical on whether ro return full ouput. Defaults to FALSE.

Value

Returns the solution to the MTSP. Depending on return_all may return the inputs and best_tour: a matrix where each row gives the sites visited by each salesperson, minDist: is the best cost found by the algorithm, and generation: is the number of generations required by the algorithm to find the solution.

Examples

1
2
3
4
5
6
set.seed(1)
n = 25
nSalesmen = 5
xy = matrix(rnorm(n*2), ncol=2)
dmat = as.matrix(dist(xy))
mdmtspv_ga2(xy, dmat, nSalesmen, 1, 80, 10)

daffp/mtsp documentation built on Sept. 23, 2020, 2:39 p.m.