Class TSPTWProblem
The default TSP-TW profile definition.
Inheritance
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public sealed class TSPTWProblem
Constructors
TSPTWProblem(Int32, Int32, Single[][], TimeWindow[], Single)
Creates a new TSP-TW, 'closed' when first equals last.
Declaration
public TSPTWProblem(int first, int last, float[][] weights, TimeWindow[] windows, float turnPenaltyInSeconds)
Parameters
|
System.Int32
first
|
|
System.Int32
last
|
|
System.Single[][]
weights
|
|
TimeWindow[]
windows
|
|
System.Single
turnPenaltyInSeconds
|
TSPTWProblem(Int32, Single[][], TimeWindow[], Single)
Creates a new 'open' TSP-TW with only a start customer.
Declaration
public TSPTWProblem(int first, float[][] times, TimeWindow[] windows, float turnPenaltyInSeconds)
Parameters
|
System.Int32
first
|
|
System.Single[][]
times
|
|
TimeWindow[]
windows
|
|
System.Single
turnPenaltyInSeconds
|
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>
|
Times
Gets the weights.
Declaration
public float[][] Times { get; set; }
Property Value
|
System.Single[][]
|
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[]
|
Windows
Gets the windows.
Declaration
public TimeWindow[] Windows { get; set; }
Property Value
|
TimeWindow[]
|
Methods
Clone()
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 problim using a default solver.
Declaration
public Tour Solve()
Returns
|
Tour
|
Solve(ISolver<Single, TSPTWProblem, TSPTWObjective, Tour, Single>)
Solvers this problem using the given solver.
Declaration
public Tour Solve(ISolver<float, TSPTWProblem, TSPTWObjective, Tour, float> solver)
Parameters
|
ISolver<System.Single, TSPTWProblem, TSPTWObjective, Tour, System.Single>
solver
|
Returns
|
Tour
|
TimeAndViolations(IEnumerable<Int32>, out Single, out Single, out Single, ref Boolean[])
Calculates total time and violations if the given id was moved after 'before'. Assumes the tour is closed.
Declaration
public int TimeAndViolations(IEnumerable<int> tour, out float time, out float waitTime, out float violatedTime, ref bool[] validFlags)
Parameters
|
IEnumerable<System.Int32>
tour
|
|
System.Single
time
|
|
System.Single
waitTime
|
|
System.Single
violatedTime
|
|
System.Boolean[]
validFlags
|
Returns
|
System.Int32
|
TimeAndViolations(Tour, out Single, out Single, out Single, ref Boolean[])
Calculates total time and all violations.
Declaration
public int TimeAndViolations(Tour tour, out float time, out float waitTime, out float violatedTime, ref bool[] validFlags)
Parameters
|
Tour
tour
The tour to calculate for. |
|
System.Single
time
The total travel time without waittime. |
|
System.Single
waitTime
The total waiting time. |
|
System.Single
violatedTime
The total time of violations. |
|
System.Boolean[]
validFlags
Flags for each customer, a customer window is violated when false. |
Returns
|
System.Int32
The number of invalid customers. |
TimeAndViolationsForPart(IEnumerable<Int32>, Single, out Single, out Single, out Single, ref Boolean[])
Calculates the weight for a part of the tour including the turns at first and last position.
Declaration
public int TimeAndViolationsForPart(IEnumerable<int> part, float timeBefore, out float time, out float waitTime, out float violatedTime, ref bool[] validFlags)
Parameters
|
IEnumerable<System.Int32>
part
The part to calculate for. |
|
System.Single
timeBefore
The time when arriving at the first customer, excluding the turn at that first customer. |
|
System.Single
time
|
|
System.Single
waitTime
|
|
System.Single
violatedTime
|
|
System.Boolean[]
validFlags
|
Returns
|
System.Int32
|