122 MoveCommandResults<ManifoldType> totals,
123 MoveCommandResults<ManifoldType>
const& delta)
124 -> MoveCommandResults<ManifoldType>
126 totals.attempted += delta.attempted;
127 totals.succeeded += delta.succeeded;
128 totals.failed += delta.failed;
135 -> MoveCommandResults<ManifoldType>
137 MoveCommandResults<ManifoldType> result{.attempted = command.attempted(),
138 .succeeded = command.succeeded(),
139 .failed = command.failed()};
140 command.reset_counters();
179 StrategyState initial_strategy_state,
181 MoveRunIdentity
const identity,
182 bool const writes_files,
183 ExecutePass execute_pass, Report report,
184 Checkpoint checkpoint)
185 -> MoveRunResult<ManifoldType, StrategyState>
187 auto current = std::move(initial);
188 auto command_totals = MoveCommandResults<ManifoldType>{};
189 auto strategy_state = std::move(initial_strategy_state);
192 fmt::print(
"Starting {} algorithm in {}+1 dimensions ...\n",
193 identity.algorithm, ManifoldType::dimension - 1);
194 fmt::print(
"Effective random seed: {} (stream {}).\n", identity.seed,
196 fmt::print(
"Making random moves ...\n");
198 for (
auto pass_index =
Int_precision{}; pass_index < cadence.passes();
201 auto const pass_number = pass_index + 1;
202 fmt::print(
"=== Pass {} ===\n", pass_number);
203 auto const attempts = current.N3();
204 auto pass = std::invoke(execute_pass, std::move(current),
205 std::move(strategy_state), attempts);
206 current = std::move(pass.manifold);
208 pass.command_results);
209 strategy_state = std::move(pass.strategy_state);
211 if (pass_number % cadence.checkpoint() == 0)
214 std::invoke(report, std::as_const(current),
215 std::as_const(command_totals),
216 std::as_const(strategy_state));
219 fmt::print(
"Writing checkpoint for pass {}.\n", pass_number);
220 std::invoke(checkpoint, std::as_const(current),
221 std::as_const(command_totals),
222 std::as_const(strategy_state), pass_number);
227 fmt::print(
"=== Run results ===\n");
228 std::invoke(report, std::as_const(current), std::as_const(command_totals),
229 std::as_const(strategy_state));
230 return {.manifold = std::move(current),
231 .command_results = std::move(command_totals),
232 .strategy_state = std::move(strategy_state),
233 .checkpoint_events = checkpoint_events};
auto execute_move_run(ManifoldType initial, StrategyState initial_strategy_state, 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.
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.
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.