Unconstrained Function Minimization

0.0.4 · abandoned · verified Sun Apr 19

fmin is a JavaScript library designed for unconstrained numerical function minimization, offering implementations of several common optimization algorithms. These include the Nelder-Mead method, Gradient Descent, Wolf Line Search, and the Non-Linear Conjugate Gradient method. Currently at version 0.0.4, the package appears to be largely unmaintained; its last known commit was over eight years ago, indicating an abandoned status. While it originally differentiated itself by providing interactive visualizations and an accompanying blog post to explain the algorithms, these are external to the core npm package. Due to its very early development stage (sub-1.0 version) and prolonged inactivity, users should be aware of potential limitations regarding modern JavaScript compatibility, lack of TypeScript type definitions, and unoptimized performance compared to contemporary alternatives. The project has no clear release cadence, and development seems to have ceased.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to use the Nelder-Mead algorithm to find the minimum of a simple 2D function, logging the solution and iterations.

function loss(X) {
    var x = X[0], y = X[1];
    return Math.sin(y) * x  + Math.sin(x) * y  +  x * x +  y * y;
}

// Assuming a CommonJS environment or bundled application
const fmin = require('fmin');

const initialGuess = [-3.5, 3.5];
const solution = fmin.nelderMead(loss, initialGuess);

console.log("Minimum found at:", solution.x);
console.log("Value at minimum:", solution.fx);
console.log("Iterations:", solution.iterations);

view raw JSON →