From: Andrea Asperti Date: Wed, 19 Oct 2005 15:52:56 +0000 (+0000) Subject: Corrected a mistake in power_upto, and decreased the value of just_factor to X-Git-Tag: V_0_7_2_3~208 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=eb882cc83302a5f6035c3e29018a9aab224d4d25;p=helm.git Corrected a mistake in power_upto, and decreased the value of just_factor to three. --- diff --git a/helm/ocaml/metadata/metadataConstraints.ml b/helm/ocaml/metadata/metadataConstraints.ml index 6431513ff..852c639ce 100644 --- a/helm/ocaml/metadata/metadataConstraints.ml +++ b/helm/ocaml/metadata/metadataConstraints.ml @@ -27,7 +27,7 @@ open Printf open MetadataTypes let critical_value = 7 -let just_factor = 4 +let just_factor = 3 module UriManagerSet = UriManager.UriSet module SetSet = Set.Make (UriManagerSet) @@ -163,7 +163,7 @@ let exec ~(dbd:HMysql.dbd) ?rating (n,from,where) = and table0.source = hits.source order by hits.no desc") from where in -(* prerr_endline query; *) + (* prerr_endline query; *) let result = HMysql.exec dbd query in HMysql.map result (fun row -> match row.(0) with Some s -> UriManager.uri_of_string s | _ -> assert false) @@ -523,7 +523,7 @@ let compute_with_only ~(dbd:HMysql.dbd) ?(facts=false) ?(where = `Conclusion) | (n,s)::l when n = max_prefix_length -> filter ((n,s)::res) l | _::_-> res in filter [] prefixes in - let greater_than = + let greater_than = let all = union (List.map @@ -539,8 +539,9 @@ let compute_with_only ~(dbd:HMysql.dbd) ?(facts=false) ?(where = `Conclusion) List.map (fun uri -> (card, uri)) res)) maximal_prefixes) in + Printf.fprintf stderr "all: %d\n" (List.length all);flush_all (); List.filter (function (_,uri) -> at_most ~dbd ~where constants uri) all in - let equal_to = compute_exactly ~dbd ~facts ~where main prefixes in + let equal_to = compute_exactly ~dbd ~facts ~where main prefixes in greater_than @ equal_to (* real match query implementation *) @@ -584,8 +585,10 @@ let power_upto upto consts = List.sort (fun (n,_) (m,_) -> m - n) (List.fold_left (fun res a -> - List.filter (function (n,l) -> n <= upto) - res@(List.map (function (n,l) -> (n+1,a::l)) res)) + let res' = + List.filter (function (n,l) -> n <= upto) + (List.map (function (n,l) -> (n+1,a::l)) res) in + res@res') [(0,[])] l) let power consts = @@ -606,9 +609,12 @@ let sigmatch ~(dbd:HMysql.dbd) ?(facts=false) ?(where = `Conclusion) | Some (main, types) -> Some main,types in let constants_no = UriManagerSet.cardinal constants in + prerr_endline (("constants_no: ")^(string_of_int constants_no)); if (constants_no > critical_value) then let subsets = let subsets = power_upto just_factor constants in + let _ = prerr_endline (("subsets: ")^ + (string_of_int (List.length subsets))) in let types_no = List.length types in List.map (function (n,l) -> (n+types_no,types@l)) subsets in @@ -616,7 +622,7 @@ let sigmatch ~(dbd:HMysql.dbd) ?(facts=false) ?(where = `Conclusion) let all = match main with None -> types | Some m -> m::types in List.fold_right UriManagerSet.add all constants in - compute_with_only ~dbd ~where main subsets all_constants + compute_with_only ~dbd ~where main subsets all_constants else let subsets = let subsets = power constants in