cloud-sat/workers/basesolver.hpp
2023-03-01 22:05:44 +08:00

46 lines
1.5 KiB
C++

#ifndef _basesolver_hpp_INCLUDED
#define _basesolver_hpp_INCLUDED
#include "../light.hpp"
#include "../utils/vec.hpp"
#include "clause.hpp"
#include <fstream>
#include <iostream>
#include <boost/thread/thread.hpp>
#include <boost/lockfree/spsc_queue.hpp>
class sharer;
class basesolver {
public:
virtual void add(int l) = 0;
virtual int solve() = 0;
virtual int val(int l) = 0;
virtual void terminate() = 0;
virtual void configure(const char* name, int id) = 0;
virtual int get_conflicts() = 0;
virtual void parse_from_CNF(char* filename) = 0;
virtual void parse_from_PAR(preprocess* pre) = 0;
virtual void get_model(vec<int> &model) = 0;
virtual void exp_clause(void *cl, int lbd) = 0;
virtual bool imp_clause(clause_store *cls, void *cl) = 0;
virtual void export_clauses_to(vec<clause_store *> &clauses) = 0;
virtual void import_clauses_from(vec<clause_store *> &clauses) = 0;
virtual void broaden_export_limit() = 0;
virtual void restrict_export_limit() = 0;
virtual double get_waiting_time() = 0;
light * controller;
int id;
sharer* in_sharer;
boost::lockfree::spsc_queue<clause_store*, boost::lockfree::capacity<1024000>> import_clause;
boost::lockfree::spsc_queue<clause_store*, boost::lockfree::capacity<1024000>> export_clause;
basesolver(int sid, light* light) : id(sid), controller(light) {}
~basesolver() {
if (controller) {
controller = NULL;
}
}
};
#endif