Turbo Constraint Solver
Loading...
Searching...
No Matches
cpu_solving.hpp
Go to the documentation of this file.
1// Copyright 2023 Pierre Talbot
2
3#ifndef TURBO_CPU_SOLVING_HPP
4#define TURBO_CPU_SOLVING_HPP
5
6#include "common_solving.hpp"
7
9 auto start = std::chrono::high_resolution_clock::now();
10
11 CP<Itv> cp(config);
12 cp.preprocess();
13
14 GaussSeidelIteration fp_engine;
15 local::B has_changed = true;
17 while(!must_quit() && check_timeout(cp, start) && has_changed) {
18 has_changed = false;
19 cp.stats.fixpoint_iterations += fp_engine.fixpoint(*cp.ipc, has_changed);
20 bool must_prune = cp.on_node();
21 if(cp.ipc->is_bot()) {
22 cp.on_failed_node();
23 }
24 else if(cp.search_tree->template is_extractable<AtomicExtraction>()) {
25 has_changed |= cp.bab->deduce();
26 must_prune |= cp.on_solution_node();
27 }
28 has_changed |= cp.search_tree->deduce();
29 if(must_prune) { break; }
30 }
33}
34
35#endif
bool must_quit()
Definition common_solving.hpp:89
void block_signal_ctrlc()
Definition common_solving.hpp:77
bool check_timeout(A &a, const Timepoint &start)
Definition common_solving.hpp:101
void cpu_solve(const Configuration< battery::standard_allocator > &config)
Definition cpu_solving.hpp:8
Definition common_solving.hpp:154
abstract_ptr< IBAB > bab
Definition common_solving.hpp:269
CUDA void print_final_solution()
Definition common_solving.hpp:550
CUDA bool on_solution_node()
Definition common_solving.hpp:539
CUDA bool on_node()
Definition common_solving.hpp:504
abstract_ptr< IPC > ipc
Definition common_solving.hpp:263
abstract_ptr< IST > search_tree
Definition common_solving.hpp:267
CUDA void on_failed_node()
Definition common_solving.hpp:546
void preprocess()
Definition common_solving.hpp:451
Statistics stats
Definition common_solving.hpp:278
CUDA void print_mzn_statistics()
Definition common_solving.hpp:557
Definition config.hpp:28
size_t fixpoint_iterations
Definition statistics.hpp:27