@thi.ng/gp 0.4.30 → 0.4.32
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 +1 -1
- package/README.md +7 -10
- package/api.d.ts +7 -7
- package/ast.d.ts +11 -11
- package/ast.js +11 -11
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/gp)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -22,7 +22,7 @@ This project is part of the
|
|
|
22
22
|
|
|
23
23
|
## About
|
|
24
24
|
|
|
25
|
-
Genetic programming helpers & strategies (tree based & multi-expression programming)
|
|
25
|
+
Genetic programming helpers & strategies (tree based & multi-expression programming)
|
|
26
26
|
|
|
27
27
|
This package does not (yet) provide a complete GP framework and is
|
|
28
28
|
largely focused on the following operations:
|
|
@@ -79,11 +79,8 @@ ES module import:
|
|
|
79
79
|
|
|
80
80
|
For Node.js REPL:
|
|
81
81
|
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
node --experimental-repl-await
|
|
85
|
-
|
|
86
|
-
> const gp = await import("@thi.ng/gp");
|
|
82
|
+
```js
|
|
83
|
+
const gp = await import("@thi.ng/gp");
|
|
87
84
|
```
|
|
88
85
|
|
|
89
86
|
Package sizes (brotli'd, pre-treeshake): ESM: 1.18 KB
|
|
@@ -117,7 +114,7 @@ TODO
|
|
|
117
114
|
|
|
118
115
|
## Authors
|
|
119
116
|
|
|
120
|
-
Karsten Schmidt
|
|
117
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
121
118
|
|
|
122
119
|
If this project contributes to an academic publication, please cite it as:
|
|
123
120
|
|
|
@@ -132,4 +129,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
132
129
|
|
|
133
130
|
## License
|
|
134
131
|
|
|
135
|
-
© 2019 - 2022 Karsten Schmidt // Apache
|
|
132
|
+
© 2019 - 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Fn, Fn2 } from "@thi.ng/api";
|
|
2
2
|
import type { IRandom } from "@thi.ng/random";
|
|
3
|
-
export
|
|
3
|
+
export type GeneType = "term" | "op";
|
|
4
4
|
/**
|
|
5
5
|
* Type alias for S-expression based AST
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export type ASTNode<OP, T> = TerminalGene<T> | OpGene<OP, ASTNode<OP, T>>;
|
|
8
|
+
export type MEPGene<OP, T> = TerminalGene<T> | OpGene<OP, number>;
|
|
9
|
+
export type MEPChromosome<OP, T> = MEPGene<OP, T>[];
|
|
10
10
|
export interface GPOpts<OP, T, ARGS> {
|
|
11
11
|
/**
|
|
12
12
|
* Terminal node generator. If probabilistic, the given PRNG MUST be
|
|
@@ -18,10 +18,10 @@ export interface GPOpts<OP, T, ARGS> {
|
|
|
18
18
|
*/
|
|
19
19
|
ops: OpGenSpec<ARGS, OP>[];
|
|
20
20
|
/**
|
|
21
|
-
* Possibly seeded PRNG instance to be used for AST generation /
|
|
22
|
-
* editing.
|
|
21
|
+
* Possibly seeded PRNG instance to be used for AST generation / editing.
|
|
23
22
|
*
|
|
24
|
-
* @defaultValue
|
|
23
|
+
* @defaultValue
|
|
24
|
+
* [`SYSTEM`](https://docs.thi.ng/umbrella/random/variables/SYSTEM.html)
|
|
25
25
|
*/
|
|
26
26
|
rnd?: IRandom;
|
|
27
27
|
/**
|
package/ast.d.ts
CHANGED
|
@@ -37,26 +37,26 @@ export declare class AST<OP, T> {
|
|
|
37
37
|
*/
|
|
38
38
|
mutate(tree: ASTNode<OP, T>, maxDepth?: number): ASTNode<OP, T>;
|
|
39
39
|
/**
|
|
40
|
-
* Returns linearized/flat version of given AST as an array of
|
|
41
|
-
*
|
|
40
|
+
* Returns linearized/flat version of given AST as an array of [zipper
|
|
41
|
+
* locations](https://docs.thi.ng/umbrella/zipper/classes/Location.html).
|
|
42
42
|
*
|
|
43
43
|
* @param tree -
|
|
44
44
|
*/
|
|
45
45
|
linearizedAST(tree: ASTNode<OP, T>): Location<ASTNode<OP, T>>[];
|
|
46
46
|
/**
|
|
47
|
-
* Returns random {@link ASTNode} from given tree, using the user
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
47
|
+
* Returns random {@link ASTNode} from given tree, using the user provided
|
|
48
|
+
* PRNG (via `opts`) or
|
|
49
|
+
* [`SYSTEM`](https://docs.thi.ng/umbrella/random/variables/SYSTEM.html).
|
|
50
|
+
* The returned value is a [zipper
|
|
51
|
+
* location](https://docs.thi.ng/umbrella/zipper/classes/Location.html) of
|
|
52
|
+
* the selected node.
|
|
52
53
|
*
|
|
53
54
|
* @remarks
|
|
54
55
|
* The actual `ASTNode` can be obtained via `.node`.
|
|
55
56
|
*
|
|
56
|
-
* Only nodes in the linearized index range `[min..max)` are
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* to the linearized tree end.
|
|
57
|
+
* Only nodes in the linearized index range `[min..max)` are returned
|
|
58
|
+
* (default: entire tree range). Since the linear tree length isn't known
|
|
59
|
+
* beforehand, `max` < 0 (default) is equivalent to the linearized tree end.
|
|
60
60
|
*
|
|
61
61
|
* @param opts -
|
|
62
62
|
* @param tree -
|
package/ast.js
CHANGED
|
@@ -77,8 +77,8 @@ export class AST {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* Returns linearized/flat version of given AST as an array of
|
|
81
|
-
*
|
|
80
|
+
* Returns linearized/flat version of given AST as an array of [zipper
|
|
81
|
+
* locations](https://docs.thi.ng/umbrella/zipper/classes/Location.html).
|
|
82
82
|
*
|
|
83
83
|
* @param tree -
|
|
84
84
|
*/
|
|
@@ -88,19 +88,19 @@ export class AST {
|
|
|
88
88
|
];
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
* Returns random {@link ASTNode} from given tree, using the user
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
91
|
+
* Returns random {@link ASTNode} from given tree, using the user provided
|
|
92
|
+
* PRNG (via `opts`) or
|
|
93
|
+
* [`SYSTEM`](https://docs.thi.ng/umbrella/random/variables/SYSTEM.html).
|
|
94
|
+
* The returned value is a [zipper
|
|
95
|
+
* location](https://docs.thi.ng/umbrella/zipper/classes/Location.html) of
|
|
96
|
+
* the selected node.
|
|
96
97
|
*
|
|
97
98
|
* @remarks
|
|
98
99
|
* The actual `ASTNode` can be obtained via `.node`.
|
|
99
100
|
*
|
|
100
|
-
* Only nodes in the linearized index range `[min..max)` are
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* to the linearized tree end.
|
|
101
|
+
* Only nodes in the linearized index range `[min..max)` are returned
|
|
102
|
+
* (default: entire tree range). Since the linear tree length isn't known
|
|
103
|
+
* beforehand, `max` < 0 (default) is equivalent to the linearized tree end.
|
|
104
104
|
*
|
|
105
105
|
* @param opts -
|
|
106
106
|
* @param tree -
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/gp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.32",
|
|
4
4
|
"description": "Genetic programming helpers & strategies (tree based & multi-expression programming)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/errors": "^2.2.
|
|
39
|
-
"@thi.ng/math": "^5.3.
|
|
40
|
-
"@thi.ng/random": "^3.3.
|
|
41
|
-
"@thi.ng/transducers": "^8.3.
|
|
42
|
-
"@thi.ng/zipper": "^2.1.
|
|
37
|
+
"@thi.ng/api": "^8.6.1",
|
|
38
|
+
"@thi.ng/errors": "^2.2.6",
|
|
39
|
+
"@thi.ng/math": "^5.3.17",
|
|
40
|
+
"@thi.ng/random": "^3.3.19",
|
|
41
|
+
"@thi.ng/transducers": "^8.3.27",
|
|
42
|
+
"@thi.ng/zipper": "^2.1.28"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.33.
|
|
46
|
-
"@thi.ng/testament": "^0.3.
|
|
45
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
46
|
+
"@thi.ng/testament": "^0.3.7",
|
|
47
47
|
"rimraf": "^3.0.2",
|
|
48
48
|
"tools": "^0.0.1",
|
|
49
|
-
"typedoc": "^0.23.
|
|
50
|
-
"typescript": "^4.
|
|
49
|
+
"typedoc": "^0.23.22",
|
|
50
|
+
"typescript": "^4.9.4"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"agent",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"status": "alpha",
|
|
109
109
|
"year": 2019
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
112
112
|
}
|