Library
Module
Module type
Parameter
Class
Class type
Requires minisat
Process a CNF AST to clauses in order to solve them with Minisat.
val minisat_clauses_of_cnf :
Types.Ast.t ->
Minisat.Lit.t list list * (Minisat.Lit.t, string) Stdlib.Hashtbl.t
minisat_clauses_of_cnf ast
takes a CNF ast
and outputs
module Model : sig ... end
module ModelSet : sig ... end
val solve_clauses :
?verbose:bool ->
?print:((Minisat.Lit.t, string) Stdlib.Hashtbl.t -> Model.t -> int -> unit) ->
?continue:(Model.t -> int -> bool) ->
(Minisat.Lit.t list list * (Minisat.Lit.t, string) Stdlib.Hashtbl.t) ->
ModelSet.t
solve_clauses
finds the models for the given clauses.
print model N
is a function that will print a model as soon as it is found. N
is the number of the model, it begins at 1. It can be useful to print the models as they appear because finding all models (if limit
is large) can be extremely long. Example: ~print:(SatSolve.Model.pprint table model)
verbose
allows to turn on the verbose mode of minisat; apparently, this minisat feature doesn't seem to be working and doesn't display any time information.
continue model nth
is a function called after every model that has been found. model
contains the found model and N
says that this model was the nth model found. This function tells solve_clauses
to go on searching models or not.
string_of_clause
dumps the clause in its literal-number form: e.g., 1 -5 3 9 -2 -7
string_of_clauses
does string_of_clause
with newlines between clauses.
val print_dimacs :
?debug_dimacs:bool ->
(Minisat.Lit.t list list * (Minisat.Lit.t, string) Stdlib.Hashtbl.t) ->
?out_table:Stdlib.out_channel ->
Stdlib.out_channel ->
unit
print_dimacs (clauses, table) out
takes the result of minisat_clauses_of_cnf
and prints the following:
~out_table
is given, print the mapping table from litterals integers to names. If out
and out_table
are the same, then the mapping table will be printed in DIMACS comments (e.g., 'c p(a,b) 5').See on Google "Satisfiability Suggested Format" (May 8, 1993)