This function expects as primary parameters the desired instance size \(n\), a number of iteration iters to perform and a collection of mutation operators collection. The generation process is sequential:

  • Place \(n\) points uniformly at random in \([0,1]^2\). We shall denote this set as \(P\) in the following..

  • For the desired number of iterations iters repeat the following process: select a mutation operator \(m\) from the collection at random (according to the probability distribution stored in collection and set \(P = m(P)\).

build(n, iters = 10L, collection, return.all = FALSE, upper = 1,
  bound.handling = "uniform")

Arguments

n

[integer(1)]
Desired instance size, i.e., the number of nodes.

iters

[integer(1)]
Number of iterations to perform. Default is 10.

collection

[tspgen_collection]
Collection of mutation operators.

return.all

[logical(1)]
Shall all interim instances be stored and returned? Default is FALSE.

upper

[numeric(1)]
Instance generation takes place in \([0,1]^2\). Use upper to upscale the boundaries, i.e., place nodes in \([0, upper]^2\). Default is 1.

bound.handling

[character(1)]
Occasionally during instance generation points are moved outside the boundaries of the point space. The parameter bound.handling determines how to deal with these points. Option “uniform” places outliers uniform at random within . the boundaries while option “boundary” places them on the corresponding violates boundary/boundaries. Default is “uniform”.

Value

Either a netgen Network if return.all = FALSE, otherwise a list of netgen networks of length iters + 1.

Note

If setProbabilities was not called on the collection the algorithm falls back to the uniform distribution, i.e., each mutation operator is selected with equal probability for application in each iteration.

Examples

# set up a set of mutation operators collection = init() collection = addMutator(collection, "doUniformMutation", pm = 0.3) collection = addMutator(collection, "doExplosionMutation", min.eps = 0.2, max.eps = 0.4) collection = addMutator(collection, "doImplosionMutation", min.eps = 0.2, max.eps = 0.4) collection = addMutator(collection, "doAxisProjectionMutation") # specify probability distribution. collection = setProbabilities(collection, probs = c(0.1, 0.6, 0.2, 0.1)) x = build(n = 50, iters = 10, collection = collection) x = build(n = 100, iters = 50, collection = collection, return.all = TRUE, bound.handling = "boundary")