Simulated Annealing for node.js
Simulated Annealing optimization algorithm for node.js.
Install
npm install --save simulated-annealing
Usage
var simulatedAnnealing = ;var result = ;
Params
- initialState - first state value
- tempMax - initial temperature
- tempMin - min temperature when algorithm will stop
- newState - function for generating new state from current state newState(state)
- getTemp - function for generating new temperature based on previous temperature getTemp(temperature)
- getEnergy - function for calculating energy for state getEnergy(state) (less is better)
Example
Find solution for x^2=16
var simulatedAnnealing = ; { return Math;} { return x + Math - 05;} // linear temperature decreasing { return prevTemperature - 0001;} var result = ;
Testing
npm test