123 MoveCommandResults<ManifoldType> totals,
124 MoveCommandResults<ManifoldType>
const& delta)
125 -> MoveCommandResults<ManifoldType>
127 totals.attempted += delta.attempted;
128 totals.succeeded += delta.succeeded;
129 totals.failed += delta.failed;
136 -> MoveCommandResults<ManifoldType>
138 MoveCommandResults<ManifoldType> result{.attempted = command.attempted(),
139 .succeeded = command.succeeded(),
140 .failed = command.failed()};
141 command.reset_counters();
180 ManifoldType initial,
181 MoveCommandResults<ManifoldType> initial_command_results,
182 StrategyState initial_strategy_state,
184 MoveRunIdentity
const identity,
bool const writes_files,
185 ExecutePass execute_pass, Report report, Checkpoint checkpoint)
186 -> MoveRunResult<ManifoldType, StrategyState>
188 if (completed_passes < 0 ||
190 std::numeric_limits<Int_precision>::max() - cadence.passes())
192 throw std::invalid_argument(
193 "Completed and configured passes exceed the supported range.");
195 auto current = std::move(initial);
196 auto command_totals = std::move(initial_command_results);
197 auto strategy_state = std::move(initial_strategy_state);
200 fmt::print(
"Starting {} algorithm in {}+1 dimensions ...\n",
201 identity.algorithm, ManifoldType::dimension - 1);
202 fmt::print(
"Effective random seed: {} (stream {}).\n", identity.seed,
204 fmt::print(
"Making random moves ...\n");
206 for (
auto pass_index =
Int_precision{}; pass_index < cadence.passes();
209 auto const pass_number = completed_passes + pass_index + 1;
210 fmt::print(
"=== Pass {} ===\n", pass_number);
211 auto const attempts = current.N3();
212 auto pass = std::invoke(execute_pass, std::move(current),
213 std::move(strategy_state), attempts);
214 current = std::move(pass.manifold);
216 pass.command_results);
217 strategy_state = std::move(pass.strategy_state);
219 if (pass_number % cadence.checkpoint() == 0)
222 std::invoke(report, std::as_const(current),
223 std::as_const(command_totals),
224 std::as_const(strategy_state));
227 fmt::print(
"Writing checkpoint for pass {}.\n", pass_number);
228 std::invoke(checkpoint, std::as_const(current),
229 std::as_const(command_totals),
230 std::as_const(strategy_state), pass_number);
235 fmt::print(
"=== Run results ===\n");
236 std::invoke(report, std::as_const(current), std::as_const(command_totals),
237 std::as_const(strategy_state));
238 return {.manifold = std::move(current),
239 .command_results = std::move(command_totals),
240 .strategy_state = std::move(strategy_state),
241 .checkpoint_events = checkpoint_events};
auto parse_move_run_cadence(Int_precision const passes, Int_precision const checkpoint, std::string_view const strategy_name) -> MoveRunCadence
Convert a raw constructor boundary or throw its established error.
auto execute_move_run(ManifoldType initial, MoveCommandResults< ManifoldType > initial_command_results, StrategyState initial_strategy_state, Int_precision const completed_passes, MoveRunCadence const cadence, MoveRunIdentity const identity, bool const writes_files, ExecutePass execute_pass, Report report, Checkpoint checkpoint) -> MoveRunResult< ManifoldType, StrategyState >
Execute shared pass, accounting, checkpoint, and report cadence.
static auto parse(Int_precision const passes, Int_precision const checkpoint) noexcept -> std::expected< MoveRunCadence, MoveRunCadenceError >
Parse raw counts into a cadence that proves positivity.