Learn R Programming

CEGO (version 2.0.0)

distanceMatrixUpdate: Update distance matrix

Description

Update an existing distance matrix D_mat by adding distances of all previous candidate solutions to one new candidate solution, d_vec= d(x_i,x_new).

Usage

distanceMatrixUpdate(distanceMat, x, distanceFunction)

Arguments

distanceMat
original distance matrix D_mat
x
list of candidate solutions, last in list is the new solution
distanceFunction
Distance function of type f(x,y)=r, where r is a scalar and x and y are candidate solutions whose distance is evaluated.

Value

matrix of distances between all solutions x

Examples

Run this code
x <- list(5:1,c(2,4,5,1,3),c(5,4,3,1,2))
dm <- distanceMatrix(x,distancePermutationHamming)
x <- append(x,list(1:5))
dmUp <- distanceMatrixUpdate(dm,x,distancePermutationHamming)

Run the code above in your browser using DataLab