Class: EuclideanTSP

EuclideanTSP(data)

Class representing Euclidean TSP.

Constructor

new EuclideanTSP(data)

Constructor, construct the class from the data file selected.
Parameters:
Name Type Description
data string instance of a problem coded as string
Source:

Methods

(static) isInvalidInstance(instanceContent) → {boolean}

Returns instance invalidity
Parameters:
Name Type Description
instanceContent string content of file with instance
Source:
Returns:
is instance invalid
Type
boolean

(static) resolveInstanceParams(instanceContent) → {Object}

Resolves number od cities range of x and y coordinates.
Parameters:
Name Type Description
instanceContent string content of file with instance
Source:
Returns:
object with instance params
Type
Object

countEuclideanDistance(coord1, coord2) → {number}

Counts Euclidean distance between 2 points
Parameters:
Name Type Description
coord1 coordinates of first point with x and y field
coord2 coordinates of second point with x and y field
Source:
Returns:
Euclidean distance between given points
Type
number

evaluateMaximizationCost(permutationConfig) → {int}

Returns fitness of selected configuration (Permutation)
Parameters:
Name Type Description
permutationConfig class Permutation of which fitness we want
Source:
Returns:
calculated fitness of the configuration
Type
int

getConfiguration(random) → {Permutation}

Returns random, or sorted starting from 0, configuration of traveling salesman problem(Permutation configuration)
Parameters:
Name Type Description
random bool random or sorted staring with 0
Source:
Returns:
new Permutation class
Type
Permutation

getResult(permutationConfig) → {String}

Gets permutation array from configuration.
Parameters:
Name Type Description
permutationConfig class permutation of which path we want to get
Source:
Returns:
path
Type
String

getType() → {string}

Returns problem type.
Source:
Returns:
permutation
Type
string

transformMaximizationToRealCost(maxCost) → {number}

Transforms maximization cost to real cost of problem.
Parameters:
Name Type Description
maxCost number maximization cost to transform.
Source:
Returns:
Negative value of maxCost.
Type
number