Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <synchronization.h>
Public Member Functions | |
SharedClausesManager (bool always_synchronize, absl::Duration share_frequency) | |
void | AddBinaryClause (int id, int lit1, int lit2) |
std::vector< absl::Span< const int > > | GetUnseenClauses (int id) |
void | GetUnseenBinaryClauses (int id, std::vector< std::pair< int, int > > *new_clauses) |
int | RegisterNewId () |
Ids are used to identify which worker is exporting/importing clauses. | |
void | SetWorkerNameForId (int id, const std::string &worker_name) |
UniqueClauseStream * | GetClauseStream (int id) |
void | LogStatistics (SolverLogger *logger) |
Search statistics. | |
void | Synchronize () |
This class holds clauses found and shared by workers. It is exact for binary clauses, but approximate for longer ones.
It is thread-safe.
Definition at line 687 of file synchronization.h.
|
explicit |
Definition at line 1179 of file synchronization.cc.
void operations_research::sat::SharedClausesManager::AddBinaryClause | ( | int | id, |
int | lit1, | ||
int | lit2 ) |
Small optim. If the worker is already up to date with clauses to import, we can mark this new clause as already seen.
Definition at line 1201 of file synchronization.cc.
|
inline |
A worker can add or remove clauses from its own clause set. Retains ownership of the returned ClauseFilter.
Definition at line 711 of file synchronization.h.
void operations_research::sat::SharedClausesManager::GetUnseenBinaryClauses | ( | int | id, |
std::vector< std::pair< int, int > > * | new_clauses ) |
Fills new_clauses with {{lit1 of clause1, lit2 of clause1}, {lit1 of clause2, lit2 of clause2}, ...}
Definition at line 1235 of file synchronization.cc.
std::vector< absl::Span< const int > > operations_research::sat::SharedClausesManager::GetUnseenClauses | ( | int | id | ) |
Returns new glue clauses. The spans are guaranteed to remain valid until the next call to SyncClauses().
Definition at line 1221 of file synchronization.cc.
void operations_research::sat::SharedClausesManager::LogStatistics | ( | SolverLogger * | logger | ) |
Search statistics.
Definition at line 1248 of file synchronization.cc.
int operations_research::sat::SharedClausesManager::RegisterNewId | ( | ) |
Ids are used to identify which worker is exporting/importing clauses.
Definition at line 1184 of file synchronization.cc.
void operations_research::sat::SharedClausesManager::SetWorkerNameForId | ( | int | id, |
const std::string & | worker_name ) |
Definition at line 1195 of file synchronization.cc.
void operations_research::sat::SharedClausesManager::Synchronize | ( | ) |
Unlocks waiting binary clauses for workers if always_synchronize is false. Periodically starts a new sharing round, making glue clauses visible.
Tune LBD threshold for individual workers based on how the worker's buffer is. We aim to ensure workers can always export their fair share of clauses.
Use progressive filling to attempt to fill the batch with clauses of minimum size, this is max-min fair.
Some workers need to export more clauses to fill the batch due to rounding, but we don't want all workers to round up.
Delete batches that have been consumed by all workers. Keep a few batches around for startup (min finished batch doesn't count workers that haven't registered yet). This also ensures that our fingerprint table always contains the last few batches, so we reduce the chance of an old buffered duplicate clause on a worker being emitted from the global stream multiple times.
Definition at line 1265 of file synchronization.cc.