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 local::B has_changed2 = false;
20 cp.stats.fixpoint_iterations += fp_engine.fixpoint(*cp.ipc, has_changed2);
21 bool must_prune = cp.on_node();
22 if(cp.ipc->is_bot()) {
23 cp.on_failed_node();
24 }
25 else if(cp.search_tree->template is_extractable<AtomicExtraction>()) {
26 has_changed |= cp.bab->deduce();
27 must_prune |= cp.on_solution_node();
28 }
29 has_changed |= cp.search_tree->deduce();
30 if(must_prune) { break; }
31 }
34}
35
36#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:156
abstract_ptr< IBAB > bab
Definition common_solving.hpp:275
CUDA void print_final_solution()
Definition common_solving.hpp:561
CUDA bool on_solution_node()
Definition common_solving.hpp:550
CUDA bool on_node()
Definition common_solving.hpp:515
abstract_ptr< IPC > ipc
Definition common_solving.hpp:269
abstract_ptr< IST > search_tree
Definition common_solving.hpp:273
CUDA void on_failed_node()
Definition common_solving.hpp:557
void preprocess()
Definition common_solving.hpp:462
Statistics stats
Definition common_solving.hpp:284
CUDA void print_mzn_statistics()
Definition common_solving.hpp:568
Definition config.hpp:29
size_t fixpoint_iterations
Definition statistics.hpp:41