2 * ezSAT -- A simple and easy to use CNF generator for SAT solvers
4 * Copyright (C) 2013 Claire Xenia Wolf <claire@yosyshq.com>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 #define EZMINISAT_SIMPSOLVER 1
24 #define EZMINISAT_VERBOSITY 0
25 #define EZMINISAT_INCREMENTAL 1
30 // minisat is using limit macros and format macros in their headers that
31 // can be the source of some troubles when used from c++11. therefore we
32 // don't force ezSAT users to use minisat headers..
38 class ezMiniSAT
: public ezSAT
41 #if EZMINISAT_SIMPSOLVER
42 typedef Minisat::SimpSolver Solver
;
44 typedef Minisat::Solver Solver
;
46 Solver
*minisatSolver
;
47 std::vector
<int> minisatVars
;
48 bool foundContradiction
;
50 #if EZMINISAT_SIMPSOLVER && EZMINISAT_INCREMENTAL
51 std::set
<int> cnfFrozenVars
;
55 static ezMiniSAT
*alarmHandlerThis
;
56 static clock_t alarmHandlerTimeout
;
57 static void alarmHandler(int);
64 #if EZMINISAT_SIMPSOLVER && EZMINISAT_INCREMENTAL
65 virtual void freeze(int id
);
66 virtual bool eliminated(int idx
);
68 virtual bool solver(const std::vector
<int> &modelExpressions
, std::vector
<bool> &modelValues
, const std::vector
<int> &assumptions
);