Pagmo.NET 1.0.0-beta.2

This is a prerelease version of Pagmo.NET.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Pagmo.NET --version 1.0.0-beta.2
                    
NuGet\Install-Package Pagmo.NET -Version 1.0.0-beta.2
                    
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="Pagmo.NET" Version="1.0.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pagmo.NET" Version="1.0.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Pagmo.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pagmo.NET --version 1.0.0-beta.2
                    
#r "nuget: Pagmo.NET, 1.0.0-beta.2"
                    
#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.
#:package Pagmo.NET@1.0.0-beta.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pagmo.NET&version=1.0.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Pagmo.NET&version=1.0.0-beta.2&prerelease
                    
Install as a Cake Tool

Pagmo.NET

Pagmo.NET

Pagmo.NET is a C# wrapper for pagmo2, a C++ library providing high-quality metaheuristic and gradient-based optimization algorithms with multi-island parallel evolution support.

Supported platforms: Windows x64 and Linux x64 — native runtime libraries are bundled in the package. No additional installation required.

Installation

dotnet add package Pagmo.NET --version 1.0.0-beta.2

Quickstart

using pagmo;

public sealed class SphereProblem : ManagedProblemBase
{
    public override PairOfDoubleVectors get_bounds() => Bounds(
        new[] { -5.0, -5.0 },
        new[] { 5.0, 5.0 });

    public override DoubleVector fitness(DoubleVector x)
        => Vec(x[0] * x[0] + x[1] * x[1]);

    public override ThreadSafety get_thread_safety() => ThreadSafety.Basic;
}

using IAlgorithm algo = new de(100u);
using var udp = new SphereProblem();
using var isl = island.Create(algo, udp, popSize: 64u, seed: 2u);
isl.evolve(1u);
isl.wait_check();

using var result = isl.get_population();
using var bestX = result.champion_x();
using var bestF = result.champion_f();

Use island.Create(...) for single-island runs and archipelago.push_back_island(...) for multi-island parallel search.

Defining custom problems

Implement IProblem or inherit from ManagedProblemBase. Only two methods are required:

public override DoubleVector fitness(DoubleVector x) { ... }
public override PairOfDoubleVectors get_bounds() { ... }

Optional capabilities — gradients, hessians, batch evaluation, seed hooks, metadata — have safe defaults and can be overridden as needed. ManagedProblemBase includes helpers Vec(...) and Bounds(lower, upper) for concise authoring.

Threading

thread_bfe and archipelago with managed UDPs require parallel-safety opt-in:

public override ThreadSafety get_thread_safety() => ThreadSafety.Basic;

Managed UDPs declaring ThreadSafety.None are rejected on threaded execution paths.

Runnable examples

dotnet run --project Examples/Examples.Pagmo.NET/Examples.Pagmo.NET.csproj -- all

Scenarios: single, archipelago, policies, maneuver. Add --verbose to print algorithm logs after each scenario.

What's included

Feature Notes
All major pagmo algorithms de, sade, pso, cmaes, nsga2, moead, and more
All built-in benchmark problems rosenbrock, rastrigin, dtlz, wfg, and more
Multi-island archipelago Topology, migration, and policy wiring
Custom C# problems (IProblem / ManagedProblemBase) Full lifecycle with exception-safe callbacks
Custom C# algorithms (IAlgorithm) Participates in island/archipelago type-erased flows
NLopt Statically linked — available out of the box
IPOPT Statically linked — available out of the box
SNOPT7 Not included (proprietary license; build from source with your own license)
macOS Planned for v2
x86 / ARM Not supported in v1
.NET Framework Not supported

FAQ

Why .NET and C#? The .NET ecosystem is underappreciated for scientific computing. C# performance is competitive with C++ for many workloads, and .NET's open-source trajectory makes it a strong foundation for numerical work. Pagmo.NET lets teams use pagmo's optimization power without a Python runtime dependency.

Why SWIG? SWIG handles the repetitive wrapping work across a large API surface. The .i interface file is also a useful starting point for bindings in other languages.

Where's IPOPT? Included and statically linked on both Windows and Linux. OptionalSolverAvailability.IsIpoptAvailable returns true out of the box.

Where's SNOPT7? SNOPT7 is proprietary and cannot be bundled. Users with a SNOPT7 license can build Pagmo.NET from source with SNOPT7 support — see the repository README for instructions.

Is this affiliated with ESA or the pagmo2 team? No — Pagmo.NET is an independent .NET binding, not affiliated with ESA or the pagmo2 developers.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Pagmo.NET:

Package Downloads
Pagmo.NET.Ipopt

IPOPT native runtime for Pagmo.NET: bundles libipopt and its dependency closure (MUMPS, OpenBLAS, GCC runtime) so Pagmo.NET's built-in `ipopt` algorithm works out of the box. Add this alongside Pagmo.NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 154 8/12/2026
1.0.0-rc.7 81 7/27/2026
1.0.0-rc.6 75 7/27/2026
1.0.0-rc.5 76 7/25/2026
1.0.0-rc.4 85 7/16/2026
1.0.0-beta.5 68 5/7/2026
1.0.0-beta.4 60 5/6/2026
1.0.0-beta.2 70 4/26/2026
1.0.0-beta.1 67 4/26/2026