Fixed a bug in proof dot printer (+ indent)

This commit is contained in:
Guillaume Bury 2014-11-07 17:46:32 +01:00
parent cac9df4510
commit d6cfd27f32
2 changed files with 22 additions and 23 deletions

View file

@ -208,8 +208,8 @@ module Make(St : Solver_types.S)(Proof : sig type proof end) = struct
let d = match St.(a.var.level, a.var.reason) with
| 0, Some d -> d
| 0, None ->
let d, cl_d = unit_hyp a in
if is_proved (d, cl_d) then d else raise Exit
let d, cl_d = unit_hyp a in
if is_proved (d, cl_d) then d else raise Exit
| _ -> raise Exit
in
prove d;
@ -274,16 +274,15 @@ module Make(St : Solver_types.S)(Proof : sig type proof end) = struct
Hashtbl.iter (fun c (_, id) -> Hashtbl.replace ids c (false, id)) ids
let is_drawn c =
try
fst (Hashtbl.find ids c)
with Not_found ->
false
ignore (c_id c);
fst (Hashtbl.find ids c)
let has_drawn c =
assert (Hashtbl.mem ids c);
let b, id = Hashtbl.find ids c in
assert (not b);
Hashtbl.replace ids c (true, id)
if not (is_drawn c) then
let b, id = Hashtbl.find ids c in
Hashtbl.replace ids c (true, id)
else
()
let print_clause fmt c = print_cl fmt (to_list c)

View file

@ -7,32 +7,32 @@ exception Out_of_space
(* IO wrappers *)
(* Types for input/output languages *)
type sat_input =
| Dimacs
| Dimacs
type sat_output =
| Standard (* Only output problem status *)
| Dot
| Standard (* Only output problem status *)
| Dot
let input = ref Dimacs
let output = ref Standard
let input_list = [
"dimacs", Dimacs;
"dimacs", Dimacs;
]
let output_list = [
"dot", Dot;
"dot", Dot;
]
let error_msg opt arg l =
Format.fprintf Format.str_formatter "'%s' is not a valid argument for '%s', valid arguments are : %a"
Format.fprintf Format.str_formatter "'%s' is not a valid argument for '%s', valid arguments are : %a"
arg opt (fun fmt -> List.iter (fun (s, _) -> Format.fprintf fmt "%s, " s)) l;
Format.flush_str_formatter ()
Format.flush_str_formatter ()
let set_io opt arg flag l =
try
flag := List.assoc arg l
with Not_found ->
invalid_arg (error_msg opt arg l)
try
flag := List.assoc arg l
with Not_found ->
invalid_arg (error_msg opt arg l)
let set_input s = set_io "Input" s input input_list
let set_output s = set_io "Output" s output output_list
@ -149,8 +149,8 @@ let main () =
| S.Unsat ->
print "Unsat";
if !p_proof_check then begin
let p = S.get_proof () in
print_proof p
let p = S.get_proof () in
print_proof p
end
let () =