cpp-pd-code-simplify-interface 0.1.16__py3-none-any.whl → 0.1.18__py3-none-any.whl

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.
@@ -68,6 +68,8 @@ struct CrossingState {
68
68
 
69
69
  using LabelMap = std::unordered_map<int, std::vector<Endpoint>>;
70
70
 
71
+ PDCode canonical_output_code(const PDCode& code);
72
+
71
73
  LabelMap build_label_map(const PDCode& code) {
72
74
  LabelMap labels;
73
75
  for (int c = 0; c < static_cast<int>(code.size()); ++c) {
@@ -227,6 +229,7 @@ PDCode erase_r1_moves(PDCode code, std::size_t& crossingless_components, int& mo
227
229
  }
228
230
 
229
231
  crossingless_components = after_removal.crossingless_components;
232
+ code = canonical_output_code(code);
230
233
  ++moves;
231
234
  changed = true;
232
235
  break;
@@ -237,7 +240,7 @@ PDCode erase_r1_moves(PDCode code, std::size_t& crossingless_components, int& mo
237
240
  }
238
241
  }
239
242
 
240
- return renumber_r1_order(code);
243
+ return canonical_output_code(renumber_r1_order(code));
241
244
  }
242
245
 
243
246
  std::map<int, std::set<int>> base_pd_graph(const PDCode& code) {
@@ -457,7 +460,7 @@ PDCode erase_one_nugatory_crossing(
457
460
  code = replace_arc_value(code, dx, bx);
458
461
  crossingless_components = after_removal.crossingless_components;
459
462
  ++moves;
460
- return renumber_full_dfs(code);
463
+ return canonical_output_code(renumber_full_dfs(code));
461
464
  }
462
465
 
463
466
  std::vector<std::vector<int>> raw_faces_from_pd_code(const PDCode& code) {
@@ -1842,6 +1845,10 @@ void emit_step_pd(const SimplifierOptions& options, int round, const PDCode& cod
1842
1845
  }
1843
1846
  }
1844
1847
 
1848
+ PDCode canonical_output_code(const PDCode& code) {
1849
+ return parse_pd_code(format_final_pd_code(code));
1850
+ }
1851
+
1845
1852
  std::string search_mode_for_options(const SimplifierOptions& options) {
1846
1853
  if (options.max_paths == -1 && !options.ban_heuristic) {
1847
1854
  return "heuristic";
@@ -2187,7 +2194,7 @@ PDSimplificationResult simplify_pd_code(
2187
2194
  const PDCode& code,
2188
2195
  std::size_t known_crossingless_components) {
2189
2196
  PDSimplificationResult result;
2190
- result.code = code;
2197
+ result.code = canonical_output_code(code);
2191
2198
  result.crossingless_components = known_crossingless_components;
2192
2199
 
2193
2200
  result.code = erase_r1_moves(
@@ -2555,7 +2562,7 @@ ReductionResult reduce_pd_code(
2555
2562
 
2556
2563
  const PDSimplificationResult prepared =
2557
2564
  simplify_pd_code(code, known_crossingless_components);
2558
- output.code = prepared.code;
2565
+ output.code = canonical_output_code(prepared.code);
2559
2566
  output.crossingless_components = prepared.crossingless_components;
2560
2567
  output.reidemeister_i_moves = prepared.reidemeister_i_moves;
2561
2568
  output.nugatory_crossing_moves = prepared.nugatory_crossing_moves;
@@ -2643,14 +2650,15 @@ ReductionResult reduce_pd_code(
2643
2650
  check_timeout(run_options);
2644
2651
  const MidSimplificationApplyResult applied =
2645
2652
  apply_simplification_witness(output.code, search, output.crossingless_components);
2653
+ const PDCode applied_code = canonical_output_code(applied.code);
2646
2654
  ++output.mid_simplification_rounds;
2647
- emit_step_pd(run_options, round, applied.code);
2648
- output.code = applied.code;
2655
+ emit_step_pd(run_options, round, applied_code);
2656
+ output.code = applied_code;
2649
2657
  output.crossingless_components = applied.crossingless_components;
2650
2658
  check_timeout(run_options);
2651
2659
  const PDSimplificationResult simplified =
2652
2660
  simplify_pd_code(output.code, output.crossingless_components);
2653
- output.code = simplified.code;
2661
+ output.code = canonical_output_code(simplified.code);
2654
2662
  output.crossingless_components = simplified.crossingless_components;
2655
2663
  output.reidemeister_i_moves += simplified.reidemeister_i_moves;
2656
2664
  output.nugatory_crossing_moves += simplified.nugatory_crossing_moves;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cpp-pd-code-simplify-interface
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: Python interface for cpp-pd-code-simplify with runtime C++ compilation.
5
5
  License-Expression: MIT
6
6
  Author: GGN_2015
@@ -79,7 +79,8 @@ the C++ backend for that phase. The backend call runs in a helper process, so
79
79
  `Ctrl+C` can terminate active C++ work and its worker threads cleanly.
80
80
  Use `show_step_pd=True`, or CLI flag `--show-step-pd`, to print
81
81
  `step_pd_code[ROUND]: PD[...]` to stdout after each mid-simplification witness
82
- is applied and before that round's automatic R1/nugatory cleanup.
82
+ is applied and canonicalized, before that round's automatic R1/nugatory
83
+ cleanup.
83
84
 
84
85
  Batch use:
85
86
 
@@ -3,10 +3,10 @@ cpp_pd_code_simplify_interface/__main__.py,sha256=ldwc-YVQlsSH9RwXZHCW4r1pmfCBM0
3
3
  cpp_pd_code_simplify_interface/_worker.py,sha256=RPLUE-4amjh78C1fmFolmSIM2_s8AXWk-2fWvASq7A0,2338
4
4
  cpp_pd_code_simplify_interface/main.py,sha256=CDylx7K0tiaNNtu4jYVZfpYMGuSo6tL0RRX5P_lA5bU,39185
5
5
  cpp_pd_code_simplify_interface/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
6
- cpp_pd_code_simplify_interface-0.1.16.dist-info/entry_points.txt,sha256=ThorC4Enxp317TKITsXm9pE0gUp7pt-pP6Dl5mEPUR8,91
7
- cpp_pd_code_simplify_interface-0.1.16.dist-info/METADATA,sha256=PqsV_wAaEO9K7FYhzTC5b_8J7m3yq785CrCHQhXxuFA,4762
8
- cpp_pd_code_simplify_interface-0.1.16.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
6
+ cpp_pd_code_simplify_interface-0.1.18.dist-info/entry_points.txt,sha256=ThorC4Enxp317TKITsXm9pE0gUp7pt-pP6Dl5mEPUR8,91
7
+ cpp_pd_code_simplify_interface-0.1.18.dist-info/METADATA,sha256=iBj6YG4S64oV1ZP0akPZ4LWVtp8OzQgL-h6nwryo3H8,4777
8
+ cpp_pd_code_simplify_interface-0.1.18.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
9
9
  cpp_pd_code_simplify_interface/data/include/pdcode_simplify/pdcode_simplify.hpp,sha256=U49Urs6bMXwkygJsVTnXp-q7y_aWkfRfGimy8mxHoms,5195
10
10
  cpp_pd_code_simplify_interface/data/src/native_interface.cpp,sha256=YiYlbGyWTM_FA0V_XzjHtnb9sD4eqMGQmdom6ivm0f0,7094
11
- cpp_pd_code_simplify_interface/data/src/pdcode_simplify.cpp,sha256=2XhK8pWM_IakPFXybm7k7y3YwvO2Jm73Nn4b5x3HETc,95982
12
- cpp_pd_code_simplify_interface-0.1.16.dist-info/RECORD,,
11
+ cpp_pd_code_simplify_interface/data/src/pdcode_simplify.cpp,sha256=T1CHWXYDfmUd6ZGBlIGwIGXhPeZkBKjKvFc9wV4NJSQ,96381
12
+ cpp_pd_code_simplify_interface-0.1.18.dist-info/RECORD,,