DotNetNelderMead 1.0.0
dotnet add package DotNetNelderMead --version 1.0.0
NuGet\Install-Package DotNetNelderMead -Version 1.0.0
<PackageReference Include="DotNetNelderMead" Version="1.0.0" />
<PackageVersion Include="DotNetNelderMead" Version="1.0.0" />
<PackageReference Include="DotNetNelderMead" />
paket add DotNetNelderMead --version 1.0.0
#r "nuget: DotNetNelderMead, 1.0.0"
#:package DotNetNelderMead@1.0.0
#addin nuget:?package=DotNetNelderMead&version=1.0.0
#tool nuget:?package=DotNetNelderMead&version=1.0.0
DotNetNelderMead
Introduction
DotNetNelderMead is a .NET implementation of the Nelder–Mead simplex method — a derivative-free
local optimizer for continuous functions. It is a sibling of
DotNetDifferentialEvolution: both
share the DotNetOptimization.Abstractions
contracts, so a single objective implementation drives either optimizer, and the two compose
into a hybrid (memetic) pipeline.
All objectives are minimized (lower fitness is better).
Features
- Standard and adaptive coefficients — classic Nelder–Mead (1965), or the dimension-adaptive set of Gao & Han (2012) for better behavior in higher dimensions.
- Automatic restarts — reinitialize the simplex around the best vertex on convergence to escape premature collapse.
- Bounded domains — box constraints handled by projecting candidates into range.
- Parallel multi-start — run many independent simplices across processors and keep the best.
- Composable termination — built-in convergence / iteration / evaluation / stagnation limits,
plus a pluggable
ITerminationStrategy. - Hybrid with Differential Evolution — a sequential DE→Nelder–Mead handoff and an in-pipeline
memetic refiner (
DotNetNelderMead.DifferentialEvolution).
Installation
Requires the .NET SDK 8.0 or higher.
dotnet add package DotNetNelderMead
Usage
Implement the shared objective contract (IFitnessFunctionEvaluator from
DotNetOptimization.Abstractions):
using DotNetOptimization.Abstractions;
public sealed class RosenbrockEvaluator : IFitnessFunctionEvaluator
{
public double Evaluate(ReadOnlySpan<double> g)
=> Math.Pow(1.0 - g[0], 2) + 100.0 * Math.Pow(g[1] - g[0] * g[0], 2);
public double Evaluate(int workerIndex, ReadOnlySpan<double> g) => Evaluate(g);
}
Then build and run the optimizer:
using DotNetNelderMead;
var result = NelderMeadBuilder
.ForFunction(new RosenbrockEvaluator())
.StartingFrom(new[] { -1.2, 1.0 })
.WithAdaptiveCoefficients() // or WithStandardCoefficients() (default)
.WithConvergence(domainTolerance: 1e-10, functionTolerance: 1e-10)
.Build()
.Run(); // or await ...RunAsync()
Console.WriteLine($"f = {result.Best.FitnessFunctionValue} after {result.IterationCount} iters");
result.Best is an ISolution (Genes + FitnessFunctionValue); result also reports
IterationCount, EvaluationCount, RestartCount, Converged, and TerminationReason.
Bounds, restarts, and parallel multi-start
var result = NelderMeadBuilder
.ForFunction(evaluator)
.WithBounds(lowerBound, upperBound)
.WithUniformStart() // sample the start within the bounds
.WithRestarts(maxRestarts: 5)
.WithMultiStart(16) // 16 independent simplices, parallel; or UseAllProcessors()
.WithMaxEvaluations(200_000)
.Build()
.Run();
Hybridizing with Differential Evolution
Install the integration package:
dotnet add package DotNetNelderMead.DifferentialEvolution
Sequential handoff — polish a global-search result with a local Nelder–Mead refinement. Because
the DE result is an ISolution, it seeds the simplex directly:
using DotNetNelderMead;
var de = DifferentialEvolutionBuilder.ForFunction(evaluator) /* ... */ .Build();
var deResult = await de.RunAsync();
deResult.MoveCursorToBestIndividual();
var refined = NelderMeadBuilder
.ForFunction(evaluator)
.WithBounds(lowerBound, upperBound)
.StartingFrom(deResult.IndividualCursor) // ISolution → start point
.Build()
.Run();
Memetic / in-pipeline — run a Nelder–Mead polish every N generations inside the DE loop, feeding the improvement straight back into the population (SHADE / L-SHADE adaptive state is preserved):
using DotNetNelderMead.DifferentialEvolution;
var de = DifferentialEvolutionBuilder
.ForFunction(evaluator)
.WithBounds(lowerBound, upperBound)
.WithPopulationSize(60)
.WithUniformPopulationSampling()
.WithJde()
.WithTerminationCondition(new LimitGenerationNumberTerminationStrategy(500))
.UseAllProcessors()
.WithNelderMeadLocalSearch(evaluator, everyNGenerations: 25)
.Build();
var result = await de.RunAsync();
License
This project is licensed under the MIT License. See the LICENSE file for more details.
| Product | Versions 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. |
-
net8.0
- DotNetOptimization.Abstractions (>= 1.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DotNetNelderMead:
| Package | Downloads |
|---|---|
|
DotNetNelderMead.DifferentialEvolution
Hybrid / memetic integration between DotNetNelderMead and DotNetDifferentialEvolution: a Nelder–Mead local-search refiner for the DE pipeline (run every N generations) and a sequential DE→Nelder–Mead handoff. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 89 | 6/3/2026 |