MATE-runtime 1.1.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.
Files changed (95) hide show
  1. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/PKG-INFO +2 -2
  2. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/pyproject.toml +2 -2
  3. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/axes.py +6 -2
  4. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/calendar.py +19 -1
  5. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/canonical.py +9 -8
  6. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/conformance/checks.py +18 -8
  7. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/conformance/sampler.py +18 -6
  8. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/declarations.py +22 -4
  9. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/.gitignore +0 -0
  10. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/COPYING +0 -0
  11. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/COPYING.LESSER +0 -0
  12. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/README.md +0 -0
  13. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/__init__.py +0 -0
  14. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/__main__.py +0 -0
  15. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/cli/__init__.py +0 -0
  16. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/cli/commands.py +0 -0
  17. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/cli/workdir.py +0 -0
  18. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/compat/__init__.py +0 -0
  19. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/compat/interface.py +0 -0
  20. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/compat/sizes.py +0 -0
  21. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/__init__.py +0 -0
  22. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/builders.py +0 -0
  23. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/criteria.py +0 -0
  24. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/events.py +0 -0
  25. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/invariance.py +0 -0
  26. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/loader.py +0 -0
  27. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/model.py +0 -0
  28. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/resolve.py +0 -0
  29. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/runtable.py +0 -0
  30. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/seeds.py +0 -0
  31. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/stages.py +0 -0
  32. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/structure.py +0 -0
  33. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/config/toml.py +0 -0
  34. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/conformance/__init__.py +0 -0
  35. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/conformance/baseline.py +0 -0
  36. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/errors.py +0 -0
  37. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/evaluation/__init__.py +0 -0
  38. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/evaluation/budget.py +0 -0
  39. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/evaluation/invalids.py +0 -0
  40. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/evaluation/requests.py +0 -0
  41. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/__init__.py +0 -0
  42. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/accelerator.py +0 -0
  43. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/base.py +0 -0
  44. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/choose.py +0 -0
  45. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/devices.py +0 -0
  46. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/process.py +0 -0
  47. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/serial.py +0 -0
  48. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/thread.py +0 -0
  49. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/execution/vectorised.py +0 -0
  50. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/launch.py +0 -0
  51. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/loop/__init__.py +0 -0
  52. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/loop/continuous.py +0 -0
  53. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/loop/driver.py +0 -0
  54. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/loop/events.py +0 -0
  55. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/loop/generational.py +0 -0
  56. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/loop/owns_loop.py +0 -0
  57. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/loop/subpops.py +0 -0
  58. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/modules/__init__.py +0 -0
  59. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/modules/construct.py +0 -0
  60. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/modules/discovery.py +0 -0
  61. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/modules/registry.py +0 -0
  62. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/modules/software.py +0 -0
  63. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/modules/versions.py +0 -0
  64. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/numerics.py +0 -0
  65. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/observation/__init__.py +0 -0
  66. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/observation/control.py +0 -0
  67. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/observation/display.py +0 -0
  68. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/observation/hub.py +0 -0
  69. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/observation/records.py +0 -0
  70. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/observation/sinks.py +0 -0
  71. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/provenance.py +0 -0
  72. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/readout/__init__.py +0 -0
  73. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/readout/catalogue.py +0 -0
  74. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/readout/front.py +0 -0
  75. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/readout/readout.py +0 -0
  76. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/readout/series.py +0 -0
  77. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/readout/statistics.py +0 -0
  78. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/__init__.py +0 -0
  79. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/checkpointing.py +0 -0
  80. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/contexts.py +0 -0
  81. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/plan.py +0 -0
  82. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/preconditions.py +0 -0
  83. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/record.py +0 -0
  84. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/run.py +0 -0
  85. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/specs.py +0 -0
  86. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/run/times.py +0 -0
  87. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/scheduling/__init__.py +0 -0
  88. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/scheduling/local.py +0 -0
  89. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/scheduling/slurm.py +0 -0
  90. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/storage/__init__.py +0 -0
  91. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/storage/checkpoint.py +0 -0
  92. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/storage/codec.py +0 -0
  93. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/storage/database.py +0 -0
  94. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/storage/lease.py +0 -0
  95. {mate_runtime-1.1.0 → mate_runtime-1.3.0}/src/MATE/storage/rundir.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: MATE-runtime
3
- Version: 1.1.0
3
+ Version: 1.3.0
4
4
  Summary: Runtime of MATE, the Modular Algorithmic Toolkit for Evolution: runs, records and replays artificial evolution experiments
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.1
18
+ Requires-Dist: mate-contract<2,>=1.3
19
19
  Requires-Dist: packaging>=24
20
20
  Requires-Dist: rich>=13.7
21
21
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "MATE-runtime"
7
- version = "1.1.0"
7
+ version = "1.3.0"
8
8
  description = "Runtime of MATE, the Modular Algorithmic Toolkit for Evolution: runs, records and replays artificial evolution experiments"
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.1,<2", "packaging>=24", "rich>=13.7"]
24
+ dependencies = ["MATE-contract>=1.3,<2", "packaging>=24", "rich>=13.7"]
25
25
 
26
26
  [project.scripts]
27
27
  MATE = "MATE.cli:main"
@@ -10,6 +10,7 @@ from dataclasses import dataclass
10
10
  from types import MappingProxyType
11
11
  from typing import Literal
12
12
 
13
+ import numpy as np
13
14
  from MATE_contract import Categorical, Domain, Integer, Key, Ordinal
14
15
 
15
16
  from MATE.config import seeds
@@ -182,7 +183,10 @@ def parse_sweep(sweep: Mapping, *, stage: str | None) -> tuple[list[Axis], list[
182
183
 
183
184
 
184
185
  def _label(x: object, domain: Domain) -> Value:
185
- """A drawn element as written in a protocol: labels for categories (R6.10)."""
186
+ """A drawn element as written in a protocol: labels for categories (R6.10), a tuple of
187
+ floats for a vector."""
188
+ if domain.element_shape:
189
+ return tuple(float(c) for c in np.asarray(x).ravel())
186
190
  if isinstance(domain, (Ordinal, Categorical)):
187
191
  return domain.values[int(x)]
188
192
  if isinstance(domain, Integer):
@@ -207,7 +211,7 @@ def sampled_values(axis: Axis, domain: Domain, root_seed: int) -> tuple[Value, .
207
211
  tuple of Value
208
212
  ``axis.sample`` values; draw ``i`` is ``domain.sample(Key(axis_seed(root_seed,
209
213
  stage, path, i)).rng(), 1)``, written as a label for ``Ordinal`` and
210
- ``Categorical`` (R16.11).
214
+ ``Categorical``, as a tuple of floats for a vector domain (R16.11).
211
215
 
212
216
  Raises
213
217
  ------
@@ -168,8 +168,12 @@ def _normalise(value: object, domain: Domain, *, point: bool = True
168
168
  """Normalise one written value in its domain (R6.10); return (value, error).
169
169
 
170
170
  A point of a periodic ``Real`` written at ``hi`` becomes ``lo``. ``point=False`` keeps it
171
- for an end of a linear pair, which bounds a path: ``[lo, hi]`` is a full turn.
171
+ for an end of a linear pair, which bounds a path: ``[lo, hi]`` is a full turn. A value of a
172
+ vector domain (``UnitVector``, a setting or a meta-parameter) is written as a list of
173
+ numbers and normalised to a tuple of floats.
172
174
  """
175
+ if domain.element_shape:
176
+ return _vector(value, domain)
173
177
  if isinstance(domain, (Ordinal, Categorical)):
174
178
  for label in domain.values:
175
179
  if (isinstance(value, bool) == isinstance(label, bool) and type(value) is not tuple
@@ -188,6 +192,20 @@ def _normalise(value: object, domain: Domain, *, point: bool = True
188
192
  return (_on_circle(value, domain) if point else value), None
189
193
 
190
194
 
195
+ def _vector(value: object, domain: Domain) -> tuple[Value, str | None]:
196
+ """Normalise a written vector: a list of numbers, one per component, as floats."""
197
+ (d,) = domain.element_shape
198
+ if (not isinstance(value, (list, tuple))
199
+ or any(isinstance(c, bool) or not isinstance(c, (int, float)) for c in value)):
200
+ return value, f"{value!r} is not a list of {d} numbers"
201
+ if len(value) != d:
202
+ return value, f"{list(value)!r} has {len(value)} components, {domain!r} takes {d}"
203
+ vector = tuple(float(c) for c in value)
204
+ if not bool(domain.contains(np.asarray(vector))):
205
+ return value, f"{list(value)!r} is outside {domain!r}"
206
+ return vector, None
207
+
208
+
191
209
  def build_calendar(decl: EnvironmentDecl, spec: EnvironmentSpec, *, clock: str | None,
192
210
  dated: bool) -> tuple["Calendar | None", list[Refusal]]:
193
211
  """Check a calendar against the system's environment spec and build it.
@@ -15,7 +15,7 @@ from types import MappingProxyType
15
15
  from typing import TYPE_CHECKING, Any
16
16
 
17
17
  import numpy as np
18
- from MATE_contract import Real
18
+ from MATE_contract import NetworkSpec, Real
19
19
 
20
20
  if TYPE_CHECKING: # model imports this module; annotations are evaluated lazily
21
21
  from MATE.config.model import Value
@@ -387,9 +387,10 @@ def digest(value: Value) -> str:
387
387
  return hashlib.sha256(_encode(tag(value))).hexdigest()
388
388
 
389
389
 
390
- # Fields written only when they differ from their default, as the type's repr shows them: a spec
391
- # that does not use one keeps the plain form, hence the digest, it has without it.
392
- _WRITTEN_WHEN_SET: Mapping[type, tuple[str, ...]] = MappingProxyType({Real: ("periodic",)})
390
+ # Fields written only when they differ from their default: a spec that does not use one keeps
391
+ # the plain form, hence the digest, it had before the field existed.
392
+ _WRITTEN_WHEN_SET: Mapping[type, tuple[str, ...]] = MappingProxyType(
393
+ {Real: ("periodic",), NetworkSpec: ("sink_outputs",)})
393
394
 
394
395
 
395
396
  def plain(obj: object) -> Value:
@@ -405,10 +406,10 @@ def plain(obj: object) -> Value:
405
406
  -------
406
407
  Value
407
408
  Dataclasses become ``{"__type__": name, field: ...}``, except that ``Real`` writes
408
- ``periodic`` only when it is true; arrays ``{"__array__": (dtype.str, shape, flat
409
- values)}``; enum members ``{"__enum__": "Class.NAME"}``; mappings tuples of
410
- ``(key, value)`` pairs, in insertion order; sequences tuples; numpy scalars Python
411
- scalars.
409
+ ``periodic`` and ``NetworkSpec`` ``sink_outputs`` only when it is true; arrays
410
+ ``{"__array__": (dtype.str, shape, flat values)}``; enum members ``{"__enum__":
411
+ "Class.NAME"}``; mappings tuples of ``(key, value)`` pairs, in insertion order;
412
+ sequences tuples; numpy scalars Python scalars.
412
413
 
413
414
  Raises
414
415
  ------
@@ -32,7 +32,6 @@ from MATE_contract import (
32
32
  Integer,
33
33
  Invalid,
34
34
  Key,
35
- Log,
36
35
  Method,
37
36
  Network,
38
37
  NetworkSpec,
@@ -238,9 +237,10 @@ def _point_value(domain: Domain, rng: np.random.Generator) -> object:
238
237
 
239
238
 
240
239
  def _contains(domain: Domain, value: object) -> bool:
241
- """Whether a scalar observable value lies in its domain."""
240
+ """Whether an observable value is one element of its domain: a scalar, or a vector of a
241
+ vector domain."""
242
242
  try:
243
- return bool(np.ndim(value) == 0 and np.all(domain.contains(value)))
243
+ return bool(np.shape(value) == domain.element_shape and np.all(domain.contains(value)))
244
244
  except Exception:
245
245
  return False
246
246
 
@@ -318,14 +318,18 @@ def _bounded(entry: object) -> tuple[Domain, tuple[int, ...]] | None:
318
318
 
319
319
  def _kind_ok(domain: Domain, arr: np.ndarray) -> bool:
320
320
  """V3: dtype of the domain's kind."""
321
- if isinstance(domain, (Real, Log)):
321
+ if domain.dtype.kind == "f":
322
322
  return arr.dtype.kind == "f"
323
323
  return arr.dtype.kind in "iu"
324
324
 
325
325
 
326
326
  def _array_violations(where: str, decls: Mapping[str, object], arrays: Mapping[str, np.ndarray],
327
327
  filled: Mapping[str, np.ndarray] | None, lead: tuple[int, ...]) -> list[str]:
328
- """V2-V4 for the arrays of one organ."""
328
+ """V2-V4 for the arrays of one organ.
329
+
330
+ An array holds ``lead + shape + element_shape``. Membership is one result per element; an
331
+ element is checked where any of its cells is marked filled.
332
+ """
329
333
  found: list[str] = []
330
334
  bounded = {k: b for k, e in decls.items() if (b := _bounded(e)) is not None}
331
335
  if set(arrays) != set(bounded):
@@ -335,9 +339,9 @@ def _array_violations(where: str, decls: Mapping[str, object], arrays: Mapping[s
335
339
  if name not in arrays:
336
340
  continue
337
341
  arr = np.asarray(arrays[name])
338
- if arr.shape != (*lead, *shape):
339
- found.append(f"{where}['{name}']: shape {arr.shape}, expected {(*lead, *shape)} "
340
- "([K] V3)")
342
+ expected = (*lead, *shape, *domain.element_shape)
343
+ if arr.shape != expected:
344
+ found.append(f"{where}['{name}']: shape {arr.shape}, expected {expected} ([K] V3)")
341
345
  continue
342
346
  if not _kind_ok(domain, arr):
343
347
  found.append(f"{where}['{name}']: dtype {arr.dtype} does not fit {domain!r} ([K] V3)")
@@ -345,6 +349,9 @@ def _array_violations(where: str, decls: Mapping[str, object], arrays: Mapping[s
345
349
  mask = np.ones(arr.shape, dtype=bool)
346
350
  if filled is not None and name in filled:
347
351
  mask = np.asarray(filled[name], dtype=bool)
352
+ if domain.element_shape:
353
+ axes = tuple(range(arr.ndim - len(domain.element_shape), arr.ndim))
354
+ mask = np.any(mask, axis=axes)
348
355
  inside = np.asarray(domain.contains(arr), dtype=bool)
349
356
  if not np.all(inside | ~mask):
350
357
  found.append(f"{where}['{name}']: values outside {domain!r} ([K] V4, V6)")
@@ -396,6 +403,9 @@ def _network_violations(where: str, organ: Network, spec: NetworkSpec,
396
403
  found.append(f"{where}: {hidden} hidden nodes, the spec fixes {bound} ([K] V5)")
397
404
  if not spec.recurrent and not _acyclic(n, edges):
398
405
  found.append(f"{where}: a cycle in a network declared recurrent = False ([K] V5)")
406
+ if spec.sink_outputs and np.any((edges[:, 0] >= n_in) & (edges[:, 0] < n_in + n_out)):
407
+ found.append(f"{where}: an edge leaves an output node in a network declared "
408
+ "sink_outputs = True ([K] V5)")
399
409
  found += _array_violations(f"{where}.node_attrs", spec.node_attributes, organ.node_attrs,
400
410
  organ.filled, (n,))
401
411
  found += _array_violations(f"{where}.edge_attrs", spec.edge_attributes, organ.edge_attrs,
@@ -48,8 +48,11 @@ def _bounded(entry: object) -> tuple[Domain, tuple[int, ...]] | None:
48
48
 
49
49
 
50
50
  def _draw(domain: Domain, shape: tuple[int, ...], key: Key) -> np.ndarray:
51
- """Draw an array of ``shape`` from ``domain`` on ``key``'s stream."""
52
- return domain.sample(key.rng(), math.prod(shape)).reshape(shape)
51
+ """Draw an array of ``shape`` elements from ``domain`` on ``key``'s stream.
52
+
53
+ The array has the shape ``shape + domain.element_shape``.
54
+ """
55
+ return domain.sample(key.rng(), math.prod(shape)).reshape((*shape, *domain.element_shape))
53
56
 
54
57
 
55
58
  def _params(name: str, spec: ParamsSpec, key: Key) -> Params:
@@ -89,6 +92,8 @@ def _network(name: str, spec: NetworkSpec, key: Key) -> Network:
89
92
  # Node layout of the ordering convention ([K] §5.2): inputs, outputs, then hidden nodes.
90
93
  sources, targets = np.meshgrid(np.arange(n), np.arange(n), indexing="ij")
91
94
  admissible = (sources != targets) & (targets >= n_in)
95
+ if spec.sink_outputs:
96
+ admissible &= (sources < n_in) | (sources >= n_in + n_out)
92
97
  if not spec.recurrent:
93
98
  rank = np.empty(n, dtype=np.int64)
94
99
  rank[rng.permutation(n)] = np.arange(n)
@@ -132,8 +137,9 @@ def sample_phenotype(spec: PhenotypeSpec, key: Key) -> Phenotype:
132
137
  hidden count is drawn uniformly in a bounded ``number_of_hidden_nodes`` (taken as is when
133
138
  fixed, 0 when ``None``) on ``key.child(organ, 0).rng()``; on the same stream, when
134
139
  ``recurrent`` is false, a random node order; then each ordered pair of distinct nodes whose
135
- target is not an input node (and, when acyclic, whose source precedes its target in that
136
- order) carries an edge with probability ``EDGE_PROBABILITY``. Nodes are numbered inputs,
140
+ target is not an input node (when ``sink_outputs``, whose source is not an output node;
141
+ when acyclic, whose source precedes its target in that order) carries an edge with
142
+ probability ``EDGE_PROBABILITY``. Nodes are numbered inputs,
137
143
  outputs, then hidden nodes (the ordering convention of ``Network``); edges are ``(E, 2)``,
138
144
  in row-major order of their (source, target).
139
145
  """
@@ -156,7 +162,9 @@ def reference_specs() -> list[PhenotypeSpec]:
156
162
  list of PhenotypeSpec
157
163
  A single ``self`` ``ParamsSpec`` with one field of each domain kind (and one fixed
158
164
  field); a single ``self`` acyclic XOR-like ``NetworkSpec`` with a bounded
159
- ``number_of_hidden_nodes``; the same network, recurrent and without bound.
165
+ ``number_of_hidden_nodes``; the same network, recurrent and without bound; a recurrent
166
+ network with two outputs that feed nothing (``sink_outputs``) and a bounded
167
+ ``number_of_hidden_nodes``.
160
168
 
161
169
  Notes
162
170
  -----
@@ -176,4 +184,8 @@ def reference_specs() -> list[PhenotypeSpec]:
176
184
  node_attributes=nodes, edge_attributes=edges, recurrent=False)
177
185
  unbounded = NetworkSpec(inputs=("a", "b"), outputs=("y",), node_attributes=nodes,
178
186
  edge_attributes=edges, recurrent=True)
179
- return [PhenotypeSpec(params), PhenotypeSpec(bounded), PhenotypeSpec(unbounded)]
187
+ sink = NetworkSpec(inputs=("a", "b"), outputs=("y", "z"), number_of_hidden_nodes=Integer(0, 4),
188
+ node_attributes=nodes, edge_attributes=edges, recurrent=True,
189
+ sink_outputs=True)
190
+ return [PhenotypeSpec(params), PhenotypeSpec(bounded), PhenotypeSpec(unbounded),
191
+ PhenotypeSpec(sink)]
@@ -90,6 +90,19 @@ def _prefixed(
90
90
  return out
91
91
 
92
92
 
93
+ def _vector_series(
94
+ declared: Mapping[str, object], kind: str, name: str, what: str
95
+ ) -> list[Refusal]:
96
+ """``P-SERIES-VECTOR`` for each series or summary of a vector domain ([K] OB4b)."""
97
+ return [
98
+ Refusal("P-SERIES-VECTOR", f"{kind} '{name}'",
99
+ f"{kind} '{name}': {what} '{key}' takes {domain!r}, a vector domain; series and "
100
+ "summaries are scalars (only a descriptor may take a vector domain)")
101
+ for key, domain in declared.items()
102
+ if getattr(domain, "element_shape", ())
103
+ ]
104
+
105
+
93
106
  def check_system(system: System, *, name: str) -> list[Refusal]:
94
107
  """Check what a system declares about itself.
95
108
 
@@ -178,11 +191,12 @@ def check_method(method: Method, *, name: str) -> list[Refusal]:
178
191
  ``P-CAPABILITY-METHOD`` for a level-2 flag without its method, or a level-1 method not
179
192
  implemented; ``P-ALLOCATION`` for ``allocation = True``; ``P-RESERVED-NAME`` for a
180
193
  meta-parameter named ``module`` or ``role``; ``P-RESERVED-PREFIX`` for a series or
181
- summary named ``method.<...>``.
194
+ summary named ``method.<...>``; ``P-SERIES-VECTOR`` for a series or summary of a vector
195
+ domain (``UnitVector``).
182
196
 
183
197
  Notes
184
198
  -----
185
- [K] CP1, CP3, CP4, CP5, OB7, §10 R3, R14, R16, R17; [C] R6.12. ``P-ALLOCATION`` is
199
+ [K] CP1, CP3, CP4, CP5, OB4b, OB7, §10 R3, R14, R16, R17; [C] R6.12. ``P-ALLOCATION`` is
186
200
  produced here only (design §3.5).
187
201
  """
188
202
  where = f"method '{name}'"
@@ -215,8 +229,12 @@ def check_method(method: Method, *, name: str) -> list[Refusal]:
215
229
  "by the method is not available in MATE 1.0.0: its interface is not "
216
230
  "yet specified"))
217
231
  out += _reserved(meta, ("module", "role"), "method", name, "meta-parameter")
218
- out += _prefixed(getattr(method, "series", {}) or {}, _METHOD_PREFIXES, "method", name)
219
- out += _prefixed(getattr(method, "summaries", {}) or {}, _METHOD_PREFIXES, "method", name)
232
+ series = getattr(method, "series", {}) or {}
233
+ summaries = getattr(method, "summaries", {}) or {}
234
+ out += _prefixed(series, _METHOD_PREFIXES, "method", name)
235
+ out += _prefixed(summaries, _METHOD_PREFIXES, "method", name)
236
+ out += _vector_series(series, "method", name, "series")
237
+ out += _vector_series(summaries, "method", name, "summary")
220
238
  return out
221
239
 
222
240
 
File without changes
File without changes
File without changes