Pagmo.NET 1.0.0

dotnet add package Pagmo.NET --version 1.0.0
                    
NuGet\Install-Package Pagmo.NET -Version 1.0.0
                    
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" />
                    
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" />
                    
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
                    
#r "nuget: Pagmo.NET, 1.0.0"
                    
#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
                    
#: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
                    
Install as a Cake Addin
#tool nuget:?package=Pagmo.NET&version=1.0.0
                    
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, Linux x64, and macOS (arm64 + x86_64 universal binary) — native runtime libraries are bundled in the package. No additional installation required.

Installation

dotnet add package Pagmo.NET --prerelease

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-safe problems — declare ThreadSafety.Basic and the problem instance is shared across threads directly:

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

Non-thread-safe problems that can be cloned — implement IThreadCloneableProblem and override Clone() on ManagedProblemBase. Each island or OS thread receives its own exclusive copy, so the problem never needs to be concurrency-safe:

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

public override IProblem Clone() => new MyProblem(); // fresh independent copy

Problems declaring ThreadSafety.None without a working Clone() are rejected on threaded paths (archipelago.push_back_island, thread_bfe) with a descriptive error.

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
Per-thread problem cloning (IThreadCloneableProblem) Non-thread-safe problems can participate in threaded paths via Clone()
Custom C# algorithms (IAlgorithm) Participates in island/archipelago type-erased flows
NLopt Statically linked — available out of the box
IPOPT Provided by the separate Pagmo.NET.Ipopt package (EPL-2.0)
SNOPT7 Not included (proprietary license; build from source with your own license)
macOS (arm64 + x86_64) Supported — universal binary; NLopt included
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? IPOPT is not part of this package — it is EPL-2.0-licensed and kept separate from this MPL-2.0 package. Install the Pagmo.NET.Ipopt package to add it; OptionalSolverAvailability.IsIpoptAvailable reports whether it is present at runtime.

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.

License

Pagmo.NET is licensed under the MPL-2.0. It statically links third-party libraries under their own licenses (pagmo2 and NLopt under the LGPL, Boost under BSL-1.0, Intel oneTBB under Apache-2.0, Eigen3 under MPL-2.0). See THIRD_PARTY_LICENSES.md.

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