FastMcsplit 0.0.1__tar.gz → 0.0.2__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.
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/MANIFEST.in +1 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/PKG-INFO +3 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/README.md +17 -18
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/args/ParseArgs.hpp +1 -9
- fastmcsplit-0.0.2/docs/pypi.md +81 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/docs/testpypi.md +2 -12
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/R1.hpp +2 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/R2.hpp +2 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/R4.hpp +2 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/SearchMatching.hpp +23 -154
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/pyproject.toml +2 -2
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/FastMcsplit.egg-info/PKG-INFO +3 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/FastMcsplit.egg-info/SOURCES.txt +1 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/README.md +1 -2
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/fastmcsplit/__init__.py +1 -1
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/fastmcsplit/api.py +1 -2
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/native.cpp +1 -1
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/tests/test_python_api.py +5 -3
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/EdgeAttr.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Graph.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/GreedySearchMatching.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Node.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/NodeAttr.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/NodeClasses/NodeClass.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/NodeClasses/NodeClassCompute.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/NodeNeighbor.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Parser/ParseCSVFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Parser/ParseFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Parser/ParseGFUFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Parser/ParseGRFFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Parser/ParseLADFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Parser/Parser.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/R3.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/R5.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/R6.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/R8.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/Reductions/r_utils.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/define.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/time_utils.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/header/utils.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/FastMcsplit.egg-info/dependency_links.txt +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/FastMcsplit.egg-info/requires.txt +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/python/FastMcsplit.egg-info/top_level.txt +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/setup.cfg +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.2}/setup.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: FastMcsplit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: Native C++ maximum common induced subgraph solver for Python and NetworkX
|
|
5
5
|
Author: Wilfried Agbeto, Camille Coti, Vladimir Reinharz
|
|
6
|
-
Classifier: Development Status ::
|
|
6
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: Programming Language :: C++
|
|
9
9
|
Classifier: Operating System :: MacOS
|
|
@@ -122,8 +122,7 @@ The same keyword options work with all three interfaces.
|
|
|
122
122
|
Reward names: `capacity_diversity` (1), `pair_diversity` (2), `class_count` (3),
|
|
123
123
|
`combined_diversity` (4).
|
|
124
124
|
|
|
125
|
-
Heuristic names: `reward_degree` (0), `reward_pressure` (1)
|
|
126
|
-
`exploration_degree` (2), `exploration_pressure` (3).
|
|
125
|
+
Heuristic names: `reward_degree` (0), `reward_pressure` (1).
|
|
127
126
|
|
|
128
127
|
See the [C++ documentation][solver] for their behavior. Approximate mode skips
|
|
129
128
|
exact-search reductions and reward/adaptation settings; disabling reductions
|
|
@@ -4,14 +4,23 @@ FastMcSplit is a C++ solver for the **Maximum Common Induced Subgraph (MCIS)** p
|
|
|
4
4
|
|
|
5
5
|
## Authors
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Wilfried Agbeto, Camille Coti, and Vladimir Reinharz.
|
|
8
8
|
|
|
9
9
|
## Python library
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
We also provide [`FastMcsplit`](https://pypi.org/project/FastMcsplit/), a Python
|
|
12
|
+
package available on PyPI that exposes FastMcSplit's C++ implementation directly
|
|
13
|
+
in Python through CPython bindings.
|
|
14
|
+
|
|
15
|
+
It supports NetworkX graphs, CSV data, and graph files, with exact and approximate
|
|
16
|
+
search modes using the native C++ solver.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install FastMcsplit
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
See the [Python API documentation](python/README.md) for examples and available
|
|
23
|
+
options.
|
|
15
24
|
|
|
16
25
|
## Installation
|
|
17
26
|
|
|
@@ -59,7 +68,7 @@ The program prints the best mapping as `(pattern_vertex, target_vertex)` pairs.
|
|
|
59
68
|
| `-W, --without-rules RULES` | All CLI reduction rules are enabled by default. Disable selected rules, for example `-W 'R1\|R4'`. |
|
|
60
69
|
| `-R, --reward_strategy ID` | Select fixed reward strategy 1–4 (see below). By default, no reward bonus is applied. |
|
|
61
70
|
| `-A, --adaptive-reward` | Cycle through reward strategies 1–4 (see below). Disabled by default. |
|
|
62
|
-
| `-h, --heuristic ID` | Select vertex-ordering heuristic 1
|
|
71
|
+
| `-h, --heuristic ID` | Select vertex-ordering heuristic 0 or 1 (see below). The default is 0. |
|
|
63
72
|
| `-C, --connected` | Search for a connected common induced subgraph. Disabled by default. |
|
|
64
73
|
| `-B, --big-first` | Try large solution sizes first. Disabled by default. |
|
|
65
74
|
| `-g, --greedy` | Run the greedy heuristic before the exact search. Disabled by default. |
|
|
@@ -108,7 +117,7 @@ Disabled by default. With `-A`, the solver starts from the strategy supplied by
|
|
|
108
117
|
|
|
109
118
|
### Vertex-ordering heuristics (`-h`)
|
|
110
119
|
|
|
111
|
-
The default is heuristic 0; `-h` accepts
|
|
120
|
+
The default is heuristic 0; `-h` accepts 0 or 1. These heuristics apply to sparse, unlabelled target graphs. Dense targets (density greater than 0.5) and labelled instances use dedicated orderings. The solver can also prioritize a remaining vertex equivalent to the last matched pattern vertex before applying these orderings.
|
|
112
121
|
|
|
113
122
|
Otherwise, the solver first considers active bidomains minimizing $\max(|P_C|,|T_C|)$. Within those bidomains, it selects a pattern vertex using the following criteria, in priority order:
|
|
114
123
|
|
|
@@ -116,19 +125,9 @@ Otherwise, the solver first considers active bidomains minimizing $\max(|P_C|,|T
|
|
|
116
125
|
|---|---|
|
|
117
126
|
| `0` (default) | Highest accumulated reward score, then highest degree, then smallest vertex ID. |
|
|
118
127
|
| `1` | Highest accumulated reward score, then highest degree, then most neighbours touched by current matches, then largest bidomain index and vertex ID. |
|
|
119
|
-
| `2` | Highest exploration score, then highest degree, then smallest vertex ID. |
|
|
120
|
-
| `3` | Highest exploration score, then highest degree, then most neighbours touched by current matches, then largest bidomain index and vertex ID. |
|
|
121
|
-
|
|
122
|
-
Heuristics 2 and 3 use:
|
|
123
|
-
|
|
124
|
-
$$
|
|
125
|
-
S(u)=g(u)+2\sqrt{\frac{\log(K+2)}{c(u)+1}}-0.1c(u),
|
|
126
|
-
$$
|
|
127
|
-
|
|
128
|
-
where $g(u)$ is the accumulated reward score, $K$ is the total number of recorded pattern-vertex selections, and $c(u)$ is the usage counter for $u$. The square-root term encourages exploration, while the last term penalizes frequent reuse. When a selected vertex improves the best solution, its usage counter is halved.
|
|
129
128
|
|
|
130
129
|
```bash
|
|
131
|
-
./build/bin/Release/FastMcSplit -F ulad -R 4 -h
|
|
130
|
+
./build/bin/Release/FastMcSplit -F ulad -R 4 -h 1 p.txt t.txt
|
|
132
131
|
```
|
|
133
132
|
|
|
134
133
|
## File formats
|
|
@@ -145,18 +145,10 @@ Options:\n\
|
|
|
145
145
|
(density > 0.5) ignore this option and use: smallest pattern degree, then\n\
|
|
146
146
|
smallest neighbor-degree sum. Labelled sparse graphs use their dedicated\n\
|
|
147
147
|
labelled ordering.\n\
|
|
148
|
-
Accepted values are
|
|
148
|
+
Accepted values are 0 and 1. If -h is omitted, heuristic 0 is used.\n\
|
|
149
149
|
heuristic 0: highest p_vgrade, then highest degree, then smallest id\n\
|
|
150
150
|
heuristic 1: highest p_vgrade, then highest degree, then highest\n\
|
|
151
151
|
matched-neighbor pressure p_deg_m, then largest class/id\n\
|
|
152
|
-
heuristic 2: highest effective score, then highest degree, then\n\
|
|
153
|
-
smallest id\n\
|
|
154
|
-
heuristic 3: highest effective score, then highest degree, then highest\n\
|
|
155
|
-
matched-neighbor pressure p_deg_m, then largest class/id\n\
|
|
156
|
-
effective score = p_vgrade + 2.0*sqrt(log(total_choices+2)/(uses+1))\n\
|
|
157
|
-
- 0.1*uses\n\
|
|
158
|
-
If a selected variable improves the best solution, its use counter is\n\
|
|
159
|
-
halved.\n\
|
|
160
152
|
\n\
|
|
161
153
|
-C, --connected\n\
|
|
162
154
|
Restrict the search to connected expansions after the first matched node.\n\
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Publish a new FastMcsplit release to PyPI
|
|
2
|
+
|
|
3
|
+
Run all commands from the repository root. The examples below use `0.0.2`;
|
|
4
|
+
replace it with the version you want to publish in both files and commands.
|
|
5
|
+
Use a new version number for each release: PyPI does not allow replacing files
|
|
6
|
+
that have already been published.
|
|
7
|
+
|
|
8
|
+
These commands use the existing `.venv-package` environment. For initial setup,
|
|
9
|
+
see [local validation](testpypi.md#local-validation). Building requires Python
|
|
10
|
+
3.10 or later and a C++17 compiler on Linux or macOS.
|
|
11
|
+
|
|
12
|
+
## 1. Update the version
|
|
13
|
+
|
|
14
|
+
In `pyproject.toml`, update the version under `[project]`:
|
|
15
|
+
|
|
16
|
+
```toml
|
|
17
|
+
version = "0.0.2"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
In `python/fastmcsplit/__init__.py`, set the same version:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
__version__ = "0.0.2"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Update any version-specific examples in the documentation as needed.
|
|
27
|
+
|
|
28
|
+
## 2. Rebuild the native extension and run the tests
|
|
29
|
+
|
|
30
|
+
Force recompilation so changes to C++ headers are included before testing:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
.venv-package/bin/python setup.py build_ext --inplace --force
|
|
34
|
+
.venv-package/bin/python -m pytest -q
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Continue only if the tests pass.
|
|
38
|
+
|
|
39
|
+
## 3. Build and check the distribution archives
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
.venv-package/bin/python -m build --outdir dist/0.0.2
|
|
43
|
+
.venv-package/bin/python -m twine check dist/0.0.2/*
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The build creates a source archive and a wheel for the current Python version
|
|
47
|
+
and platform. Keep each release in its own directory to avoid uploading older
|
|
48
|
+
archives accidentally. Continue only if Twine's checks pass.
|
|
49
|
+
|
|
50
|
+
## 4. Upload to PyPI
|
|
51
|
+
|
|
52
|
+
Use an API token created on https://pypi.org/. PyPI and TestPyPI have separate
|
|
53
|
+
accounts and tokens.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
.venv-package/bin/python -m twine upload \
|
|
57
|
+
--repository pypi --username __token__ \
|
|
58
|
+
dist/0.0.2/*
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Enter your PyPI API token when Twine prompts for it. The command above publishes
|
|
62
|
+
to the main PyPI index. Twine prints the release's project URL after uploading.
|
|
63
|
+
|
|
64
|
+
## 5. Update an installed package
|
|
65
|
+
|
|
66
|
+
Users can install the latest release with:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python3 -m pip install --upgrade FastMcsplit
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
To install this specific release:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python3 -m pip install FastMcsplit==0.0.2
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Repeat these steps with a new version, such as `0.0.3`, for the next release.
|
|
79
|
+
|
|
80
|
+
See the official [Python packaging guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
|
81
|
+
and [PyPI publishing troubleshooting](https://docs.pypi.org/publishing/troubleshooting/).
|
|
@@ -59,15 +59,5 @@ Follow the official [TestPyPI guide](https://packaging.python.org/en/latest/guid
|
|
|
59
59
|
|
|
60
60
|
## Publish to PyPI
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
python -m twine upload --repository pypi --username __token__ dist/0.0.1/*
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Enter the PyPI API token when Twine prompts for it. Once published, install with:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
python -m pip install FastMcsplit==0.0.1
|
|
73
|
-
```
|
|
62
|
+
Follow the [PyPI release guide](pypi.md) to update the version, rebuild and test
|
|
63
|
+
the package, check the archives, and upload a new release to the main index.
|
|
@@ -6,8 +6,8 @@ namespace FastMcSplit::Reductions
|
|
|
6
6
|
{
|
|
7
7
|
/**
|
|
8
8
|
* @class R1
|
|
9
|
-
* @brief FR: Implementation de la reduction R1
|
|
10
|
-
* EN: Implementation of reduction R1
|
|
9
|
+
* @brief FR: Implementation de la reduction R1.
|
|
10
|
+
* EN: Implementation of reduction R1.
|
|
11
11
|
*
|
|
12
12
|
* FR: R1 est appliquee apres le partitionnement du noeud pattern selectionne,
|
|
13
13
|
* uniquement lorsque ce partitionnement ne laisse aucun nouveau candidat
|
|
@@ -23,8 +23,6 @@ namespace FastMcSplit::Reductions
|
|
|
23
23
|
* branch. The reduction marks such candidates as `-1` in the local `domain`
|
|
24
24
|
* copy, without directly mutating `t_domain`.
|
|
25
25
|
*
|
|
26
|
-
* @note FR: Mapping papier/code: lemme 1 -> classe `R1`.
|
|
27
|
-
* EN: Paper/code mapping: Lemma 1 -> class `R1`.
|
|
28
26
|
*/
|
|
29
27
|
class R1
|
|
30
28
|
{
|
|
@@ -6,8 +6,8 @@ namespace FastMcSplit::Reductions
|
|
|
6
6
|
{
|
|
7
7
|
/**
|
|
8
8
|
* @class R2
|
|
9
|
-
* @brief FR: Implementation de la reduction R2
|
|
10
|
-
* EN: Implementation of reduction R2
|
|
9
|
+
* @brief FR: Implementation de la reduction R2.
|
|
10
|
+
* EN: Implementation of reduction R2.
|
|
11
11
|
*
|
|
12
12
|
* FR: R2 intervient lorsque le partitionnement pattern laisse exactement un
|
|
13
13
|
* nouveau candidat pattern (`p_result.num_nodes_in_candidats == 1`). Elle
|
|
@@ -30,8 +30,6 @@ namespace FastMcSplit::Reductions
|
|
|
30
30
|
* node `p` outside the solution;
|
|
31
31
|
* - `match_constraints[p][t]` temporarily forbids mapping `(p,t)`.
|
|
32
32
|
*
|
|
33
|
-
* @note FR: Mapping papier/code: lemme 6 -> classe `R2`.
|
|
34
|
-
* EN: Paper/code mapping: Lemma 6 -> class `R2`.
|
|
35
33
|
*/
|
|
36
34
|
template <typename EdgeAttrComparator>
|
|
37
35
|
class R2
|
|
@@ -6,8 +6,8 @@ namespace FastMcSplit::Reductions
|
|
|
6
6
|
{
|
|
7
7
|
/**
|
|
8
8
|
* @class R4
|
|
9
|
-
* @brief FR: Implementation de la reduction R4
|
|
10
|
-
* EN: Implementation of reduction R4
|
|
9
|
+
* @brief FR: Implementation de la reduction R4.
|
|
10
|
+
* EN: Implementation of reduction R4.
|
|
11
11
|
*
|
|
12
12
|
* FR: R4 exploite les classes d'equivalence structurelle de noeuds pattern et
|
|
13
13
|
* target. Elle maintient, pendant la recursion, une matrice de couples
|
|
@@ -22,8 +22,6 @@ namespace FastMcSplit::Reductions
|
|
|
22
22
|
* to an already used pair, or if both equivalence classes are already used in
|
|
23
23
|
* another pair, the branch is a symmetry already covered and can be skipped.
|
|
24
24
|
*
|
|
25
|
-
* @note FR: Mapping papier/code: lemme 9 -> classe `R4`.
|
|
26
|
-
* EN: Paper/code mapping: Lemma 9 -> class `R4`.
|
|
27
25
|
*/
|
|
28
26
|
class R4
|
|
29
27
|
{
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
#include <cstdint>
|
|
12
12
|
#include <cassert>
|
|
13
13
|
#include <array>
|
|
14
|
-
#include <cmath>
|
|
15
14
|
#include <algorithm>
|
|
16
15
|
#include <Reductions/R1.hpp>
|
|
17
16
|
#include <Reductions/R2.hpp>
|
|
@@ -58,70 +57,6 @@ namespace FastMcSplit
|
|
|
58
57
|
* @brief FR: Moteur principal de recherche du plus grand matching commun.
|
|
59
58
|
* EN: Main search engine for the maximum common matching.
|
|
60
59
|
*
|
|
61
|
-
* FR: La classe implemente un backtracking avec bornes, partitionnement
|
|
62
|
-
* dynamique des classes de noeuds et reductions R1-R6. Les domaines pattern
|
|
63
|
-
* et target sont modifies en place par swaps, puis restaures a chaque retour
|
|
64
|
-
* de recursion.
|
|
65
|
-
*
|
|
66
|
-
* FR: Le cycle principal d'une profondeur de recherche est:
|
|
67
|
-
*
|
|
68
|
-
* 1. calculer une borne superieure sur la taille maximale encore atteignable;
|
|
69
|
-
* 2. selectionner un noeud pattern dans une classe active;
|
|
70
|
-
* 3. retirer ce noeud pattern de son domaine et creer les classes successeurs
|
|
71
|
-
* induites par ses voisins;
|
|
72
|
-
* 4. construire le domaine target local compatible;
|
|
73
|
-
* 5. appliquer les reductions:
|
|
74
|
-
* - R1: lemme 1;
|
|
75
|
-
* - R2: lemme 6;
|
|
76
|
-
* - R3: lemme 8;
|
|
77
|
-
* - R4: lemme 9;
|
|
78
|
-
* - R5/R6: reductions de symetrie locales supplementaires;
|
|
79
|
-
* 6. explorer chaque appariement `(p,t)`;
|
|
80
|
-
* 7. explorer eventuellement la branche ou `p` n'est pas matche;
|
|
81
|
-
* 8. restaurer exactement les domaines et contraintes temporaires.
|
|
82
|
-
*
|
|
83
|
-
* EN: This class implements backtracking with bounds, dynamic node-class
|
|
84
|
-
* partitioning and reductions R1-R6. Pattern and target domains are mutated
|
|
85
|
-
* in place through swaps, then restored whenever recursion returns.
|
|
86
|
-
*
|
|
87
|
-
* EN: The main workflow at one search depth is:
|
|
88
|
-
*
|
|
89
|
-
* 1. compute an upper bound on the maximum still reachable size;
|
|
90
|
-
* 2. select one pattern node from an active class;
|
|
91
|
-
* 3. remove that pattern node from its domain and create successor classes
|
|
92
|
-
* induced by its neighbors;
|
|
93
|
-
* 4. build the compatible local target domain;
|
|
94
|
-
* 5. apply reductions:
|
|
95
|
-
* - R1: Lemma 1;
|
|
96
|
-
* - R2: Lemma 6;
|
|
97
|
-
* - R3: Lemma 8;
|
|
98
|
-
* - R4: Lemma 9;
|
|
99
|
-
* - R5/R6: additional local symmetry reductions;
|
|
100
|
-
* 6. explore every mapping `(p,t)`;
|
|
101
|
-
* 7. optionally explore the branch where `p` is not matched;
|
|
102
|
-
* 8. exactly restore domains and temporary constraints.
|
|
103
|
-
*
|
|
104
|
-
* @invariant FR: Les tableaux `p_domain` et `t_domain` sont des partitions
|
|
105
|
-
* contigues. Chaque `NodeInfo::domain_ind` doit pointer vers la
|
|
106
|
-
* position courante du noeud dans le tableau correspondant.
|
|
107
|
-
* EN: `p_domain` and `t_domain` are contiguous partitions. Every
|
|
108
|
-
* `NodeInfo::domain_ind` must point to the node's current position
|
|
109
|
-
* in the corresponding array.
|
|
110
|
-
*
|
|
111
|
-
* @invariant FR: Les classes actives sont stockees dans `active_class_list`
|
|
112
|
-
* entre `0` et `active_class_size`. Une classe inactive doit avoir
|
|
113
|
-
* `ind_in_active_class_list == -1`.
|
|
114
|
-
* EN: Active classes are stored in `active_class_list` between `0`
|
|
115
|
-
* and `active_class_size`. An inactive class must have
|
|
116
|
-
* `ind_in_active_class_list == -1`.
|
|
117
|
-
*
|
|
118
|
-
* @tparam EdgeAttrComparator FR: Comparateur adapte au type de labels
|
|
119
|
-
* d'aretes. EN: Comparator matching the edge-label mode.
|
|
120
|
-
*
|
|
121
|
-
* @warning FR: La correction depend fortement de l'ordre partition /
|
|
122
|
-
* exploration / restauration. Modifier ces fonctions ensemble.
|
|
123
|
-
* EN: Correctness heavily depends on partition / exploration /
|
|
124
|
-
* restore order. Modify these functions together.
|
|
125
60
|
*/
|
|
126
61
|
template <typename EdgeAttrComparator>
|
|
127
62
|
class SearchMatching
|
|
@@ -150,10 +85,6 @@ namespace FastMcSplit
|
|
|
150
85
|
node_id_tn num_classes = active_class_size+1;
|
|
151
86
|
node_id_t p_n_id = select_best_node(k);
|
|
152
87
|
if(p_n_id==UINT32_MAX) return;
|
|
153
|
-
if(uses_exploration_selection_score())
|
|
154
|
-
{
|
|
155
|
-
register_pattern_node_selection(p_n_id);
|
|
156
|
-
}
|
|
157
88
|
//
|
|
158
89
|
// Pattern partition phase: remove p_n_id from its class, then split
|
|
159
90
|
// neighbor classes according to the edge relation with p_n_id.
|
|
@@ -218,7 +149,7 @@ namespace FastMcSplit
|
|
|
218
149
|
r8.applyR8(domain,idx,k,r8_remaining_deg_count);
|
|
219
150
|
}
|
|
220
151
|
//
|
|
221
|
-
// R1
|
|
152
|
+
// R1: when the pattern side has no propagated candidate,
|
|
222
153
|
// remove dominated/equivalent target candidates in the local domain.
|
|
223
154
|
if(do_r1 && p_result.num_nodes_in_candidats==0 && domain.size() > 1)
|
|
224
155
|
{
|
|
@@ -226,7 +157,7 @@ namespace FastMcSplit
|
|
|
226
157
|
if(r1.applyR1(domain,idx,k)) not_explore_without_node = true;
|
|
227
158
|
}
|
|
228
159
|
//
|
|
229
|
-
// R2
|
|
160
|
+
// R2: when the pattern side has one propagated candidate,
|
|
230
161
|
// precompute temporary match/no-skip constraints for each target
|
|
231
162
|
// candidate. They are installed only while exploring that candidate.
|
|
232
163
|
std::unique_ptr<Reductions::R2<EdgeAttrComparator>> r2;
|
|
@@ -239,7 +170,7 @@ namespace FastMcSplit
|
|
|
239
170
|
r2->applyR2(domain,idx,k);
|
|
240
171
|
}
|
|
241
172
|
//
|
|
242
|
-
// R3
|
|
173
|
+
// R3: for singleton pattern classes, collect information
|
|
243
174
|
// across all target candidates before deciding whether the no-match
|
|
244
175
|
// branch or some target choices can be constrained.
|
|
245
176
|
std::unique_ptr<Reductions::R3> r3;
|
|
@@ -276,7 +207,7 @@ namespace FastMcSplit
|
|
|
276
207
|
K=k;
|
|
277
208
|
// Install candidate-specific R2 constraints before recursion.
|
|
278
209
|
if(r2) r2->addConstraints(p_result.node_in_candidats,t_n_id,d_id,match_constraints,p_not_in_solution_constraints);
|
|
279
|
-
// R4
|
|
210
|
+
// R4: record the equivalence-class pair used by (p,t).
|
|
280
211
|
r4.addConstraints((node_id_t)p_n_id,(node_id_t)t_n_id);
|
|
281
212
|
// Target partition phase: split target classes according to the
|
|
282
213
|
// relation with t_n_id and check propagated constraints.
|
|
@@ -461,7 +392,7 @@ namespace FastMcSplit
|
|
|
461
392
|
deg_1 = target[n1]->getDegreeIn() + target[n1]->getDegreeOut();
|
|
462
393
|
deg_2 = target[n2]->getDegreeIn() + target[n2]->getDegreeOut();
|
|
463
394
|
if(deg_1 != deg_2) return deg_1 > deg_2;
|
|
464
|
-
return
|
|
395
|
+
return heuristic==1 ? n1 > n2 : n1 < n2;
|
|
465
396
|
}
|
|
466
397
|
//
|
|
467
398
|
/**
|
|
@@ -496,10 +427,6 @@ namespace FastMcSplit
|
|
|
496
427
|
max_size=curr_size;
|
|
497
428
|
max_sol=curr_sol;
|
|
498
429
|
reset_adaptive_reward_counter();
|
|
499
|
-
if(uses_exploration_selection_score())
|
|
500
|
-
{
|
|
501
|
-
reward_successful_pattern_node(pattern_node_id);
|
|
502
|
-
}
|
|
503
430
|
if(verbose)
|
|
504
431
|
{
|
|
505
432
|
printf("max size: %d, goal size: %d\n",max_size,goal_size);
|
|
@@ -540,41 +467,6 @@ namespace FastMcSplit
|
|
|
540
467
|
reward_strategy_use_count = 0;
|
|
541
468
|
}
|
|
542
469
|
//
|
|
543
|
-
void register_pattern_node_selection(node_id_t pattern_node_id)
|
|
544
|
-
{
|
|
545
|
-
p_use_count[pattern_node_id] += 1.0;
|
|
546
|
-
total_pattern_node_selections += 1.0;
|
|
547
|
-
}
|
|
548
|
-
//
|
|
549
|
-
void reward_successful_pattern_node(node_id_t pattern_node_id)
|
|
550
|
-
{
|
|
551
|
-
p_use_count[pattern_node_id] *= successful_node_use_decay;
|
|
552
|
-
}
|
|
553
|
-
//
|
|
554
|
-
bool uses_exploration_selection_score() const
|
|
555
|
-
{
|
|
556
|
-
return heuristic==2 || heuristic==3;
|
|
557
|
-
}
|
|
558
|
-
//
|
|
559
|
-
double compute_pattern_selection_score(node_id_t pattern_node_id, bool use_effective_score) const
|
|
560
|
-
{
|
|
561
|
-
if(!use_effective_score) return p_vgrade[pattern_node_id];
|
|
562
|
-
return compute_effective_pattern_score(pattern_node_id);
|
|
563
|
-
}
|
|
564
|
-
//
|
|
565
|
-
double compute_effective_pattern_score(node_id_t pattern_node_id) const
|
|
566
|
-
{
|
|
567
|
-
double use_count = p_use_count[pattern_node_id];
|
|
568
|
-
double exploration =
|
|
569
|
-
exploration_score_weight *
|
|
570
|
-
std::sqrt(
|
|
571
|
-
std::log(total_pattern_node_selections + 2.0) /
|
|
572
|
-
(use_count + 1.0)
|
|
573
|
-
);
|
|
574
|
-
double usage_penalty = use_count_penalty_weight * use_count;
|
|
575
|
-
return p_vgrade[pattern_node_id] + exploration - usage_penalty;
|
|
576
|
-
}
|
|
577
|
-
//
|
|
578
470
|
/**
|
|
579
471
|
* @brief FR: Retire le dernier appariement ajoute.
|
|
580
472
|
* EN: Removes the latest added pair.
|
|
@@ -1784,15 +1676,13 @@ namespace FastMcSplit
|
|
|
1784
1676
|
* `max(|P_C|, |T_C|)`. Les ex-aequo sont departages par la densite du
|
|
1785
1677
|
* graphe target et l'heuristique demandee:
|
|
1786
1678
|
* - target dense: plus petit degre pattern;
|
|
1787
|
-
* - heuristique 0/1: score `p_vgrade
|
|
1788
|
-
* - heuristique 2/3: score effectif avec bonus d'exploration.
|
|
1679
|
+
* - heuristique 0/1: score `p_vgrade`.
|
|
1789
1680
|
*
|
|
1790
1681
|
* EN: The solver first selects active classes minimizing
|
|
1791
1682
|
* `max(|P_C|, |T_C|)`. Ties are broken using target density and the
|
|
1792
1683
|
* requested heuristic:
|
|
1793
1684
|
* - dense target: smallest pattern degree;
|
|
1794
|
-
* - heuristic 0/1: `p_vgrade` score
|
|
1795
|
-
* - heuristic 2/3: effective score with exploration bonus.
|
|
1685
|
+
* - heuristic 0/1: `p_vgrade` score.
|
|
1796
1686
|
*/
|
|
1797
1687
|
node_id_t select_best_node(const node_id_t k)
|
|
1798
1688
|
{
|
|
@@ -1861,19 +1751,11 @@ namespace FastMcSplit
|
|
|
1861
1751
|
}
|
|
1862
1752
|
else if(heuristic==0)
|
|
1863
1753
|
{
|
|
1864
|
-
return select_best_node_no_dense_unlabelled(k,num_min
|
|
1865
|
-
}
|
|
1866
|
-
else if(heuristic==1)
|
|
1867
|
-
{
|
|
1868
|
-
return select_best_node_no_dense_unlabelled_1(k,num_min,false);
|
|
1869
|
-
}
|
|
1870
|
-
else if(heuristic==2)
|
|
1871
|
-
{
|
|
1872
|
-
return select_best_node_no_dense_unlabelled(k,num_min,true);
|
|
1754
|
+
return select_best_node_no_dense_unlabelled(k,num_min);
|
|
1873
1755
|
}
|
|
1874
1756
|
else
|
|
1875
1757
|
{
|
|
1876
|
-
return select_best_node_no_dense_unlabelled_1(k,num_min
|
|
1758
|
+
return select_best_node_no_dense_unlabelled_1(k,num_min);
|
|
1877
1759
|
}
|
|
1878
1760
|
// else if (labelled)
|
|
1879
1761
|
// {
|
|
@@ -2023,15 +1905,11 @@ namespace FastMcSplit
|
|
|
2023
1905
|
* @brief FR: Selection sparse, tie-break par degre.
|
|
2024
1906
|
* EN: Sparse selection, degree tie-break.
|
|
2025
1907
|
*
|
|
2026
|
-
* FR: Utilisee par
|
|
2027
|
-
* faux, le score principal est `p_vgrade`. Avec `true`, le score inclut
|
|
2028
|
-
* bonus d'exploration et penalite d'usage.
|
|
1908
|
+
* FR: Utilisee par l'heuristique 0. Le score principal est `p_vgrade`.
|
|
2029
1909
|
*
|
|
2030
|
-
* EN: Used by
|
|
2031
|
-
* main score is `p_vgrade`. With `true`, the score includes exploration
|
|
2032
|
-
* bonus and use penalty.
|
|
1910
|
+
* EN: Used by heuristic 0. The main score is `p_vgrade`.
|
|
2033
1911
|
*/
|
|
2034
|
-
node_id_t select_best_node_no_dense_unlabelled(const node_id_t k, int num_min
|
|
1912
|
+
node_id_t select_best_node_no_dense_unlabelled(const node_id_t k, int num_min)
|
|
2035
1913
|
{
|
|
2036
1914
|
const Node* node = nullptr;
|
|
2037
1915
|
node_id_t node_id;
|
|
@@ -2043,7 +1921,7 @@ namespace FastMcSplit
|
|
|
2043
1921
|
node = pattern[node_id];
|
|
2044
1922
|
|
|
2045
1923
|
node_id_t best_node = node_id;
|
|
2046
|
-
double max_score =
|
|
1924
|
+
double max_score = p_vgrade[node_id];
|
|
2047
1925
|
node_id_t max_deg = node->getDegreeOut() + node->getDegreeIn();
|
|
2048
1926
|
|
|
2049
1927
|
for (size_t i = 0; i < num_min; ++i)
|
|
@@ -2058,8 +1936,7 @@ namespace FastMcSplit
|
|
|
2058
1936
|
node_id = p_domain[j];
|
|
2059
1937
|
node = pattern[node_id];
|
|
2060
1938
|
|
|
2061
|
-
double cur_score =
|
|
2062
|
-
compute_pattern_selection_score(node_id,use_effective_score);
|
|
1939
|
+
double cur_score = p_vgrade[node_id];
|
|
2063
1940
|
|
|
2064
1941
|
node_id_t cur_deg =
|
|
2065
1942
|
node->getDegreeOut() + node->getDegreeIn();
|
|
@@ -2101,15 +1978,15 @@ namespace FastMcSplit
|
|
|
2101
1978
|
* @brief FR: Selection sparse, tie-break par pression des voisins matches.
|
|
2102
1979
|
* EN: Sparse selection, matched-neighbor pressure tie-break.
|
|
2103
1980
|
*
|
|
2104
|
-
* FR: Utilisee par
|
|
2105
|
-
*
|
|
2106
|
-
*
|
|
1981
|
+
* FR: Utilisee par l'heuristique 1. Les criteres sont `p_vgrade`, le
|
|
1982
|
+
* degre, puis `p_deg_m`, le nombre de voisins pattern deja touches par
|
|
1983
|
+
* les appariements courants.
|
|
2107
1984
|
*
|
|
2108
|
-
* EN: Used by
|
|
2109
|
-
*
|
|
2110
|
-
*
|
|
1985
|
+
* EN: Used by heuristic 1. The criteria are `p_vgrade`, degree, then
|
|
1986
|
+
* `p_deg_m`, the number of pattern neighbors already touched by current
|
|
1987
|
+
* mappings.
|
|
2111
1988
|
*/
|
|
2112
|
-
node_id_t select_best_node_no_dense_unlabelled_1(const node_id_t k, int num_min
|
|
1989
|
+
node_id_t select_best_node_no_dense_unlabelled_1(const node_id_t k, int num_min)
|
|
2113
1990
|
{
|
|
2114
1991
|
const Node* node = nullptr;
|
|
2115
1992
|
node_id_t node_id;
|
|
@@ -2122,7 +1999,7 @@ namespace FastMcSplit
|
|
|
2122
1999
|
|
|
2123
2000
|
node_id_t best_node = node_id;
|
|
2124
2001
|
node_id_t best_ind = first_class.ind;
|
|
2125
|
-
double max_score =
|
|
2002
|
+
double max_score = p_vgrade[node_id];
|
|
2126
2003
|
node_id_t max_deg_m = p_deg_m[node_id];
|
|
2127
2004
|
node_id_t max_deg = node->getDegreeOut() + node->getDegreeIn();
|
|
2128
2005
|
|
|
@@ -2138,8 +2015,7 @@ namespace FastMcSplit
|
|
|
2138
2015
|
node_id = p_domain[j];
|
|
2139
2016
|
node = pattern[node_id];
|
|
2140
2017
|
|
|
2141
|
-
double cur_score =
|
|
2142
|
-
compute_pattern_selection_score(node_id,use_effective_score);
|
|
2018
|
+
double cur_score = p_vgrade[node_id];
|
|
2143
2019
|
|
|
2144
2020
|
node_id_t cur_deg_m =
|
|
2145
2021
|
p_deg_m[node_id];
|
|
@@ -2283,8 +2159,6 @@ namespace FastMcSplit
|
|
|
2283
2159
|
std::vector<double> p_vgrade_2;
|
|
2284
2160
|
std::vector<double> p_vgrade_3;
|
|
2285
2161
|
std::vector<double> t_vgrade;
|
|
2286
|
-
std::vector<double> p_use_count;
|
|
2287
|
-
double total_pattern_node_selections;
|
|
2288
2162
|
bool adaptive_reward;
|
|
2289
2163
|
int active_reward_strategy;
|
|
2290
2164
|
node_id_t reward_strategy_use_count;
|
|
@@ -2293,9 +2167,6 @@ namespace FastMcSplit
|
|
|
2293
2167
|
//
|
|
2294
2168
|
static constexpr double short_memory_threshold = 100000.0;
|
|
2295
2169
|
static constexpr double long_memory_threshold = 1000000000.0;
|
|
2296
|
-
static constexpr double exploration_score_weight = 2.0;
|
|
2297
|
-
static constexpr double use_count_penalty_weight = 0.1;
|
|
2298
|
-
static constexpr double successful_node_use_decay = 0.5;
|
|
2299
2170
|
//
|
|
2300
2171
|
Reductions::R4 r4;
|
|
2301
2172
|
Reductions::R6 r6;
|
|
@@ -2412,8 +2283,6 @@ namespace FastMcSplit
|
|
|
2412
2283
|
p_vgrade_2(pattern.size(),0),
|
|
2413
2284
|
p_vgrade_3(pattern.size(),0),
|
|
2414
2285
|
t_vgrade(target.size(),0),
|
|
2415
|
-
p_use_count(pattern.size(),0),
|
|
2416
|
-
total_pattern_node_selections(0.0),
|
|
2417
2286
|
adaptive_reward(adaptive_reward_),
|
|
2418
2287
|
active_reward_strategy(reward_strategy_ >= 1 && reward_strategy_ <= 4 ? reward_strategy_ : 1),
|
|
2419
2288
|
reward_strategy_use_count(0),
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "FastMcsplit"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.2"
|
|
8
8
|
description = "Native C++ maximum common induced subgraph solver for Python and NetworkX"
|
|
9
9
|
readme = "python/README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -14,7 +14,7 @@ authors = [
|
|
|
14
14
|
{name = "Vladimir Reinharz"},
|
|
15
15
|
]
|
|
16
16
|
classifiers = [
|
|
17
|
-
"Development Status ::
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
19
19
|
"Programming Language :: C++",
|
|
20
20
|
"Operating System :: MacOS",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: FastMcsplit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: Native C++ maximum common induced subgraph solver for Python and NetworkX
|
|
5
5
|
Author: Wilfried Agbeto, Camille Coti, Vladimir Reinharz
|
|
6
|
-
Classifier: Development Status ::
|
|
6
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: Programming Language :: C++
|
|
9
9
|
Classifier: Operating System :: MacOS
|
|
@@ -122,8 +122,7 @@ The same keyword options work with all three interfaces.
|
|
|
122
122
|
Reward names: `capacity_diversity` (1), `pair_diversity` (2), `class_count` (3),
|
|
123
123
|
`combined_diversity` (4).
|
|
124
124
|
|
|
125
|
-
Heuristic names: `reward_degree` (0), `reward_pressure` (1)
|
|
126
|
-
`exploration_degree` (2), `exploration_pressure` (3).
|
|
125
|
+
Heuristic names: `reward_degree` (0), `reward_pressure` (1).
|
|
127
126
|
|
|
128
127
|
See the [C++ documentation][solver] for their behavior. Approximate mode skips
|
|
129
128
|
exact-search reductions and reward/adaptation settings; disabling reductions
|
|
@@ -103,8 +103,7 @@ The same keyword options work with all three interfaces.
|
|
|
103
103
|
Reward names: `capacity_diversity` (1), `pair_diversity` (2), `class_count` (3),
|
|
104
104
|
`combined_diversity` (4).
|
|
105
105
|
|
|
106
|
-
Heuristic names: `reward_degree` (0), `reward_pressure` (1)
|
|
107
|
-
`exploration_degree` (2), `exploration_pressure` (3).
|
|
106
|
+
Heuristic names: `reward_degree` (0), `reward_pressure` (1).
|
|
108
107
|
|
|
109
108
|
See the [C++ documentation][solver] for their behavior. Approximate mode skips
|
|
110
109
|
exact-search reductions and reward/adaptation settings; disabling reductions
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""Maximum common induced subgraphs using the native FastMcSplit engine."""
|
|
2
2
|
from .api import Result, approximate, solve, solve_csv, solve_files
|
|
3
3
|
|
|
4
|
-
__version__ = "0.0.
|
|
4
|
+
__version__ = "0.0.2"
|
|
5
5
|
__all__ = ["Result", "solve", "solve_csv", "solve_files", "approximate"]
|
|
@@ -40,8 +40,7 @@ class _Graph:
|
|
|
40
40
|
|
|
41
41
|
REWARDS = {"capacity_diversity": 1, "pair_diversity": 2,
|
|
42
42
|
"class_count": 3, "combined_diversity": 4}
|
|
43
|
-
HEURISTICS = {"reward_degree": 0, "reward_pressure": 1
|
|
44
|
-
"exploration_degree": 2, "exploration_pressure": 3}
|
|
43
|
+
HEURISTICS = {"reward_degree": 0, "reward_pressure": 1}
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
def _choice(value, names, default, name):
|
|
@@ -253,7 +253,7 @@ PyObject* solve_native(PyObject*, PyObject* args) {
|
|
|
253
253
|
&approximate,&greedy,&connected,&big_first,&verbose,&adaptive,&reward,&heuristic,&mask,&labelled)) return nullptr;
|
|
254
254
|
try {
|
|
255
255
|
Input p=read_input(p_object),t=read_input(t_object);
|
|
256
|
-
if (reward<0 || reward>4 || heuristic<0 || heuristic>
|
|
256
|
+
if (reward<0 || reward>4 || heuristic<0 || heuristic>1 || mask<0 || mask>255)
|
|
257
257
|
throw std::invalid_argument("Invalid native solver option");
|
|
258
258
|
std::array<bool,8> rules;
|
|
259
259
|
for (unsigned i=0;i<8;++i) rules[i]=!(mask&(1<<i));
|
|
@@ -85,7 +85,7 @@ def test_random_graphs_against_exhaustive_oracle(graph_type, connected):
|
|
|
85
85
|
@pytest.mark.parametrize("options", [
|
|
86
86
|
{"reward_strategy": value, "heuristic": h, "adaptive_rewards": adaptive}
|
|
87
87
|
for value in [None, 1, 2, 3, 4, "combined_diversity"]
|
|
88
|
-
for h in [0, 1,
|
|
88
|
+
for h in [0, 1, "reward_degree", "reward_pressure"]
|
|
89
89
|
for adaptive in [False, True]
|
|
90
90
|
] + [{"big_first": True}, {"big_first": True, "greedy": True}])
|
|
91
91
|
def test_search_options(options):
|
|
@@ -185,7 +185,9 @@ def test_malformed_csv(data):
|
|
|
185
185
|
fm.solve_csv(data, "1\n0")
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
@pytest.mark.parametrize("options", [{"method": "other"}, {"heuristic":
|
|
188
|
+
@pytest.mark.parametrize("options", [{"method": "other"}, {"heuristic": 2},
|
|
189
|
+
{"heuristic": 3}, {"heuristic": 4}, {"heuristic": "exploration_degree"},
|
|
190
|
+
{"heuristic": "exploration_pressure"},
|
|
189
191
|
{"reward_strategy": 0}, {"connected": 1}, {"disabled_reductions": ["R9"]},
|
|
190
192
|
{"disabled_reductions": "R1"}, {"method": "approximate", "big_first": True}])
|
|
191
193
|
def test_invalid_options(options):
|
|
@@ -227,7 +229,7 @@ def test_sparse_unlabelled_random_oracle(directed):
|
|
|
227
229
|
graphs.append(g)
|
|
228
230
|
p, t = graphs
|
|
229
231
|
expected = brute_force(p, t)
|
|
230
|
-
for h in range(
|
|
232
|
+
for h in range(2):
|
|
231
233
|
result = fm.solve(p, t, heuristic=h, greedy=True)
|
|
232
234
|
assert valid(p, t, result.mapping)
|
|
233
235
|
assert result.size == expected
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|