@thi.ng/gp 0.4.52 → 0.4.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-08-04T10:58:19Z
3
+ - **Last updated**: 2023-08-12T13:14:08Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [0.4.55](https://github.com/thi-ng/umbrella/tree/@thi.ng/gp@0.4.55) (2023-08-12)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - update .probability() call sites in various pkgs ([c8c8141](https://github.com/thi-ng/umbrella/commit/c8c8141))
17
+
12
18
  ## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/gp@0.4.0) (2021-11-17)
13
19
 
14
20
  #### 🚀 Features
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
+ <!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
2
3
 
3
- # ![@thi.ng/gp](https://media.thi.ng/umbrella/banners-20220914/thing-gp.svg?37482bab)
4
+ # ![@thi.ng/gp](https://media.thi.ng/umbrella/banners-20230807/thing-gp.svg?37482bab)
4
5
 
5
6
  [![npm version](https://img.shields.io/npm/v/@thi.ng/gp.svg)](https://www.npmjs.com/package/@thi.ng/gp)
6
7
  ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/gp.svg)
package/ast.js CHANGED
@@ -58,7 +58,7 @@ export class AST {
58
58
  return tree;
59
59
  while (true) {
60
60
  let nextLoc;
61
- if (rnd.float() < probMutate) {
61
+ if (rnd.probability(probMutate)) {
62
62
  loc = loc.replace(this.randomASTNode(0, Math.min(limit - loc.depth, maxDepth)));
63
63
  nextLoc = loc.right;
64
64
  if (!nextLoc) {
package/mep.js CHANGED
@@ -71,7 +71,7 @@ export class MEP {
71
71
  const res = [];
72
72
  const minLen = Math.min(chromo1.length, chromo2.length);
73
73
  for (let i = 0; i < minLen; i++) {
74
- res[i] = rnd.float() < 0.5 ? chromo1[i] : chromo2[i];
74
+ res[i] = rnd.probability(0.5) ? chromo1[i] : chromo2[i];
75
75
  }
76
76
  return chromo1.length > minLen
77
77
  ? res.concat(chromo1.slice(minLen))
@@ -83,7 +83,9 @@ export class MEP {
83
83
  const { rnd, probMutate } = this.opts;
84
84
  const res = new Array(chromo.length);
85
85
  for (let i = chromo.length; i-- > 0;) {
86
- res[i] = rnd.float() < probMutate ? this.randomGene(i) : chromo[i];
86
+ res[i] = rnd.probability(probMutate)
87
+ ? this.randomGene(i)
88
+ : chromo[i];
87
89
  }
88
90
  return res;
89
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/gp",
3
- "version": "0.4.52",
3
+ "version": "0.4.55",
4
4
  "description": "Genetic programming helpers & strategies (tree based & multi-expression programming)",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,16 +34,16 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "dependencies": {
37
- "@thi.ng/api": "^8.9.0",
38
- "@thi.ng/errors": "^2.3.0",
39
- "@thi.ng/math": "^5.5.1",
40
- "@thi.ng/random": "^3.5.1",
41
- "@thi.ng/transducers": "^8.5.0",
42
- "@thi.ng/zipper": "^2.1.45"
37
+ "@thi.ng/api": "^8.9.3",
38
+ "@thi.ng/errors": "^2.3.3",
39
+ "@thi.ng/math": "^5.5.4",
40
+ "@thi.ng/random": "^3.6.0",
41
+ "@thi.ng/transducers": "^8.5.3",
42
+ "@thi.ng/zipper": "^2.1.48"
43
43
  },
44
44
  "devDependencies": {
45
- "@microsoft/api-extractor": "^7.36.3",
46
- "@thi.ng/testament": "^0.3.18",
45
+ "@microsoft/api-extractor": "^7.36.4",
46
+ "@thi.ng/testament": "^0.3.21",
47
47
  "rimraf": "^5.0.1",
48
48
  "tools": "^0.0.1",
49
49
  "typedoc": "^0.24.8",
@@ -108,5 +108,5 @@
108
108
  "status": "alpha",
109
109
  "year": 2019
110
110
  },
111
- "gitHead": "9fa3f7f8169efa30e3c71b43c82f77393581c3b5\n"
111
+ "gitHead": "399f8c53d66b9b763d16c21bb59f145df5f59514\n"
112
112
  }