cpp-pd-code-simplify-interface 0.1.16__py3-none-any.whl → 0.1.17__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.
@@ -1842,6 +1842,18 @@ void emit_step_pd(const SimplifierOptions& options, int round, const PDCode& cod
1842
1842
  }
1843
1843
  }
1844
1844
 
1845
+ std::string no_path_restart_signature(
1846
+ const PDCode& code,
1847
+ std::size_t crossingless_components) {
1848
+ std::ostringstream out;
1849
+ out << crossingless_components << ':' << format_final_pd_code(code);
1850
+ return out.str();
1851
+ }
1852
+
1853
+ PDCode canonical_output_code(const PDCode& code) {
1854
+ return parse_pd_code(format_final_pd_code(code));
1855
+ }
1856
+
1845
1857
  std::string search_mode_for_options(const SimplifierOptions& options) {
1846
1858
  if (options.max_paths == -1 && !options.ban_heuristic) {
1847
1859
  return "heuristic";
@@ -2538,6 +2550,7 @@ ReductionResult reduce_pd_code(
2538
2550
  ReductionResult output;
2539
2551
  output.code = code;
2540
2552
  output.crossingless_components = known_crossingless_components;
2553
+ std::set<std::string> exhausted_no_path_signatures;
2541
2554
 
2542
2555
  try {
2543
2556
  check_timeout(run_options);
@@ -2630,6 +2643,45 @@ ReductionResult reduce_pd_code(
2630
2643
  }
2631
2644
 
2632
2645
  if (!search.found) {
2646
+ if (run_options.max_paths == -1) {
2647
+ check_timeout(run_options);
2648
+ const std::string signature = no_path_restart_signature(
2649
+ output.code, output.crossingless_components);
2650
+ if (exhausted_no_path_signatures.insert(signature).second) {
2651
+ const std::size_t before_restart_crossings = output.code.size();
2652
+ const std::size_t before_restart_crossingless =
2653
+ output.crossingless_components;
2654
+ const PDSimplificationResult restarted =
2655
+ simplify_pd_code(
2656
+ canonical_output_code(output.code),
2657
+ output.crossingless_components);
2658
+ const bool changed =
2659
+ restarted.code != output.code ||
2660
+ restarted.crossingless_components != output.crossingless_components;
2661
+ output.code = restarted.code;
2662
+ output.crossingless_components = restarted.crossingless_components;
2663
+ output.reidemeister_i_moves += restarted.reidemeister_i_moves;
2664
+ output.nugatory_crossing_moves += restarted.nugatory_crossing_moves;
2665
+ {
2666
+ std::ostringstream message;
2667
+ message << "round " << round
2668
+ << " canonical_restart changed="
2669
+ << (changed ? "yes" : "no")
2670
+ << " crossings=" << before_restart_crossings
2671
+ << " -> " << output.code.size()
2672
+ << " crossingless_components="
2673
+ << before_restart_crossingless
2674
+ << " -> " << output.crossingless_components
2675
+ << " r1_moves=" << restarted.reidemeister_i_moves
2676
+ << " nugatory_moves="
2677
+ << restarted.nugatory_crossing_moves;
2678
+ emit_progress(run_options, message.str());
2679
+ }
2680
+ if (changed) {
2681
+ continue;
2682
+ }
2683
+ }
2684
+ }
2633
2685
  {
2634
2686
  std::ostringstream message;
2635
2687
  message << "round " << round
@@ -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.17
4
4
  Summary: Python interface for cpp-pd-code-simplify with runtime C++ compilation.
5
5
  License-Expression: MIT
6
6
  Author: GGN_2015
@@ -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.17.dist-info/entry_points.txt,sha256=ThorC4Enxp317TKITsXm9pE0gUp7pt-pP6Dl5mEPUR8,91
7
+ cpp_pd_code_simplify_interface-0.1.17.dist-info/METADATA,sha256=qlta3fIRH0DzDkErujQ1wMVvKC0HSOVJ3fHMfjEkU20,4762
8
+ cpp_pd_code_simplify_interface-0.1.17.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=XbnEntjvRvTCY8fSa49c9t6xMPbWkLqFij9ivpOkWN4,98792
12
+ cpp_pd_code_simplify_interface-0.1.17.dist-info/RECORD,,