Class TSProblem
The default TSP profile definition.
Inheritance
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public sealed class TSProblem
Constructors
TSProblem(Int32, Int32, Single[][], Single)
Creates a new TSP, 'closed' when first equals last.
Declaration
public TSProblem(int first, int last, float[][] weights, float turnPenalty)
Parameters
|
System.Int32
first
|
|
System.Int32
last
|
|
System.Single[][]
weights
|
|
System.Single
turnPenalty
|
TSProblem(Int32, Single[][], Single)
Creates a new TSP 'open' TSP with only a start customer.
Declaration
public TSProblem(int first, float[][] weights, float turnPenalty)
Parameters
|
System.Int32
first
|
|
System.Single[][]
weights
|
|
System.Single
turnPenalty
|
Properties
First
Gets the first customer.
Declaration
public int First { get; set; }
Property Value
|
System.Int32
|
Last
Gets the last customer if the problem is closed.
Declaration
public int ? Last { get; set; }
Property Value
|
System.Nullable<System.Int32>
|
TurnPenalties
Gets or sets the turn penalties per type of turn. 0: forward, forward. 1: forward, backward. 2: backward, forward. 3: backward, backward.
Declaration
public float[] TurnPenalties { get; set; }
Property Value
|
System.Single[]
|
Weights
Gets the weights.
Declaration
public float[][] Weights { get; set; }
Property Value
|
System.Single[][]
|
Methods
CreateEmptyTour()
Creates an initial empty tour, add fixed first and/or last customer.
Declaration
public Tour CreateEmptyTour()
Returns
|
Tour
|
GetNearestNeighboursBackward(Single, Int32)
Generate the nearest neighbour list.
Declaration
public SortedNearestNeighbours GetNearestNeighboursBackward(float weight, int id)
Parameters
|
System.Single
weight
|
|
System.Int32
id
|
Returns
|
SortedNearestNeighbours
|
GetNearestNeighboursForward(Single, Int32)
Generate the nearest neighbour list.
Declaration
public SortedNearestNeighbours GetNearestNeighboursForward(float weight, int id)
Parameters
|
System.Single
weight
|
|
System.Int32
id
|
Returns
|
SortedNearestNeighbours
|
GetNNearestNeighboursBackward(Int32, Int32)
Generate the nearest neighbour list.
Declaration
public NearestNeighbours GetNNearestNeighboursBackward(int n, int id)
Parameters
|
System.Int32
n
|
|
System.Int32
id
|
Returns
|
NearestNeighbours
|
GetNNearestNeighboursForward(Int32, Int32)
Generate the nearest neighbour list.
Declaration
public NearestNeighbours GetNNearestNeighboursForward(int n, int id)
Parameters
|
System.Int32
n
|
|
System.Int32
id
|
Returns
|
NearestNeighbours
|
Solve()
Solves this TSP using a default solver.
Declaration
public Tour Solve()
Returns
|
Tour
|
Solve(ISolver<Single, TSProblem, TSPObjective, Tour, Single>)
Solvers this problem using the given solver.
Declaration
public Tour Solve(ISolver<float, TSProblem, TSPObjective, Tour, float> solver)
Parameters
|
ISolver<System.Single, TSProblem, TSPObjective, Tour, System.Single>
solver
|
Returns
|
Tour
|