cloud-sat/workers/basekissat.hpp

69 lines
1.8 KiB
C++
Raw Normal View History

2022-08-30 15:42:35 +08:00
#include "basesolver.hpp"
2023-03-15 14:15:44 +08:00
#include <deque>
2022-08-30 15:42:35 +08:00
struct kissat;
2022-09-15 10:31:41 +08:00
struct cvec;
2022-08-30 15:42:35 +08:00
class basekissat : public basesolver {
public:
void terminate();
2023-02-28 15:14:04 +08:00
void add(int l);
2022-08-30 15:42:35 +08:00
int solve();
2023-02-28 15:14:04 +08:00
int val(int l);
2023-03-01 22:05:44 +08:00
void configure(const char* name, int id);
2023-03-15 14:15:44 +08:00
2023-02-28 15:14:04 +08:00
int get_conflicts();
void parse_from_CNF(char* filename);
void parse_from_PAR(preprocess *pre);
2022-08-30 15:42:35 +08:00
void get_model(vec<int> &model);
2023-02-28 15:14:04 +08:00
void exp_clause(void *cl, int lbd);
bool imp_clause(clause_store *cls, void *cl);
2022-09-08 13:54:29 +08:00
void export_clauses_to(vec<clause_store *> &clauses);
void import_clauses_from(vec<clause_store *> &clauses);
2022-09-15 10:31:41 +08:00
void broaden_export_limit();
void restrict_export_limit();
2023-03-01 22:05:44 +08:00
double get_waiting_time();
2022-08-30 15:42:35 +08:00
basekissat(int id, light *light);
~basekissat();
2022-12-04 23:30:36 +08:00
int x1 = 0, x2 = 0;
2023-03-01 22:05:44 +08:00
double waiting_time = 0;
2022-08-30 15:42:35 +08:00
kissat* solver;
2022-09-08 13:54:29 +08:00
int good_clause_lbd = 0;
2022-12-04 23:30:36 +08:00
2023-03-15 14:15:44 +08:00
void select_clauses();
int get_period() {
boost::mutex::scoped_lock lock(mtx);
return period;
};
void inc_period() {
boost::mutex::scoped_lock lock(mtx);
period++;
if (period % 100 == 0) printf("c %d reach period %d\n", id, period);
cond.notify_all();
};
void set_winner_period() {
boost::mutex::scoped_lock lock(mtx);
winner_period = period;
cond.notify_all();
}
void dps_terminate() {
{
boost::mutex::scoped_lock lock(mtx);
terminated = 1;
cond.notify_all();
// printf("c thread %d terminated\n", id);
}
terminate();
}
2022-09-15 10:31:41 +08:00
friend int cbkImportClause(void *, int *, cvec *);
friend int cbkExportClause(void *, int *, cvec *);
2023-03-15 14:15:44 +08:00
friend int cbkWaitSharing(void *);
friend void cbkFreeClause(void *);
2022-09-15 10:31:41 +08:00
std::ofstream outimport;
std::ofstream outexport;
std::ofstream outfree;
2022-08-30 15:42:35 +08:00
};