UNPKG

maths.ts

Version:

Math utilities library for TypeScript, JavaScript and Node.js

18 lines (17 loc) 1.09 kB
import { NPProblem } from './'; /** * Simulated annealing metaheuristic seeks for a global optimal solution for * a given problem. This algorithm is inspired by the steel annealing process. * @param problem The problem which must have a solution generator, a * calculator for the solution and a neighbor generator for each solution. * @param nNeighbors The number of neighbors for the solution generated each * cycle. * @param kDiffer The percentage change of each neighbor from the solution. * @param t0 The initial temperature where to start the algorithm. Default 100. * @param tf The final temperature where to end the algorithm. Default 0. * @param tDecrease Sets the temperature decrease. Default nextT = T - 0.1. * @param sRepetitions The maximum number of repetitions for a given * solution before temperature drops down. * @returns The solution found by this algorithm. */ export declare function simulatedAnnealing<T>(problem: NPProblem<T>, nNeighbors?: number, kDiffer?: number, t0?: number, tf?: number, tDecrease?: (t: number) => number, sRepetitions?: number): T;