#ifndef sweep_hpp_INCLUDED #define sweep_hpp_INCLUDED #include #include #include #include "vec.hpp" namespace CaDiCaL { struct Solver; } struct aiger; struct circuit; class Graph { public: struct Edge { int from; int to; int neg; }; std::vector> edge; std::vector> redge; void add(int u, int v, int w) { edge.resize(std::max(std::max(u, v)+1, (int)edge.size())); redge.resize(std::max(std::max(u, v)+1, (int)redge.size())); edge[u].push_back(Edge{u, v, w}); redge[v].push_back(Edge{v, u, w}); } }; class Sweep { public: FILE* file; Graph graph; int maxvar, output; int *used, *det_v, *seen, *sum_pos, *sum_neg, *del; int det_v_sz = 0; int rounds; std::chrono::high_resolution_clock::time_point clk_st = std::chrono::high_resolution_clock::now(); circuit *C; aiger *aig; CaDiCaL::Solver * solver; std::map topo_index; std::map rtopo_index; std::set> eqp; std::vector> classes; std::vector> > pairs; vec *inv_C; void solve(); void aiger_preprocess(); void cal_topo_index(); void propagate(int* input, int* result); void circuit_propagate(int* input, int* result); void random_simulation(); void simulation(); bool check_var_equal(int x, int y, int assume); bool check_constant(int x, int val); void check_entire_problem(aiger* aig); void check_with_SAT(); void identify(); bool match_xor(int x); bool match_majority(int x); void adjust_not(); void match_HA(); void match_FA(); bool line_positive(int to); void recalculate_outs(); void to_multi_input_gates(); void simplify(); void miter(); void to_dot_graph(const char* filename, int end_point); int get_time(); }; #endif