bat-algorithm
v1.2.3
Published
A simple JavaScript library implementing the Bat Algorithm for optimization problems.
Downloads
11
Maintainers
Keywords
Readme
npm install bat-algorithm
const { batAlgorithm } = require('bat-algorithm');
const batAlgorithm = require('bat-algorithm');
// Define the cost function
function sphere(x) {
let sum = 0
for (let i = 0; i < x.length; i++) {
sum += x[i] * x[i]
}
return sum
}
// Call the batAlgorithm() function with optional parameters
const result = await batAlgorithm(sphere);
const result = await batAlgorithm(sphere, "./myFolder", 150, 10000, 100, 30, 2, 1, -10, 10, 0, 10);