14#ifndef INCLUDE_MOVE_ALWAYS_HPP_
15#define INCLUDE_MOVE_ALWAYS_HPP_
21template <
typename ManifoldType>
55 : m_passes{t_number_of_passes}, m_checkpoint{t_checkpoint}
59 [[nodiscard]]
auto passes()
const {
return m_passes; }
62 [[nodiscard]]
auto checkpoint()
const {
return m_checkpoint; }
74 auto operator()(ManifoldType
const& t_manifold) -> ManifoldType
77 spdlog::debug(
"{} called.\n", __PRETTY_FUNCTION__);
79 fmt::print(
"Starting Move Always algorithm in {}+1 dimensions ...\n",
80 ManifoldType::dimension - 1);
85 fmt::print(
"Making random moves ...\n");
88 for (
auto pass_number = 1; pass_number <= m_passes; ++pass_number)
90 fmt::print(
"=== Pass {} ===\n", pass_number);
93 for (
auto move_attempt = 0; move_attempt < total_simplices_this_pass;
97 auto move_choice = utilities::generate_random_int(
98 0, move_tracker::moves_per_dimension(ManifoldType::dimension) - 1);
100 fmt::print(
"Move choice = {}\n", move_choice);
102 if (move_choice == 0 && ManifoldType::dimension == 3)
104 command.
enqueue(move_tracker::move_type::TWO_THREE);
107 if (move_choice == 1 && ManifoldType::dimension == 3)
109 command.
enqueue(move_tracker::move_type::THREE_TWO);
112 if (move_choice == 2 && ManifoldType::dimension == 3)
114 command.
enqueue(move_tracker::move_type::TWO_SIX);
117 if (move_choice == 3 && ManifoldType::dimension == 3)
119 command.
enqueue(move_tracker::move_type::SIX_TWO);
122 if (move_choice == 4 && ManifoldType::dimension == 3)
124 command.
enqueue(move_tracker::move_type::FOUR_FOUR);
139 if (ManifoldType::dimension == 3)
141 fmt::print(
"=== Move Results ===\n");
142 fmt::print(
"(2,3) moves: {} attempted = {} successful and {} failed.\n",
146 fmt::print(
"(3,2) moves: {} attempted = {} successful and {} failed.\n",
150 fmt::print(
"(2,6) moves: {} attempted = {} successful and {} failed.\n",
154 fmt::print(
"(6,2) moves: {} attempted = {} successful and {} failed.\n",
158 fmt::print(
"(4,4) moves: {} attempted = {} successful and {} failed.\n",
Do ergodic moves using the Command pattern.
Template class for move algorithms (strategies) on manifolds.
Strategies
The algorithms available to make ergodic moves on triangulations.
std::int_fast32_t Int_precision
void execute()
Execute all moves in the queue on the manifold.
auto get_attempted() const -> Counter const &
Attempted moves by MoveCommand.
auto get_results() -> ManifoldType &
Results of the moves invoked by MoveCommand.
auto get_failed() const -> Counter const &
Failed moves by MoveCommand.
auto get_succeeded() const
Successful moves by MoveCommand.
auto get_const_results() const -> ManifoldType const &
A read-only reference to the manifold.
void enqueue(move_tracker::move_type const t_move)
Push a Pachner move onto the move queue.
Counter m_successful_moves
The number of moves that succeeded in the MoveCommand.
auto operator()(ManifoldType const &t_manifold) -> ManifoldType
Call operator.
MoveStrategy(Int_precision const t_number_of_passes, Int_precision const t_checkpoint)
Constructor for MoveAlways.
void print_results()
Display results of run.
Counter m_attempted_moves
The number of moves that were attempted by a MoveCommand.
auto get_succeeded() const
Counter m_failed_moves
The number of moves that a MoveCommand failed to make due to an error.
auto get_attempted() const
MoveStrategy()=default
Default ctor.
The data and methods to track ergodic moves.
auto two_six_moves() -> auto &
Write access to (2,6) moves.
auto four_four_moves() -> auto &
Write access to (4,4) moves.
auto six_two_moves() -> auto &
Write access to (6,2) moves.
auto three_two_moves() -> auto &
Write access to (3,2) moves.
auto two_three_moves() -> auto &
Write access to (2,3) moves.