combinatory-synthesizer 0.0.1.dev22__tar.gz → 0.0.1.dev29__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.
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/benchmarks.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/build-nightly.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/checks.yml +2 -2
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/pr-rules-develop.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/pr-rules-main.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/PKG-INFO +11 -10
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/README.md +10 -9
- combinatory_synthesizer-0.0.1.dev29/benchmarks/__init__.py +1 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/benchmarks/test_benchmark_maximal_elements.py +26 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/benchmarks/test_benchmark_maze.py +66 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/benchmarks/test_benchmark_maze_contains.py +83 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/benchmarks/test_benchmark_maze_loopfree.py +77 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/index.md +30 -30
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/examples/example_constraints.py +35 -20
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/examples/example_constraints_inline.py +12 -4
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/examples/example_fibonacci.py +18 -17
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/examples/example_fibonacci_linear.py +35 -16
- combinatory_synthesizer-0.0.1.dev29/examples/example_symbolic_regression.py +315 -0
- combinatory_synthesizer-0.0.1.dev29/examples/example_taxonomy.py +79 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/hatch.toml +6 -6
- combinatory_synthesizer-0.0.1.dev22/mkdocs.yml → combinatory_synthesizer-0.0.1.dev29/properdocs.yml +7 -3
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/pyproject.toml +23 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/scripts/gen_example_pages.py +5 -11
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/scripts/gen_reference_pages.py +7 -3
- combinatory_synthesizer-0.0.1.dev29/src/cosy/__init__.py +1 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/_version.py +24 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/__init__.py +2 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/combinatorics.py +26 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/inspector.py +23 -4
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/solution_space.py +611 -37
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/specification_builder.py +79 -49
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/subtypes.py +82 -6
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/synthesizer.py +138 -7
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/tree.py +167 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/types.py +274 -11
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/__init__.py +94 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/evolutionary.py +632 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/fitness.py +238 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/initialisation.py +88 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/mutation.py +128 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/recombination.py +192 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/rng/__init__.py +8 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/rng/factory.py +146 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/evolutionary_algorithms/selection.py +394 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/extensions/__init__.py +8 -0
- combinatory_synthesizer-0.0.1.dev29/src/cosy/extensions/solutions.py +114 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/extensions/visualization/script.js +278 -76
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/extensions/visualize.py +135 -15
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/maestro/__init__.py +2 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/maestro/maestro.py +38 -8
- combinatory_synthesizer-0.0.1.dev29/tests/__init__.py +1 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_combinatorics.py +47 -2
- combinatory_synthesizer-0.0.1.dev29/tests/test_contains_tree.py +133 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_enumerate_artificial_solution_space.py +2 -0
- combinatory_synthesizer-0.0.1.dev29/tests/test_evolutionary.py +388 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_group_underspecification.py +20 -1
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_infinite_enumeration.py +51 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_intersect_arguments.py +3 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_literal_candidates.py +112 -2
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_literal_inference.py +83 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_no_prune.py +38 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/tests/test_overlapping_substitution_inference.py +58 -0
- combinatory_synthesizer-0.0.1.dev29/tests/test_rng_factory.py +341 -0
- combinatory_synthesizer-0.0.1.dev22/tests/test_contains_tree.py → combinatory_synthesizer-0.0.1.dev29/tests/test_tree_operations.py +40 -25
- combinatory_synthesizer-0.0.1.dev22/docs/bibliographies/applications.bib +0 -90
- combinatory_synthesizer-0.0.1.dev22/docs/bibliographies/theory.bib +0 -187
- combinatory_synthesizer-0.0.1.dev22/src/cosy/__init__.py +0 -0
- combinatory_synthesizer-0.0.1.dev22/src/cosy/_version.py +0 -34
- combinatory_synthesizer-0.0.1.dev22/src/cosy/extensions/__init__.py +0 -6
- combinatory_synthesizer-0.0.1.dev22/src/cosy/extensions/solutions.py +0 -52
- combinatory_synthesizer-0.0.1.dev22/tests/__init__.py +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/dependabot.yml +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/check-docs.yml +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/deploy-docs.yml +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/pre-release.yml +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.github/workflows/release.yml +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/.gitignore +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/CITATION.cff +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/LICENSE.txt +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/.overrides/partials/copyright.html +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/about/authors.md +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/assets/badges/mypy.json +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/assets/images/logo.svg +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/examples/introduction.md +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/features/advanced.md +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/features/constraints.md +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/guidelines/best-practice.md +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/guidelines/troubleshoot.md +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/quick-start.md +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/docs/stylesheets/extra.css +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/core/py.typed +0 -0
- {combinatory_synthesizer-0.0.1.dev22 → combinatory_synthesizer-0.0.1.dev29}/src/cosy/extensions/visualization/collapsible_tree.html +0 -0
- /combinatory_synthesizer-0.0.1.dev22/benchmarks/__init__.py → /combinatory_synthesizer-0.0.1.dev29/src/cosy/py.typed +0 -0
|
@@ -12,7 +12,7 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
if: github.ref == 'refs/heads/develop'
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/create-github-app-token@
|
|
15
|
+
- uses: actions/create-github-app-token@v3
|
|
16
16
|
id: tudo-seal-workflow-token
|
|
17
17
|
with:
|
|
18
18
|
app-id: ${{ secrets.TUDO_SEAL_WORKFLOW_CLIENT_ID }}
|
|
@@ -57,7 +57,7 @@ jobs:
|
|
|
57
57
|
|
|
58
58
|
- name: Upload Tests to Codecov
|
|
59
59
|
if: ${{ !cancelled() && !contains( github.head_ref, 'hotfix/')}}
|
|
60
|
-
uses: codecov/codecov-action@
|
|
60
|
+
uses: codecov/codecov-action@v6
|
|
61
61
|
with:
|
|
62
62
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
63
63
|
files: ./report.xml
|
|
@@ -65,7 +65,7 @@ jobs:
|
|
|
65
65
|
flags: ${{ matrix.os }}-${{ matrix.python-version }}
|
|
66
66
|
|
|
67
67
|
- name: Upload Coverage to Codecov
|
|
68
|
-
uses: codecov/codecov-action@
|
|
68
|
+
uses: codecov/codecov-action@v6
|
|
69
69
|
if: ${{ !contains( github.head_ref, 'hotfix/') }}
|
|
70
70
|
with:
|
|
71
71
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: combinatory-synthesizer
|
|
3
|
-
Version: 0.0.1.
|
|
3
|
+
Version: 0.0.1.dev29
|
|
4
4
|
Summary: Type based synthesis framework using inhabitation in FCLP
|
|
5
5
|
Project-URL: Documentation, https://tudo-seal.github.io/cosy/
|
|
6
6
|
Project-URL: Issues, https://github.com/tudo-seal/cosy/issues
|
|
@@ -24,13 +24,13 @@ Description-Content-Type: text/markdown
|
|
|
24
24
|
|
|
25
25
|
<img src="https://raw.githubusercontent.com/tudo-seal/cosy/main/docs/assets/images/logo.svg" alt="CoSy logo" width="400" role="img">
|
|
26
26
|
|
|
27
|
-
| |
|
|
28
|
-
|
|
29
|
-
| Package | [](https://pypi.org/project/combinatory-synthesizer) [](https://pypi.org/project/combinatory-synthesizer)
|
|
30
|
-
| License | [](https://opensource.org/licenses/Apache-2.0)
|
|
31
|
-
| Package | [](https://github.com/tudo-seal/cosy/actions/workflows/checks.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/release.yml)
|
|
32
|
-
| Docs | [](https://github.com/tudo-seal/cosy/actions/workflows/check-docs.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/deploy-docs.yml)
|
|
33
|
-
| Coverage | [](https://pypi.org/project/combinatory-synthesizer) [](https://pypi.org/project/combinatory-synthesizer) |
|
|
30
|
+
| License | [](https://opensource.org/licenses/Apache-2.0) |
|
|
31
|
+
| Package | [](https://github.com/tudo-seal/cosy/actions/workflows/checks.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/release.yml) |
|
|
32
|
+
| Docs | [](https://github.com/tudo-seal/cosy/actions/workflows/check-docs.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/deploy-docs.yml) |
|
|
33
|
+
| Coverage | [](https://codecov.io/github/tudo-seal/cosy/tree/main) [](https://codecov.io/github/tudo-seal/cosy/tree/develop) |
|
|
34
34
|
| Traits | [](https://hatch.pypa.io/latest/) [](http://mypy-lang.org/) [](https://github.com/astral-sh/ruff) |
|
|
35
35
|
|
|
36
36
|
</div>
|
|
@@ -59,11 +59,12 @@ the `Maestro` is sufficient.
|
|
|
59
59
|
|
|
60
60
|
## Examples
|
|
61
61
|
|
|
62
|
-
Examples currently all employ the `Maestro`.
|
|
63
|
-
|
|
64
62
|
- For a simple example for a theoretically minded computer scientist, see: [Fibonacci](https://tudo-seal.github.io/cosy/quick-start/)
|
|
65
63
|
- For a simple example for a practically minded engineer, see: [Robot Arm (WIP)](#)
|
|
66
64
|
|
|
65
|
+
While the examples above use `Maestro`, the following example uses the `Synthesizer`:
|
|
66
|
+
- For a simple example on the usage of evolutionary algorithms for searching the synthesized solution spaces, see: [Symbolic Regression](./examples/example_symbolic_regression.py)
|
|
67
|
+
|
|
67
68
|
|
|
68
69
|
## Installation
|
|
69
70
|
Installation is as simple as running:
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
<img src="https://raw.githubusercontent.com/tudo-seal/cosy/main/docs/assets/images/logo.svg" alt="CoSy logo" width="400" role="img">
|
|
6
6
|
|
|
7
|
-
| |
|
|
8
|
-
|
|
9
|
-
| Package | [](https://pypi.org/project/combinatory-synthesizer) [](https://pypi.org/project/combinatory-synthesizer)
|
|
10
|
-
| License | [](https://opensource.org/licenses/Apache-2.0)
|
|
11
|
-
| Package | [](https://github.com/tudo-seal/cosy/actions/workflows/checks.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/release.yml)
|
|
12
|
-
| Docs | [](https://github.com/tudo-seal/cosy/actions/workflows/check-docs.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/deploy-docs.yml)
|
|
13
|
-
| Coverage | [](https://pypi.org/project/combinatory-synthesizer) [](https://pypi.org/project/combinatory-synthesizer) |
|
|
10
|
+
| License | [](https://opensource.org/licenses/Apache-2.0) |
|
|
11
|
+
| Package | [](https://github.com/tudo-seal/cosy/actions/workflows/checks.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/release.yml) |
|
|
12
|
+
| Docs | [](https://github.com/tudo-seal/cosy/actions/workflows/check-docs.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/deploy-docs.yml) |
|
|
13
|
+
| Coverage | [](https://codecov.io/github/tudo-seal/cosy/tree/main) [](https://codecov.io/github/tudo-seal/cosy/tree/develop) |
|
|
14
14
|
| Traits | [](https://hatch.pypa.io/latest/) [](http://mypy-lang.org/) [](https://github.com/astral-sh/ruff) |
|
|
15
15
|
|
|
16
16
|
</div>
|
|
@@ -39,11 +39,12 @@ the `Maestro` is sufficient.
|
|
|
39
39
|
|
|
40
40
|
## Examples
|
|
41
41
|
|
|
42
|
-
Examples currently all employ the `Maestro`.
|
|
43
|
-
|
|
44
42
|
- For a simple example for a theoretically minded computer scientist, see: [Fibonacci](https://tudo-seal.github.io/cosy/quick-start/)
|
|
45
43
|
- For a simple example for a practically minded engineer, see: [Robot Arm (WIP)](#)
|
|
46
44
|
|
|
45
|
+
While the examples above use `Maestro`, the following example uses the `Synthesizer`:
|
|
46
|
+
- For a simple example on the usage of evolutionary algorithms for searching the synthesized solution spaces, see: [Symbolic Regression](./examples/example_symbolic_regression.py)
|
|
47
|
+
|
|
47
48
|
|
|
48
49
|
## Installation
|
|
49
50
|
Installation is as simple as running:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""_summary_."""
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"""_summary_."""
|
|
1
2
|
# benchmark for the maximal_elements function
|
|
2
3
|
|
|
3
4
|
from random import Random
|
|
@@ -9,21 +10,45 @@ from cosy.core.combinatorics import maximal_elements
|
|
|
9
10
|
|
|
10
11
|
@pytest.fixture
|
|
11
12
|
def elements():
|
|
13
|
+
"""_summary_.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
_type_: _description_
|
|
17
|
+
"""
|
|
12
18
|
bound = 20
|
|
13
19
|
dimension = 10
|
|
14
20
|
count = 500
|
|
15
21
|
rand = Random(0)
|
|
16
22
|
|
|
17
23
|
def random_element() -> tuple[int, ...]:
|
|
24
|
+
"""_summary_.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
tuple[int, ...]: _description_
|
|
28
|
+
"""
|
|
18
29
|
return tuple(rand.randint(0, bound) for _ in range(dimension))
|
|
19
30
|
|
|
20
31
|
return [random_element() for _ in range(count)]
|
|
21
32
|
|
|
22
33
|
|
|
23
34
|
def test_benchmark_maximal_elements(elements, benchmark):
|
|
24
|
-
"""Benchmark maximal_elements function.
|
|
35
|
+
"""Benchmark maximal_elements function.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
elements (_type_): _description_
|
|
39
|
+
benchmark (_type_): _description_
|
|
40
|
+
"""
|
|
25
41
|
|
|
26
42
|
def compare(x, y):
|
|
43
|
+
"""_summary_.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
x (_type_): _description_
|
|
47
|
+
y (_type_): _description_
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
_type_: _description_
|
|
51
|
+
"""
|
|
27
52
|
return all(a <= b for a, b in zip(x, y, strict=False))
|
|
28
53
|
|
|
29
54
|
benchmark(maximal_elements, elements, compare)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""_summary_."""
|
|
2
|
+
|
|
1
3
|
from collections.abc import Callable, Mapping
|
|
2
4
|
from itertools import product
|
|
3
5
|
|
|
@@ -9,6 +11,14 @@ from cosy.core.types import Constructor, DataGroup, Literal, Type, Var
|
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
def is_free(pos: tuple[int, int]) -> bool:
|
|
14
|
+
"""_summary_.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
pos (tuple[int, int]): _description_
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
bool: _description_
|
|
21
|
+
"""
|
|
12
22
|
col, row = pos
|
|
13
23
|
seed = 0
|
|
14
24
|
if row == col:
|
|
@@ -21,19 +31,69 @@ def component_specifications() -> Mapping[
|
|
|
21
31
|
Callable[[tuple[int, int], tuple[int, int], str], str] | str,
|
|
22
32
|
Specification,
|
|
23
33
|
]:
|
|
34
|
+
"""_summary_.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
Mapping[Callable[[tuple[int, int], tuple[int, int], str], str] | str, Specification]: _description_
|
|
38
|
+
"""
|
|
39
|
+
|
|
24
40
|
def up(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
41
|
+
"""_summary_.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
b (tuple[int, int]): _description_
|
|
45
|
+
p (str): _description_
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
str: _description_
|
|
49
|
+
"""
|
|
25
50
|
return f"{p} => UP({b})"
|
|
26
51
|
|
|
27
52
|
def down(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
53
|
+
"""_summary_.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
b (tuple[int, int]): _description_
|
|
57
|
+
p (str): _description_
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
str: _description_
|
|
61
|
+
"""
|
|
28
62
|
return f"{p} => DOWN({b})"
|
|
29
63
|
|
|
30
64
|
def left(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
65
|
+
"""_summary_.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
b (tuple[int, int]): _description_
|
|
69
|
+
p (str): _description_
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
str: _description_
|
|
73
|
+
"""
|
|
31
74
|
return f"{p} => LEFT({b})"
|
|
32
75
|
|
|
33
76
|
def right(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
77
|
+
"""_summary_.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
b (tuple[int, int]): _description_
|
|
81
|
+
p (str): _description_
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
str: _description_
|
|
85
|
+
"""
|
|
34
86
|
return f"{p} => RIGHT({b})"
|
|
35
87
|
|
|
36
88
|
def pos(ab: str) -> Type:
|
|
89
|
+
"""_summary_.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
ab (str): _description_
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Type: _description_
|
|
96
|
+
"""
|
|
37
97
|
return Constructor("pos", Var(ab))
|
|
38
98
|
|
|
39
99
|
int2 = DataGroup("int2", frozenset(filter(is_free, product(range(SIZE), range(SIZE)))))
|
|
@@ -67,6 +127,12 @@ SIZE = 50
|
|
|
67
127
|
|
|
68
128
|
|
|
69
129
|
def test_benchmark_maze(component_specifications, benchmark):
|
|
130
|
+
"""_summary_.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
component_specifications (_type_): _description_
|
|
134
|
+
benchmark (_type_): _description_
|
|
135
|
+
"""
|
|
70
136
|
fin = "pos" @ (Literal((SIZE - 1, SIZE - 1)))
|
|
71
137
|
|
|
72
138
|
synthesizer = Synthesizer(component_specifications)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""_summary_."""
|
|
2
|
+
|
|
1
3
|
from collections.abc import Callable, Mapping
|
|
2
4
|
|
|
3
5
|
import pytest
|
|
@@ -8,6 +10,14 @@ from cosy.core.types import Constructor, Group, Literal, Type, Var
|
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
def is_free(pos: tuple[int, int]) -> bool:
|
|
13
|
+
"""_summary_.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
pos (tuple[int, int]): _description_
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
bool: _description_
|
|
20
|
+
"""
|
|
11
21
|
col, row = pos
|
|
12
22
|
seed = 0
|
|
13
23
|
if row == col:
|
|
@@ -23,26 +33,86 @@ def component_specifications() -> Mapping[
|
|
|
23
33
|
Callable[[tuple[int, int], tuple[int, int], str], str] | str,
|
|
24
34
|
Specification,
|
|
25
35
|
]:
|
|
36
|
+
"""_summary_.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Mapping[Callable[[tuple[int, int], tuple[int, int], str], str] | str, Specification]: _description_
|
|
40
|
+
"""
|
|
41
|
+
|
|
26
42
|
def up(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
43
|
+
"""_summary_.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
b (tuple[int, int]): _description_
|
|
47
|
+
p (str): _description_
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
str: _description_
|
|
51
|
+
"""
|
|
27
52
|
return f"{p} => UP({b})"
|
|
28
53
|
|
|
29
54
|
def down(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
55
|
+
"""_summary_.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
b (tuple[int, int]): _description_
|
|
59
|
+
p (str): _description_
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
str: _description_
|
|
63
|
+
"""
|
|
30
64
|
return f"{p} => DOWN({b})"
|
|
31
65
|
|
|
32
66
|
def left(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
67
|
+
"""_summary_.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
b (tuple[int, int]): _description_
|
|
71
|
+
p (str): _description_
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
str: _description_
|
|
75
|
+
"""
|
|
33
76
|
return f"{p} => LEFT({b})"
|
|
34
77
|
|
|
35
78
|
def right(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
79
|
+
"""_summary_.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
b (tuple[int, int]): _description_
|
|
83
|
+
p (str): _description_
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
str: _description_
|
|
87
|
+
"""
|
|
36
88
|
return f"{p} => RIGHT({b})"
|
|
37
89
|
|
|
38
90
|
def pos(ab: str) -> Type:
|
|
91
|
+
"""_summary_.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
ab (str): _description_
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Type: _description_
|
|
98
|
+
"""
|
|
39
99
|
return Constructor("pos", Var(ab))
|
|
40
100
|
|
|
41
101
|
class Int2(Group):
|
|
102
|
+
"""_summary_."""
|
|
103
|
+
|
|
42
104
|
name = "int2"
|
|
43
105
|
|
|
44
106
|
# represents the set of all free positions
|
|
45
107
|
def __contains__(self, value: object) -> bool:
|
|
108
|
+
"""_summary_.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
value (object): _description_
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
bool: _description_
|
|
115
|
+
"""
|
|
46
116
|
if isinstance(value, tuple):
|
|
47
117
|
x, y = value
|
|
48
118
|
if isinstance(x, int) and isinstance(y, int) and 0 <= x < SIZE and 0 <= y < SIZE and is_free((x, y)):
|
|
@@ -50,7 +120,7 @@ def component_specifications() -> Mapping[
|
|
|
50
120
|
return False
|
|
51
121
|
|
|
52
122
|
def __iter__(self):
|
|
53
|
-
|
|
123
|
+
"""_summary_."""
|
|
54
124
|
|
|
55
125
|
int2 = Int2()
|
|
56
126
|
|
|
@@ -81,9 +151,21 @@ def component_specifications() -> Mapping[
|
|
|
81
151
|
|
|
82
152
|
@pytest.fixture
|
|
83
153
|
def fin():
|
|
154
|
+
"""_summary_.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
_type_: _description_
|
|
158
|
+
"""
|
|
84
159
|
return "pos" @ (Literal((SIZE - 1, SIZE - 1)))
|
|
85
160
|
|
|
86
161
|
|
|
87
162
|
def test_benchmark_maze_contains(component_specifications, fin, benchmark):
|
|
163
|
+
"""_summary_.
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
component_specifications (_type_): _description_
|
|
167
|
+
fin (_type_): _description_
|
|
168
|
+
benchmark (_type_): _description_
|
|
169
|
+
"""
|
|
88
170
|
synthesizer = Synthesizer(component_specifications)
|
|
89
171
|
benchmark(synthesizer.construct_solution_space, fin)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""_summary_."""
|
|
2
|
+
|
|
1
3
|
from collections.abc import Callable, Iterable, Mapping
|
|
2
4
|
from itertools import product
|
|
3
5
|
|
|
@@ -10,6 +12,14 @@ from cosy.core.types import Constructor, DataGroup, Literal, Type, Var
|
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
def is_free(pos: tuple[int, int]) -> bool:
|
|
15
|
+
"""_summary_.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
pos (tuple[int, int]): _description_
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
bool: _description_
|
|
22
|
+
"""
|
|
13
23
|
col, row = pos
|
|
14
24
|
seed = 0
|
|
15
25
|
if row == col:
|
|
@@ -22,22 +32,83 @@ def component_specifications() -> Mapping[
|
|
|
22
32
|
Callable[[tuple[int, int], tuple[int, int], str], str] | str,
|
|
23
33
|
Specification,
|
|
24
34
|
]:
|
|
35
|
+
"""_summary_.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
Mapping[Callable[[tuple[int, int], tuple[int, int], str], str] | str, Specification]: _description_
|
|
39
|
+
"""
|
|
40
|
+
|
|
25
41
|
def up(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
42
|
+
"""_summary_.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
b (tuple[int, int]): _description_
|
|
46
|
+
p (str): _description_
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
str: _description_
|
|
50
|
+
"""
|
|
26
51
|
return f"{p} => UP({b})"
|
|
27
52
|
|
|
28
53
|
def down(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
54
|
+
"""_summary_.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
b (tuple[int, int]): _description_
|
|
58
|
+
p (str): _description_
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
str: _description_
|
|
62
|
+
"""
|
|
29
63
|
return f"{p} => DOWN({b})"
|
|
30
64
|
|
|
31
65
|
def left(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
66
|
+
"""_summary_.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
b (tuple[int, int]): _description_
|
|
70
|
+
p (str): _description_
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
str: _description_
|
|
74
|
+
"""
|
|
32
75
|
return f"{p} => LEFT({b})"
|
|
33
76
|
|
|
34
77
|
def right(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
78
|
+
"""_summary_.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
b (tuple[int, int]): _description_
|
|
82
|
+
p (str): _description_
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
str: _description_
|
|
86
|
+
"""
|
|
35
87
|
return f"{p} => RIGHT({b})"
|
|
36
88
|
|
|
37
89
|
def pos(ab: str) -> Type:
|
|
90
|
+
"""_summary_.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
ab (str): _description_
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Type: _description_
|
|
97
|
+
"""
|
|
38
98
|
return Constructor("pos", Var(ab))
|
|
39
99
|
|
|
40
100
|
def getpath(path: Tree) -> Iterable[tuple[int, int]]:
|
|
101
|
+
"""_summary_.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
path (Tree): _description_
|
|
105
|
+
|
|
106
|
+
Yields:
|
|
107
|
+
tuple[int, int]: _description_
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
TypeError: _description_
|
|
111
|
+
"""
|
|
41
112
|
while path.root != "START":
|
|
42
113
|
position = path.children[0].root
|
|
43
114
|
path = path.children[2]
|
|
@@ -84,6 +155,12 @@ SIZE = 50
|
|
|
84
155
|
|
|
85
156
|
|
|
86
157
|
def test_benchmark_maze_loopfree(component_specifications, benchmark):
|
|
158
|
+
"""_summary_.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
component_specifications (_type_): _description_
|
|
162
|
+
benchmark (_type_): _description_
|
|
163
|
+
"""
|
|
87
164
|
fin = "pos" @ (Literal((SIZE - 1, SIZE - 1)))
|
|
88
165
|
|
|
89
166
|
synthesizer = Synthesizer(component_specifications)
|