MATE-libraries 1.2.0__tar.gz → 1.3.0__tar.gz
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.
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/PKG-INFO +2 -2
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/pyproject.toml +2 -2
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_catalogue.py +1 -1
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_networkx.py +5 -4
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_prepare.py +1 -1
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/operators/_selection.py +1 -1
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/operators/_variation.py +21 -8
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/.gitignore +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/COPYING +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/COPYING.LESSER +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/README.md +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/__init__.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/analysis/__init__.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/analysis/__main__.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/analysis/_performance.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/analysis/_read.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/analysis/_replay.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/__init__.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_compiled.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_graph.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_opencl.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_organ.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_propagate.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_state.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/networks/_techniques.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/operators/__init__.py +0 -0
- {mate_libraries-1.2.0 → mate_libraries-1.3.0}/src/MATE_libraries/operators/_draws.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: MATE-libraries
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Libraries of MATE, the Modular Algorithmic Toolkit for Evolution: network library and standard operators library for MATE modules, analysis library for recorded runs
|
|
5
5
|
Project-URL: Homepage, https://gitlab.com/artificial_evolution/mate/mate
|
|
6
6
|
Project-URL: Issues, https://gitlab.com/artificial_evolution/mate/mate/-/issues
|
|
@@ -15,7 +15,7 @@ Classifier: Intended Audience :: Science/Research
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering
|
|
17
17
|
Requires-Python: >=3.14
|
|
18
|
-
Requires-Dist: mate-contract<2,>=1.
|
|
18
|
+
Requires-Dist: mate-contract<2,>=1.2
|
|
19
19
|
Provides-Extra: analysis
|
|
20
20
|
Requires-Dist: matplotlib>=3.9; extra == 'analysis'
|
|
21
21
|
Provides-Extra: opencl
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "MATE-libraries"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.3.0"
|
|
8
8
|
description = "Libraries of MATE, the Modular Algorithmic Toolkit for Evolution: network library and standard operators library for MATE modules, analysis library for recorded runs"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.14"
|
|
@@ -21,7 +21,7 @@ classifiers = [
|
|
|
21
21
|
"Programming Language :: Python :: 3",
|
|
22
22
|
"Topic :: Scientific/Engineering",
|
|
23
23
|
]
|
|
24
|
-
dependencies = ["MATE-contract>=1.
|
|
24
|
+
dependencies = ["MATE-contract>=1.2,<2"]
|
|
25
25
|
|
|
26
26
|
[project.optional-dependencies]
|
|
27
27
|
# The device path of the network library: propagation on an OpenCL device.
|
|
@@ -74,7 +74,7 @@ def _value(value: Any, domain: Domain, codes: Mapping[Hashable, int] | None,
|
|
|
74
74
|
"""Convert the value of one node or edge to an array of ``shape`` in the domain's dtype.
|
|
75
75
|
|
|
76
76
|
``codes`` maps the labels of an ``Ordinal`` or ``Categorical`` domain to their codes; it is
|
|
77
|
-
``None`` for a numeric domain.
|
|
77
|
+
``None`` for a numeric domain. ``shape`` ends with the domain's ``element_shape``.
|
|
78
78
|
"""
|
|
79
79
|
if codes is not None:
|
|
80
80
|
if shape == ():
|
|
@@ -108,13 +108,14 @@ def _attribute(name: str, domain: Domain, shape: tuple[int, ...],
|
|
|
108
108
|
codes = None
|
|
109
109
|
if isinstance(domain, (Ordinal, Categorical)):
|
|
110
110
|
codes = {label: code for code, label in enumerate(domain.values)}
|
|
111
|
-
|
|
111
|
+
full = (*shape, *domain.element_shape)
|
|
112
|
+
values = np.zeros((len(data), *full), dtype=domain.dtype)
|
|
112
113
|
for i in np.flatnonzero(present):
|
|
113
114
|
where = f"{names[i]}, attribute '{name}'"
|
|
114
|
-
values[i] = _value(data[i][name], domain, codes,
|
|
115
|
+
values[i] = _value(data[i][name], domain, codes, full, where)
|
|
115
116
|
if present.all():
|
|
116
117
|
return values, None
|
|
117
|
-
mask = present.reshape(-1, *(1,) * len(
|
|
118
|
+
mask = present.reshape(-1, *(1,) * len(full))
|
|
118
119
|
return values, np.broadcast_to(mask, values.shape).copy()
|
|
119
120
|
|
|
120
121
|
|
|
@@ -417,7 +417,7 @@ def _malformed(
|
|
|
417
417
|
if arr is None:
|
|
418
418
|
return f"network: malformed organ: {d.place} attribute '{d.name}' is missing"
|
|
419
419
|
count = n if d.place == "node" else src.size
|
|
420
|
-
expected = (count, *d.shape) # type: ignore[misc]
|
|
420
|
+
expected = (count, *d.shape, *d.domain.element_shape) # type: ignore[misc, union-attr]
|
|
421
421
|
if arr.shape != expected:
|
|
422
422
|
return (
|
|
423
423
|
f"network: malformed organ: {d.place} attribute '{d.name}' has shape "
|
|
@@ -5,7 +5,16 @@ from dataclasses import dataclass
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
from numpy.typing import ArrayLike
|
|
7
7
|
|
|
8
|
-
from MATE_contract import
|
|
8
|
+
from MATE_contract import (
|
|
9
|
+
Categorical,
|
|
10
|
+
Domain,
|
|
11
|
+
FieldArray,
|
|
12
|
+
Integer,
|
|
13
|
+
Log,
|
|
14
|
+
Ordinal,
|
|
15
|
+
Real,
|
|
16
|
+
UnitVector,
|
|
17
|
+
)
|
|
9
18
|
|
|
10
19
|
_FIXED_SCALARS = (bool, int, float, complex, np.generic, np.ndarray)
|
|
11
20
|
|
|
@@ -19,7 +28,7 @@ def _open_bound(domain: Domain) -> bool:
|
|
|
19
28
|
|
|
20
29
|
def _check_domain(d: object) -> Domain:
|
|
21
30
|
"""Return ``d`` if it is a domain of the contract family with finite bounds."""
|
|
22
|
-
if type(d) not in (Real, Log, Integer, Ordinal, Categorical):
|
|
31
|
+
if type(d) not in (Real, Log, Integer, Ordinal, Categorical, UnitVector):
|
|
23
32
|
raise TypeError(f"op_for expects a Domain or a bounded FieldArray, got {type(d).__name__}")
|
|
24
33
|
if _open_bound(d): # type: ignore[arg-type]
|
|
25
34
|
raise ValueError(f"op_for: domain {d!r} has an open bound; nothing can be drawn from it")
|
|
@@ -46,8 +55,10 @@ class VariationOperator:
|
|
|
46
55
|
-----
|
|
47
56
|
Rules OV1, OV5, OV6 and OV8 of the libraries specification. Calling the operator returns
|
|
48
57
|
exactly ``domain.nudge(x, rng, scale)``: the library maps a domain to its operator and does
|
|
49
|
-
not define a second transformation.
|
|
50
|
-
|
|
58
|
+
not define a second transformation. It transforms elements, one value of the domain each:
|
|
59
|
+
a scalar, or a whole vector along the trailing ``domain.element_shape`` axes for a
|
|
60
|
+
``UnitVector`` (a step on the sphere, never one component). Frozen, hence picklable, so
|
|
61
|
+
that a method holding operators on ``self`` can be sent to worker processes.
|
|
51
62
|
"""
|
|
52
63
|
|
|
53
64
|
domain: Domain
|
|
@@ -61,12 +72,14 @@ class VariationOperator:
|
|
|
61
72
|
Parameters
|
|
62
73
|
----------
|
|
63
74
|
x : array_like
|
|
64
|
-
Values contained in the domain (codes for ``Ordinal`` and ``Categorical
|
|
75
|
+
Values contained in the domain (codes for ``Ordinal`` and ``Categorical``, vectors
|
|
76
|
+
along the last axis for ``UnitVector``).
|
|
65
77
|
rng : numpy.random.Generator
|
|
66
78
|
The method's generator, from its ``variation`` branch of the seed tree (OV3).
|
|
67
79
|
scale : array_like
|
|
68
|
-
Amplitude chosen by the method, broadcastable to ``x
|
|
69
|
-
Required: the amplitude changes
|
|
80
|
+
Amplitude chosen by the method, one per element: broadcastable to ``x`` without its
|
|
81
|
+
``domain.element_shape`` axes, finite and ``>= 0``. Required: the amplitude changes
|
|
82
|
+
the result (OV6).
|
|
70
83
|
|
|
71
84
|
Returns
|
|
72
85
|
-------
|
|
@@ -88,7 +101,7 @@ def op_for(d: Domain | FieldArray) -> VariationOperator:
|
|
|
88
101
|
----------
|
|
89
102
|
d : Domain or FieldArray
|
|
90
103
|
A domain with finite bounds, or a bounded ``FieldArray`` (its domain's operator,
|
|
91
|
-
applied
|
|
104
|
+
applied element by element, shape unchanged).
|
|
92
105
|
|
|
93
106
|
Returns
|
|
94
107
|
-------
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|