Interface ITour
Abstract representation of a route or a sequence of customers.
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public interface ITour : IEnumerable<int>, ISolution
Properties
Count
Returns the amount of customers in the route.
Declaration
int Count { get; }
Property Value
|
System.Int32
|
First
Returns the first customer.
Declaration
int First { get; }
Property Value
|
System.Int32
|
Last
Returns the last customer.
Declaration
int ? Last { get; }
Property Value
|
System.Nullable<System.Int32>
|
Methods
Between(Int32, Int32)
Returns an enumerable that enumerates between the two given customers.
Declaration
IEnumerable<int> Between(int from, int to)
Parameters
|
System.Int32
from
|
|
System.Int32
to
|
Returns
|
IEnumerable<System.Int32>
En enumerable that enumerates customers between two given customers. |
Exceptions
|
System.ArgumentException
When from equals equals to. |
Clear()
Removes all customers in this route except the first one.
Declaration
void Clear()
Contains(Int32)
Returns true if the given customer is in this route.
Declaration
bool Contains(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Boolean
True if the customer occurs in this route. |
Contains(Int32, Int32)
Returns true if there is an edge in this route from from to to.
Declaration
bool Contains(int from, int to)
Parameters
|
System.Int32
from
|
|
System.Int32
to
|
Returns
|
System.Boolean
True if there is an edge from->to in this route. |
Exceptions
|
System.ArgumentException
When from equals to. |
GetCustomerAt(Int32)
Gets the customer at the given index.
Declaration
int GetCustomerAt(int index)
Parameters
|
System.Int32
index
The position of the customer in the route, the first being at O. |
Returns
|
System.Int32
|
Exceptions
|
System.ArgumentOutOfRangeException
When the index is out of range. |
GetEnumerator(Int32)
Returns an enumerator that iterates through the customer in this route starting at the given customer.
Declaration
IEnumerator<int> GetEnumerator(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
IEnumerator<System.Int32>
|
GetIndexOf(Int32)
Returns the index of the given customer the first being zero.
Declaration
int GetIndexOf(int customer)
Parameters
|
System.Int32
customer
The customer to search for. |
Returns
|
System.Int32
The index of the customer, it's position relative to the first customers. |
Exceptions
|
System.ArgumentOutOfRangeException
When the customer does not exist. |
GetNeigbour(Int32)
Returns the neigbour of a customer.
Declaration
int GetNeigbour(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Int32
The neighbours of the given customer. |
Exceptions
|
System.ArgumentOutOfRangeException
When the customer does not exist. |
InsertAfter(Int32, Int32)
Removes the edge from->unknown and replaces it with the edge from->to->unknown.
Declaration
void InsertAfter(int from, int to)
Parameters
|
System.Int32
from
|
|
System.Int32
to
|
Examples
Route 0->1 after InsertAfter(0, 2) becomes 0->2->1.
Route 0 after InsertAfter(0, 1) becomes 0->1.
Exceptions
|
System.ArgumentException
When from equals equals to. |
Pairs()
Returns an enumerable that enumerates all customer pairs that occur in the route as 1->2. If the route is a tour the pair that contains last->first is also included.
Declaration
IEnumerable<Pair> Pairs()
Returns
|
IEnumerable<Pair>
An enumerable that enumerates all customer pairs that occur in the route as 1->2. If the route is a tour the pair that contains last->first is also included. |
Remove(Int32)
Removes a customer from the route.
Declaration
bool Remove(int customer)
Parameters
|
System.Int32
customer
|
Returns
|
System.Boolean
Return true if the customer was found and removed. |
Exceptions
|
System.InvalidOperationException
When attempting to remove the first customer. |
Remove(Int32, out Int32, out Int32)
Removes a customer from the route.
Declaration
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
Return true if the customer was found and removed. |
Exceptions
|
System.InvalidOperationException
When attempting to remove the first customer. |
Replace(Int32, Int32)
Replaces the old customer with the new customer, assuming the new customer isn't already part of the route.
Declaration
void Replace(int oldCustomer, int newCustomer)
Parameters
|
System.Int32
oldCustomer
|
|
System.Int32
newCustomer
|
ReplaceEdgeFrom(Int32, Int32)
Removes the edge from->unknown and replaces it with the edge from->to. 0->1->2:ReplaceEdgeFrom(0, 2):0->2 without resetting the last customer property.
Declaration
void ReplaceEdgeFrom(int from, int to)
Parameters
|
System.Int32
from
|
|
System.Int32
to
|
Exceptions
|
System.ArgumentException
When from equals equals to. |
ShiftAfter(Int32, Int32)
Shifts the given customer to a new location and places it after the given 'before' customer.
Declaration
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
True if the operation succeeded. |
Remarks
example: route: 1->2->3->4->5->6 customer: 2 before: 4
new route: 1->3->4->2->5->6
Exceptions
|
System.ArgumentException
When customer equals before. |
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
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
|
Remarks
example: route: 1->2->3->4->5->6 customer: 2 before: 4
new route: 1->3->4->2->5->6 oldBefore: 1 oldAfter: 3 newAfter: 5
Exceptions
|
System.ArgumentException
When customer equals before. |
Triples()
Returns an enumerable that enumerates all customer triples that occur in the route as 1->2->3. If the route is a tour the tuples that contain last->first are also included.
Declaration
IEnumerable<Triple> Triples()
Returns
|
IEnumerable<Triple>
An enumerable that enumerates all customer triples that occur in the route as 1->2->3. If the route is a tour the tuples that contain last->first are also included. |