From 92f780a23a17c60cc749cad5276975f78cb9c528 Mon Sep 17 00:00:00 2001 From: Luc Patiny Date: Thu, 7 Mar 2024 14:58:06 +0100 Subject: [PATCH] fix: update dependencies --- package.json | 16 ++++++++-------- src/__tests__/initialState.test.js | 2 +- src/__tests__/optimization.test.js | 4 ++-- src/index.js | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 6110d7b..086b42b 100644 --- a/package.json +++ b/package.json @@ -32,18 +32,18 @@ }, "homepage": "https://github.com/mljs/direct#readme", "devDependencies": { - "@babel/plugin-transform-modules-commonjs": "^7.21.2", + "@babel/plugin-transform-modules-commonjs": "^7.23.3", "cheminfo-build": "^1.2.0", - "eslint": "^8.36.0", - "eslint-config-cheminfo": "^8.2.0", + "eslint": "^8.57.0", + "eslint-config-cheminfo": "^9.2.0", "esm": "^3.2.25", - "jest": "^29.5.0", + "jest": "^29.7.0", "jest-matcher-deep-close-to": "^3.0.2", - "prettier": "^2.8.7", - "rollup": "^3.20.2" + "prettier": "^3.2.5", + "rollup": "^4.12.1" }, "dependencies": { - "ml-matrix": "^6.10.4", - "ml-spectra-processing": "^12.0.0" + "ml-matrix": "^6.11.0", + "ml-spectra-processing": "^14.2.0" } } \ No newline at end of file diff --git a/src/__tests__/initialState.test.js b/src/__tests__/initialState.test.js index 2d357d6..1dca027 100644 --- a/src/__tests__/initialState.test.js +++ b/src/__tests__/initialState.test.js @@ -31,7 +31,7 @@ function griewank(x) { let s = 0; let p = 1; for (let i = 0; i < d; i++) { - s += Math.pow(x[i], 2) / Math.sqrt(4000); + s += x[i] ** 2 / Math.sqrt(4000); p *= Math.cos(x[i] / Math.sqrt(i + 1)); } let result = s - p + 1; diff --git a/src/__tests__/optimization.test.js b/src/__tests__/optimization.test.js index 7822c3c..0fdeeda 100644 --- a/src/__tests__/optimization.test.js +++ b/src/__tests__/optimization.test.js @@ -66,7 +66,7 @@ function griewank(x) { let s = 0; let p = 1; for (let i = 0; i < d; i++) { - s += Math.pow(x[i], 2) / Math.sqrt(4000); + s += x[i] ** 2 / Math.sqrt(4000); p *= Math.cos(x[i] / Math.sqrt(i + 1)); } let result = s - p + 1; @@ -77,7 +77,7 @@ function rastrigin(x) { let d = x.length; let s = 0; for (let i = 0; i < d; i++) { - s += Math.pow(x[i], 2) - 10 * Math.cos(2 * Math.PI * x[i]); + s += x[i] ** 2 - 10 * Math.cos(2 * Math.PI * x[i]); } let result = 10 * d + s; return result; diff --git a/src/index.js b/src/index.js index f4e4e43..74f7463 100644 --- a/src/index.js +++ b/src/index.js @@ -72,7 +72,7 @@ export default function direct( fCalls = 1, smallerDistance = 0, edgeSizes = [new Float64Array(n).fill(0.5)], - diagonalDistances = [Math.sqrt(n * Math.pow(0.5, 2))], + diagonalDistances = [Math.sqrt(n * 0.5 ** 2)], functionValues = [bestCurrentValue], differentDistances = diagonalDistances, smallerValuesByDistance = [bestCurrentValue],