Skip to content
Snippets Groups Projects

Resolve "add horn sat algorithm"

Merged aalbert requested to merge 5-add-horn-sat-algorithm into main
Compare and Show latest version
7 files
+ 107
78
Compare changes
  • Side-by-side
  • Inline
Files
7
+ 28
17
open Printf
open Sat_result
(* Processing mode, default to Xor *)
let process = ref Horn.process
let parse_file = ref Horn.parse_file
(* Command line parsing configuration *)
let usage_msg = "project1 [--mode {xor|horn}] <files> ..."
let input_files = ref []
let verbose = ref false
let set_mode s =
if String.equal s "horn" then
(process := Horn.process;
parse_file := Horn.parse_file;)
let mode = ref false
let set_mode s = mode := String.equal "horn" s
let anon_fun filename =
input_files := filename :: !input_files
let speclist =
@@ -29,14 +23,31 @@ let () =
(* start timer *)
let time_begin = Sys.time () in
(* parsing files *)
let parsed_files = List.map !parse_file !input_files in
let time_parse = Sys.time () -. time_begin in
if !mode then (
(* parsing files *)
let parsed_files = List.map Horn.parse_file !input_files in
let time_parse = Sys.time () -. time_begin in
(* processing parsed_files *)
let results = List.map Horn.process parsed_files in
let time_process = Sys.time () -. time_parse -. time_begin in
(* printing results *)
List.iter (print_result !verbose) results;
if !verbose then printf "parsing: %fs, processing: %fs\n" time_parse time_process
) else (
(* parsing files *)
let parsed_files = List.map Xor.parse_file !input_files in
let time_parse = Sys.time () -. time_begin in
(* processing parsed_files *)
let results = List.map !process parsed_files in
let time_process = Sys.time () -. time_parse -. time_begin in
(* processing parsed_files *)
let results = List.map Xor.process parsed_files in
let time_process = Sys.time () -. time_parse -. time_begin in
(* printing results *)
List.iter (print_result !verbose) results;
printf "parsing: %fs, processing: %fs\n" time_parse time_process
(* printing results *)
List.iter (print_result !verbose) results;
if !verbose then printf "parsing: %fs, processing: %fs\n" time_parse time_process
)
Loading