RLib.Tsp
0.1.1-g3d99737633
See the version list below for details.
dotnet add package RLib.Tsp --version 0.1.1-g3d99737633
NuGet\Install-Package RLib.Tsp -Version 0.1.1-g3d99737633
<PackageReference Include="RLib.Tsp" Version="0.1.1-g3d99737633" />
paket add RLib.Tsp --version 0.1.1-g3d99737633
#r "nuget: RLib.Tsp, 0.1.1-g3d99737633"
// Install RLib.Tsp as a Cake Addin #addin nuget:?package=RLib.Tsp&version=0.1.1-g3d99737633&prerelease // Install RLib.Tsp as a Cake Tool #tool nuget:?package=RLib.Tsp&version=0.1.1-g3d99737633&prerelease
RLib.Tsp
Traveling Salesman problem solver written in C#. Solver is using 2-Opt algorithm implementation.
Usage
Arc cost calculating delegate must be defined in solver constructor. Solver does not cache arc distances, performance of provided delegate can drastically change solution search time.
var arcCost = new Func<int, int, float>((startIndex, endIndex) => costMatrix[startIndex, endIndex]);
var solver = new Solver(arcCost, cityNames);
var (solutionCities, solutionIndexes) = solver.FindSolution();
By default during possible node swap evaluation, only cost of affected nodes is calculated. In specific applications it is possible that travel cost between points depends also on other route segments. To cover this usecase, solver can be configured to evaluate swaps using full solution cost calculation delegate (in most cases this will increase execution time).
var arcCost = new Func<int, int, float>((startIndex, endIndex) => costMatrix[startIndex, endIndex]);
var solutionCost = new Func<int[], float>((solution) =>
{
float cost = 0f;
for (var i = 1; i < solution.Length; i++)
{
cost += arcCost(solution[i - 1], solution[i]) * 1+(0.1f*i);
}
return cost;
});
var solver = new Solver(arcCost, cityNames);
solver.UseFullSolutionCostValidation(solutionCost);
var (solutionCities, solutionIndexes) = solver.FindSolution();
Full solution cost validation is not used during initial solution creation.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.0-gb7eaa9bb98 | 268 | 2/25/2022 |
1.1.0-g4fe01e052d | 178 | 12/17/2021 |
1.1.0-g3eca799fb8 | 156 | 12/17/2021 |
1.0.0-gfeb80e4a6c | 251 | 10/17/2021 |
0.2.0-g395e96ceab | 262 | 10/17/2021 |
0.1.2-gc5ab1f106c | 201 | 10/17/2021 |
0.1.2-g06b41ae937 | 566 | 10/17/2021 |
0.1.1-g7125e043f4 | 159 | 10/17/2021 |
0.1.1-g3d99737633 | 155 | 10/17/2021 |
0.1.1-g20a17addf7 | 150 | 10/17/2021 |
0.1.1-g03132bd368 | 191 | 10/17/2021 |