RLib.Tsp 0.1.1-g3d99737633

This is a prerelease version of RLib.Tsp.
There is a newer prerelease version of this package available.
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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RLib.Tsp" Version="0.1.1-g3d99737633" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RLib.Tsp --version 0.1.1-g3d99737633
#r "nuget: RLib.Tsp, 0.1.1-g3d99737633"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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 224 2/25/2022
1.1.0-g4fe01e052d 170 12/17/2021
1.1.0-g3eca799fb8 147 12/17/2021
1.0.0-gfeb80e4a6c 240 10/17/2021
0.2.0-g395e96ceab 251 10/17/2021
0.1.2-gc5ab1f106c 191 10/17/2021
0.1.2-g06b41ae937 496 10/17/2021
0.1.1-g7125e043f4 150 10/17/2021
0.1.1-g3d99737633 145 10/17/2021
0.1.1-g20a17addf7 142 10/17/2021
0.1.1-g03132bd368 182 10/17/2021