Class: Permutation

Permutation(options)

class representing permutation configuration, used for all problems with permutation configurations

Constructor

new Permutation(options)

Class constructor, can create from other Permutations, random with specified size, or sorted starting with 0
Parameters:
Name Type Description
options object contains options.fromBitArray(bool), options.size(int) and options.random(bool)
Source:

Methods

changeOn(index) → {class}

Change the value on specific index(bit flip)
Parameters:
Name Type Description
index int which index to change
Source:
Returns:
return the class
Type
class

copy() → {class}

Return copy of the class
Source:
Returns:
copy of the class
Type
class

equals(other) → {bool}

Typical equals function, compares two BitArrays
Parameters:
Name Type Description
other class other BitArray
Source:
Returns:
equals or not
Type
bool

getArray() → {array}

Returns the bit array, meaning the actual array not class
Source:
Returns:
bitArray variable
Type
array

getNeighbour(index) → {class}

Return neighbour, either random or selected with two indexes to swap
Parameters:
Name Type Description
index int which index will change to get the neighbour
Source:
Returns:
return copy of the class with the value on index changed
Type
class

getSize() → {int}

Return size of the BitArray
Source:
Returns:
size of the array
Type
int

getType() → {string}

Returns the type of the configuration, needed for specific method functions(like mutation for example)
Source:
Returns:
[description]
Type
string

randomPermutation(size) → {array}

Returns random permutation array of specific size
Parameters:
Name Type Description
size int size of the permutation
Source:
Returns:
the generated permutation as array
Type
array

toString() → {string}

Return the bitArray as string
Source:
Returns:
bitArray as string
Type
string