You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
621 B

6 years ago
  1. #ifndef KSAT_CLAUSE_2_MINISAT_CLAUSE
  2. #define KSAT_CLAUSE_2_MINISAT_CLAUSE
  3. #include "util/convert.h"
  4. #include "util/ksatinstance.h"
  5. #include "core/SolverTypes.h"
  6. #include <cmath>
  7. namespace satlab
  8. {
  9. namespace types
  10. {
  11. template<typename = Minisat::vec<Minisat::Lit>, typename = KSATinstance::CLAUSE>
  12. void convert(Minisat::vec<Minisat::Lit>& clauseVec,
  13. const KSATinstance::CLAUSE& clause)
  14. {
  15. clauseVec.clear();
  16. int var;
  17. for(auto lit : clause)
  18. {
  19. var = abs(lit) - 1;
  20. clauseVec.push(Minisat::mkLit(var, lit < 0));
  21. }
  22. }
  23. }
  24. }
  25. #endif // KSAT_CLAUSE_2_MINISAT_CLAUSE