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) |
Methods
changeOn(index) → {class}
Change the value on specific index(bit flip)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | which index to change |
Returns:
return the class
- Type
- class
copy() → {class}
Return copy of the class
Returns:
copy of the class
- Type
- class
equals(other) → {bool}
Typical equals function, compares two BitArrays
Parameters:
Name | Type | Description |
---|---|---|
other |
class | other BitArray |
Returns:
equals or not
- Type
- bool
getArray() → {array}
Returns the bit array, meaning the actual array not class
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 |
Returns:
return copy of the class with the value on index changed
- Type
- class
getSize() → {int}
Return size of the BitArray
Returns:
size of the array
- Type
- int
getType() → {string}
Returns the type of the configuration, needed for specific method functions(like mutation for example)
Returns:
[description]
- Type
- string
randomPermutation(size) → {array}
Returns random permutation array of specific size
Parameters:
Name | Type | Description |
---|---|---|
size |
int | size of the permutation |
Returns:
the generated permutation as array
- Type
- array
toString() → {string}
Return the bitArray as string
Returns:
bitArray as string
- Type
- string