Class Tour
a route or a sequence of customers.
Inheritance
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public sealed class Tour : ITour, IEnumerable<int>, ISolution
Constructors
Tour(IEnumerable<Int32>)
Creates a new closed route using a preexisting sequence.
Declaration
public Tour(IEnumerable<int> customers)
Parameters
|
IEnumerable<System.Int32>
customers
|
Tour(IEnumerable<Int32>, Nullable<Int32>)
Creates a new route using a preexisting sequence.
Declaration
public Tour(IEnumerable<int> customers, int ? last)
Parameters
|
IEnumerable<System.Int32>
customers
|
|
System.Nullable<System.Int32>
last
|
Properties
Count
Returns the size of the route.
Declaration
public int Count { get; }
Property Value
|
System.Int32
|
Implements
First
Returns the first customer in this route.
Declaration
public int First { get; }
Property Value
|
System.Int32
|
Implements
Last
Returns the last customer in this route.
Declaration
public int ? Last { get; }
Property Value
|
System.Nullable<System.Int32>
|
Implements
Methods
Between(Int32, Int32)
Returns an enumerable between.
Declaration
public IEnumerable<int> Between(int from, int to)
Parameters
|
System.Int32
from
|
|
System.Int32
to
|
Returns
|
IEnumerable<System.Int32>
|
Implements
Clear()
Clears out all the customers in this route.
Declaration
public void Clear()
Implements
Clone()
Creates an exact deep-copy of this route.
Declaration
public object Clone()
Returns
|
System.Object
|
Contains(Int32)
Returns true if the customer exists in this route.
Declaration
public bool Contains(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Boolean
|
Implements
Contains(Int32, Int32)
Returns true if there exists an edge from the given customer to another.
Declaration
public bool Contains(int from, int to)
Parameters
|
System.Int32
from
|
|
System.Int32
to
|
Returns
|
System.Boolean
|
Implements
CopyFrom(ISolution)
Copies the given solution into this solution.
Declaration
public void CopyFrom(ISolution solution)
Parameters
|
ISolution
solution
|
CutAndRemove(Int32, Int32)
Cuts out a part of the route and returns the customers contained.
Declaration
public int[] CutAndRemove(int start, int length)
Parameters
|
System.Int32
start
|
|
System.Int32
length
|
Returns
|
System.Int32[]
|
GetCustomerAt(Int32)
Gets the customer at the given index.
Declaration
public int GetCustomerAt(int index)
Parameters
|
System.Int32
index
The position of the customer in the route, the first being at O. |
Returns
|
System.Int32
|
Implements
Exceptions
|
System.ArgumentOutOfRangeException
When the index is out of range. |
GetEnumerator()
Returns the enumerator.
Declaration
public IEnumerator<int> GetEnumerator()
Returns
|
IEnumerator<System.Int32>
|
GetEnumerator(Int32)
Returns the enumerator.
Declaration
public IEnumerator<int> GetEnumerator(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
IEnumerator<System.Int32>
|
Implements
GetIndexOf(Int32)
Returns the index of the given customer.
Declaration
public int GetIndexOf(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Int32
|
Implements
GetNeigbour(Int32)
Returns the neigbour of the given customer.
Declaration
public int GetNeigbour(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Int32
|
Implements
InsertAfter(Int32, Int32)
Inserts a customer right after from and before to.
Declaration
public void InsertAfter(int from, int customer)
Parameters
|
System.Int32
from
|
|
System.Int32
customer
|
Implements
IsFirst(Int32)
Returns true if the given customer is the first one.
Declaration
public bool IsFirst(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Boolean
|
IsLast(Int32)
Returns true if the given customer is the last one.
Declaration
public bool IsLast(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Boolean
|
Next(Int32)
Returns the neigbour of the given customer.
Declaration
public int Next(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Int32
|
Pairs()
Returns an enumerable that enumerates all customer pairs that occur in the route as 1->2. If the route is a round the pair that contains last->first is also included.
Declaration
public IEnumerable<Pair> Pairs()
Returns
|
IEnumerable<Pair>
|
Implements
Remove(Int32)
Removes a customer from the route.
Declaration
public bool Remove(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Boolean
|
Implements
Remove(Int32, out Int32, out Int32)
Removes a customer from the route.
Declaration
public bool Remove(int customer, out int before, out int after)
Parameters
|
System.Int32
customer
The customer to remove. |
|
System.Int32
before
The customer that used to exist before. |
|
System.Int32
after
The customer that used to exist after. |
Returns
|
System.Boolean
|
Implements
Replace(Int32, Int32)
Replaces the given old customer with the new customer. Assumes the new customer doesn't exist yet.
Declaration
public void Replace(int oldCustomer, int newCustomer)
Parameters
|
System.Int32
oldCustomer
|
|
System.Int32
newCustomer
|
Implements
ReplaceEdgeFrom(Int32, Int32)
Inserts a customer right after from and before to.
Declaration
public void ReplaceEdgeFrom(int from, int customer)
Parameters
|
System.Int32
from
|
|
System.Int32
customer
|
Implements
ShiftAfter(Int32, Int32)
Shifts the given customer to a new location and places it after the given 'before' customer.
Declaration
public bool ShiftAfter(int customer, int before)
Parameters
|
System.Int32
customer
The customer to shift. |
|
System.Int32
before
The new customer that will come right before. |
Returns
|
System.Boolean
|
Implements
ShiftAfter(Int32, Int32, out Int32, out Int32, out Int32)
Shifts the given customer to a new location and places it after the given 'before' customer.
Declaration
public bool ShiftAfter(int customer, int before, out int oldBefore, out int oldAfter, out int newAfter)
Parameters
|
System.Int32
customer
The customer to shift. |
|
System.Int32
before
The new customer that will come right before. |
|
System.Int32
oldBefore
The customer that used to exist before. |
|
System.Int32
oldAfter
The customer that used to exist after. |
|
System.Int32
newAfter
The customer that new exists after. |
Returns
|
System.Boolean
|
Implements
ToString()
Returns a description of this route.
Declaration
public override string ToString()
Returns
|
System.String
|
Overrides
Triples()
Returns an enumerable that enumerates all customer triples that occur in the route as 1->2-3. If the route is a round the tuples that contain last->first are also included.
Declaration
public IEnumerable<Triple> Triples()
Returns
|
IEnumerable<Triple>
|
Implements
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns the enumerator.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
|
System.Collections.IEnumerator
|