#ifndef PARALLELSOLVER_H
#define PARALLELSOLVER_H
#include "core/SolverTypes.h"
#include "core/Solver.h"
#include "simp/SimpSolver.h"
#include "parallel/SharedCompanion.h"
namespace Glucose {
enum ParallelStats{
nbexported=coreStatsSize,
nbimported,
nbexportedunit,
nbimportedunit,
nbimportedInPurgatory,
nbImportedGoodClauses
} ;
#define parallelStatsSize (coreStatsSize + 6)
class ParallelSolver : public SimpSolver {
friend class MultiSolvers;
friend class SolverCompanion;
friend class SharedCompanion;
protected :
int thn; SharedCompanion *sharedcomp;
bool coreFUIP; bool ImTheSolverFUIP;
pthread_mutex_t *pmfinished; pthread_cond_t *pcfinished;
public:
ParallelSolver(int threadId);
ParallelSolver(const ParallelSolver &s);
~ParallelSolver();
virtual Clone* clone() const {
return new ParallelSolver(*this);
}
int threadNumber () const;
void setThreadNumber (int i);
void reportProgress();
void reportProgressArrayImports(vec<unsigned int> &totalColumns);
virtual void reduceDB();
virtual lbool solve_ (bool do_simp = true, bool turn_off_simp = false);
vec<Lit> importedClause; unsigned int goodlimitlbd; int goodlimitsize;
bool purgatory; bool shareAfterProbation; bool plingeling; int nbTimesSeenBeforeExport;
uint32_t firstSharing, limitSharingByGoodLBD, limitSharingByFixedLimitLBD, limitSharingByFixedLimitSize;
uint32_t probationByFollowingRoads, probationByFriend;
uint32_t survivorLayers; bool dontExportDirectReusedClauses ; uint64_t nbNotExportedBecauseDirectlyReused;
vec<uint32_t> goodImportsFromThreads;
virtual void parallelImportClauseDuringConflictAnalysis(Clause &c,CRef confl);
virtual bool parallelImportClauses(); virtual void parallelImportUnaryClauses();
virtual void parallelExportUnaryClause(Lit p);
virtual void parallelExportClauseDuringSearch(Clause &c);
virtual bool parallelJobIsFinished();
virtual bool panicModeIsEnabled();
bool shareClause(Clause & c);
};
inline int ParallelSolver::threadNumber () const {return thn;}
inline void ParallelSolver::setThreadNumber (int i) {thn = i;}
}
#endif