FastMcsplit 0.0.1__tar.gz → 0.0.3__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.3}/MANIFEST.in +1 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/PKG-INFO +16 -5
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/README.md +40 -22
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/args/ParseArgs.hpp +6 -9
- fastmcsplit-0.0.3/docs/pypi.md +81 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/docs/testpypi.md +2 -12
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/GreedySearchMatching.hpp +8 -6
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/R1.hpp +3 -5
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/R2.hpp +2 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/R3.hpp +2 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/R4.hpp +2 -4
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/SearchMatching.hpp +42 -157
- fastmcsplit-0.0.3/header/SearchTimeout.hpp +44 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/pyproject.toml +2 -2
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/FastMcsplit.egg-info/PKG-INFO +16 -5
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/FastMcsplit.egg-info/SOURCES.txt +2 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/README.md +14 -3
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/fastmcsplit/__init__.py +1 -1
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/fastmcsplit/api.py +15 -7
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/native.cpp +16 -9
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/setup.py +2 -1
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/tests/test_python_api.py +56 -3
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/EdgeAttr.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Graph.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Node.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/NodeAttr.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/NodeClasses/NodeClass.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/NodeClasses/NodeClassCompute.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/NodeNeighbor.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Parser/ParseCSVFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Parser/ParseFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Parser/ParseGFUFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Parser/ParseGRFFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Parser/ParseLADFile.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Parser/Parser.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/R5.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/R6.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/R8.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/Reductions/r_utils.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/define.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/time_utils.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/header/utils.hpp +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/FastMcsplit.egg-info/dependency_links.txt +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/FastMcsplit.egg-info/requires.txt +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/python/FastMcsplit.egg-info/top_level.txt +0 -0
- {fastmcsplit-0.0.1 → fastmcsplit-0.0.3}/setup.cfg +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: FastMcsplit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
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
|
|
@@ -117,13 +117,13 @@ The same keyword options work with all three interfaces.
|
|
|
117
117
|
| `adaptive_rewards` | `False` | Use adaptive rewards as described in the C++ documentation. |
|
|
118
118
|
| `heuristic` | `0` | Vertex ordering, name or ID below. |
|
|
119
119
|
| `disabled_reductions` | `()` | Disable rules, e.g. `("R1", "R4")` or `(1, 4)`. R8 is currently inactive in the Python binding. |
|
|
120
|
+
| `timeout` | `1800` | Search budget in whole seconds, including greedy search; `0` disables it. |
|
|
120
121
|
| `verbose` | `False` | Native diagnostic output to the process stdout. |
|
|
121
122
|
|
|
122
123
|
Reward names: `capacity_diversity` (1), `pair_diversity` (2), `class_count` (3),
|
|
123
124
|
`combined_diversity` (4).
|
|
124
125
|
|
|
125
|
-
Heuristic names: `reward_degree` (0), `reward_pressure` (1)
|
|
126
|
-
`exploration_degree` (2), `exploration_pressure` (3).
|
|
126
|
+
Heuristic names: `reward_degree` (0), `reward_pressure` (1).
|
|
127
127
|
|
|
128
128
|
See the [C++ documentation][solver] for their behavior. Approximate mode skips
|
|
129
129
|
exact-search reductions and reward/adaptation settings; disabling reductions
|
|
@@ -150,8 +150,19 @@ Every interface returns a `Result` containing one mapping:
|
|
|
150
150
|
- `runtime`: native conversion/preprocessing/search time in seconds; excludes Python conversion.
|
|
151
151
|
- `explored_nodes`: exact-search node count; zero in approximate-only mode.
|
|
152
152
|
- `method`: `"exact"` or `"approximate"`.
|
|
153
|
+
- `timed_out`: whether the search budget expired; the best feasible mapping is returned.
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
|
|
156
|
+
A timed out exact search has `optimal=False` unless its mapping reaches the
|
|
157
|
+
initial upper bound. For example:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
result = fastmcsplit.solve(pattern, target, timeout=60)
|
|
161
|
+
if result.timed_out:
|
|
162
|
+
print("Time limit reached:", result.size)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Parallel edges are limited to
|
|
155
166
|
255 per direction, or 127 undirected loops per vertex.
|
|
156
167
|
|
|
157
168
|
[solver]: https://gitlab.info.uqam.ca/agbeto.kossi_wilfried/fastmcsplit/-/blob/FastMcSplit/README.md
|
|
@@ -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,10 +68,11 @@ 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. |
|
|
75
|
+
| `-t, --timeout SECONDS` | Limit greedy and exact search time in whole seconds. Default: 0 (unlimited). |
|
|
66
76
|
| `-v, --verbose` | Print graph statistics, solution size, and timings. Disabled by default. |
|
|
67
77
|
| `-V, --version` | Show version information. |
|
|
68
78
|
| `-H, --help` | Show the complete help. |
|
|
@@ -71,6 +81,11 @@ The program prints the best mapping as `(pattern_vertex, target_vertex)` pairs.
|
|
|
71
81
|
./build/bin/Release/FastMcSplit -H
|
|
72
82
|
```
|
|
73
83
|
|
|
84
|
+
The timeout starts after graph preprocessing and covers both greedy and exact
|
|
85
|
+
search. For example, `-t 60` sets a 60-second search budget. On expiration,
|
|
86
|
+
the program prints the best mapping found followed by `status = TIMEOUT`;
|
|
87
|
+
this mapping is not guaranteed optimal.
|
|
88
|
+
|
|
74
89
|
### Reward strategies (`-R`)
|
|
75
90
|
|
|
76
91
|
Rewards increase the scores of the last matched pattern and target vertices to guide later search choices. Without `-R` or `-A`, no reward bonus is applied. With `-R` alone, the selected strategy remains fixed.
|
|
@@ -108,27 +123,15 @@ Disabled by default. With `-A`, the solver starts from the strategy supplied by
|
|
|
108
123
|
|
|
109
124
|
### Vertex-ordering heuristics (`-h`)
|
|
110
125
|
|
|
111
|
-
The default is heuristic 0; `-h` accepts
|
|
112
|
-
|
|
113
|
-
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:
|
|
126
|
+
The default is heuristic 0; `-h` accepts 0 or 1.
|
|
114
127
|
|
|
115
128
|
| Value | Selection criteria |
|
|
116
129
|
|---|---|
|
|
117
|
-
| `0` (default) | Highest accumulated reward score, then highest degree, then smallest vertex ID. |
|
|
118
|
-
| `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.
|
|
130
|
+
| `0` (default) | Highest accumulated reward score (if `-R` and `-A` is used), then highest degree, then smallest vertex ID. |
|
|
131
|
+
| `1` | Highest accumulated reward score (if `-R` and `-A` is used), then highest degree, then most neighbours touched by current matches, then largest bidomain index and vertex ID. |
|
|
129
132
|
|
|
130
133
|
```bash
|
|
131
|
-
./build/bin/Release/FastMcSplit -F ulad -R 4 -h
|
|
134
|
+
./build/bin/Release/FastMcSplit -F ulad -R 4 -h 1 p.txt t.txt
|
|
132
135
|
```
|
|
133
136
|
|
|
134
137
|
## File formats
|
|
@@ -198,3 +201,18 @@ a
|
|
|
198
201
|
```
|
|
199
202
|
|
|
200
203
|
In the current implementation, use `-F gfu` for undirected graphs and `-F ugfu` for directed graphs.
|
|
204
|
+
|
|
205
|
+
## Datasets
|
|
206
|
+
|
|
207
|
+
FastMcSplit was compared to the following solvers:
|
|
208
|
+
|
|
209
|
+
- [McSplitDAL](https://github.com/KaiqiangYu/SIGMOD25-MCSS/tree/main/McSplitDAL)
|
|
210
|
+
- [RRSplit](https://github.com/KaiqiangYu/SIGMOD25-MCSS/tree/main/RRSplit)
|
|
211
|
+
- [SymSplit](https://github.com/mcsolver/symsplit)
|
|
212
|
+
|
|
213
|
+
The datasets are available in the [datasets](datasets/) folder.
|
|
214
|
+
|
|
215
|
+
## Complete proofs
|
|
216
|
+
|
|
217
|
+
Complete proofs of the reduction rules are available in the
|
|
218
|
+
[supplementary document](supplementary/Complete_proofs.pdf).
|
|
@@ -54,6 +54,7 @@ class ParseArgs
|
|
|
54
54
|
static bool W_REDUCTIONS[8];
|
|
55
55
|
static int REWARD_STRATEGY;
|
|
56
56
|
static int HEURISTIC;
|
|
57
|
+
static int TIMEOUT;
|
|
57
58
|
public:
|
|
58
59
|
ParseArgs();
|
|
59
60
|
~ParseArgs();
|
|
@@ -83,6 +84,7 @@ class ParseArgs
|
|
|
83
84
|
static bool DO_REDUCTION(int r_id);
|
|
84
85
|
static int get_REWARD_STRATEGY();
|
|
85
86
|
static int get_HEURISTIC();
|
|
87
|
+
static int getTIMEOUT();
|
|
86
88
|
};
|
|
87
89
|
|
|
88
90
|
#define HELP_TEXT "\
|
|
@@ -145,18 +147,10 @@ Options:\n\
|
|
|
145
147
|
(density > 0.5) ignore this option and use: smallest pattern degree, then\n\
|
|
146
148
|
smallest neighbor-degree sum. Labelled sparse graphs use their dedicated\n\
|
|
147
149
|
labelled ordering.\n\
|
|
148
|
-
Accepted values are
|
|
150
|
+
Accepted values are 0 and 1. If -h is omitted, heuristic 0 is used.\n\
|
|
149
151
|
heuristic 0: highest p_vgrade, then highest degree, then smallest id\n\
|
|
150
152
|
heuristic 1: highest p_vgrade, then highest degree, then highest\n\
|
|
151
153
|
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
154
|
\n\
|
|
161
155
|
-C, --connected\n\
|
|
162
156
|
Restrict the search to connected expansions after the first matched node.\n\
|
|
@@ -169,6 +163,9 @@ Options:\n\
|
|
|
169
163
|
Run the greedy algorithm before the exact search. The greedy incumbent is\n\
|
|
170
164
|
used as an initial lower bound and may also select the target ordering\n\
|
|
171
165
|
used by the exact solver.\n\
|
|
166
|
+
\n\
|
|
167
|
+
-t, --timeout SECONDS\n\
|
|
168
|
+
Search time limit, including greedy search (0 disables it; default: 0).\n\
|
|
172
169
|
\n\
|
|
173
170
|
-G, --get-all-solution\n\
|
|
174
171
|
Request all solutions. Note: the current executable primarily reports the\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.
|
|
@@ -205,7 +205,7 @@ namespace FastMcSplit
|
|
|
205
205
|
*/
|
|
206
206
|
void explore_greedy(const node_id_t k, node_id_t prev_ub=0)
|
|
207
207
|
{
|
|
208
|
-
if((use_node_budget && restart_nodes >= node_budget)
|
|
208
|
+
if(this->abort_requested() || (use_node_budget && restart_nodes >= node_budget)
|
|
209
209
|
|| k == this->pattern.size()) return;
|
|
210
210
|
|
|
211
211
|
node_id_t ub=this->compute_bound_0(prev_ub);
|
|
@@ -268,6 +268,7 @@ namespace FastMcSplit
|
|
|
268
268
|
std::vector<node_id_t> invalid_target_nodes;
|
|
269
269
|
for(node_id_tn target_node : targets)
|
|
270
270
|
{
|
|
271
|
+
if(this->abort_requested()) break;
|
|
271
272
|
partionning_out target_result;
|
|
272
273
|
this->K=k;
|
|
273
274
|
this->partition_target_nodes(
|
|
@@ -380,7 +381,7 @@ namespace FastMcSplit
|
|
|
380
381
|
int count_n = 0;
|
|
381
382
|
for(node_id_t pattern_node : pattern_starts)
|
|
382
383
|
{
|
|
383
|
-
if(count_n > N) break;
|
|
384
|
+
if(this->abort_requested() || count_n > N) break;
|
|
384
385
|
auto targets=diversified_targets(
|
|
385
386
|
pattern_node,
|
|
386
387
|
initial_target_candidates(pattern_node),
|
|
@@ -390,9 +391,9 @@ namespace FastMcSplit
|
|
|
390
391
|
{
|
|
391
392
|
search_from_seed(pattern_node,target_node,local_budget,1);
|
|
392
393
|
restarts++;
|
|
393
|
-
if(this->max_size==initial_upper_bound) break;
|
|
394
|
+
if(this->abort_requested() || this->max_size==initial_upper_bound) break;
|
|
394
395
|
}
|
|
395
|
-
if(this->max_size==initial_upper_bound) break;
|
|
396
|
+
if(this->abort_requested() || this->max_size==initial_upper_bound) break;
|
|
396
397
|
|
|
397
398
|
count_n++;
|
|
398
399
|
}
|
|
@@ -427,7 +428,7 @@ namespace FastMcSplit
|
|
|
427
428
|
// else if(this->pattern.size() > 2000)
|
|
428
429
|
// start_limit=std::min<size_t>(100,start_limit);
|
|
429
430
|
|
|
430
|
-
for(size_t i=0; i<start_limit; ++i)
|
|
431
|
+
for(size_t i=0; i<start_limit && !this->abort_requested(); ++i)
|
|
431
432
|
{
|
|
432
433
|
node_id_t pattern_node=pattern_starts[i];
|
|
433
434
|
node_id_tn target_node=first_target(pattern_node);
|
|
@@ -442,7 +443,7 @@ namespace FastMcSplit
|
|
|
442
443
|
false
|
|
443
444
|
);
|
|
444
445
|
restarts++;
|
|
445
|
-
if(this->max_size==initial_upper_bound) break;
|
|
446
|
+
if(this->abort_requested() || this->max_size==initial_upper_bound) break;
|
|
446
447
|
}
|
|
447
448
|
|
|
448
449
|
publish_incumbent();
|
|
@@ -497,6 +498,7 @@ namespace FastMcSplit
|
|
|
497
498
|
use_node_budget(true),
|
|
498
499
|
explore_unmatched_branch(true)
|
|
499
500
|
{
|
|
501
|
+
this->set_abort_flag(exact_solver_.get_abort_flag());
|
|
500
502
|
this->set_target_ordering(target_ordering_);
|
|
501
503
|
}
|
|
502
504
|
|
|
@@ -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
|
{
|
|
@@ -207,7 +205,7 @@ namespace FastMcSplit::Reductions
|
|
|
207
205
|
}
|
|
208
206
|
else if(count==1)
|
|
209
207
|
{
|
|
210
|
-
//removes v nodes
|
|
208
|
+
//removes v nodes
|
|
211
209
|
removeNodes(
|
|
212
210
|
node_id,
|
|
213
211
|
neigh_id,
|
|
@@ -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 R3
|
|
9
|
-
* @brief FR: Implementation de la reduction R3
|
|
10
|
-
* EN: Implementation of reduction R3
|
|
9
|
+
* @brief FR: Implementation de la reduction R3.
|
|
10
|
+
* EN: Implementation of reduction R3.
|
|
11
11
|
*
|
|
12
12
|
* FR: R3 traite les cas presque forces lorsque la classe pattern selectionnee
|
|
13
13
|
* contient un seul noeud et que le partitionnement pattern laisse zero ou un
|
|
@@ -23,8 +23,6 @@ namespace FastMcSplit::Reductions
|
|
|
23
23
|
* "do not match the pattern node" branch is useless or whether some nodes
|
|
24
24
|
* must be temporarily excluded.
|
|
25
25
|
*
|
|
26
|
-
* @note FR: Mapping papier/code: lemme 8 -> classe `R3`.
|
|
27
|
-
* EN: Paper/code mapping: Lemma 8 -> class `R3`.
|
|
28
26
|
*/
|
|
29
27
|
class R3
|
|
30
28
|
{
|
|
@@ -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
|
{
|