[m-rev.] for review: build subtrees based on desired nodes, instead of desired depth
Ian MacLarty
maclarty at cs.mu.OZ.AU
Mon Apr 18 18:33:16 AEST 2005
On Mon, Apr 18, 2005 at 06:20:49PM +1000, Julien Fischer wrote:
>
> On Sat, 16 Apr 2005, Ian MacLarty wrote:
>
> > For review by anyone.
> >
> > Estimated hours taken: 30
> > Branches: main
> >
> > In the declarative debugger, instead of building new explicit subtrees down to
> > a fixed depth, allow the desired number of nodes in the subtree to be given and
> > estimate the depth that would produce such a subtree. This depth can be
> > estimated from the average branching factor of the tree and the desired number
> > of nodes to generate. The average branching factor, in turn, can be calculated
> s/to generate/to be generated/
>
Okay.
> > Index: browser/declarative_debugger.m
> > ===================================================================
> > + % number are for the final event required (the
> > + % first event required is the call event with
> > + % the same sequence number).
> > + %
> > + require_subtree_final_event :: event_number,
> > + require_subtree_seqno :: sequence_number,
> > +
> > + % The node preceeding the call node. This
> s/preceeding/preceding/
>
Fixed.
> > + int::in, int::in, diagnoser_response(R)::out,
> > diagnoser_state(R)::in, diagnoser_state(R)::out,
> > browser_info.browser_persistent_state::in,
> > browser_info.browser_persistent_state::out,
> > @@ -309,7 +321,13 @@
> > :- import_module mdb.util.
> > :- import_module mdbcomp.prim_data.
> >
> > -:- import_module exception, int, map, bool.
> > +:- import_module exception.
> > +:- import_module float.
> > +:- import_module int.
> > +:- import_module map.
> > +:- import_module bool.
> > +
> This list of module imports should be sorted.
>
Fixed.
> > + try_io(diagnosis_2(Store, AnalysisType, DesiredSubtreeWeight,
> > + !.Diagnoser), Result, !IO),
> > (
> > Result = succeeded({Response, !:Diagnoser})
> > ;
> > @@ -397,34 +415,39 @@
> > !:Browser = mdb.declarative_oracle.get_browser_state(
> > !.Diagnoser ^ oracle_state).
> >
> > -:- pred diagnosis_2(S::in, analysis_type(edt_node(R))::in,
> > +:- pred diagnosis_2(S::in, analysis_type(edt_node(R))::in, int::in,
> > diagnoser_state(R)::in,
>
> I suggest defining the equivalence desired_weight == int, or something
> similar, and using that in the predicate declarations rather than
> just int.
>
I've defined
:- type weight == int.
:- type depth == int.
and used them here.
> > + % so to find b, we must find the root of
> > + % f(b) = 1 - n + b + b^2 + ... + b^(d-1).
> > + %
> > + binary_converge_to_root(
> > + poly_with_unit_coefficients(Depth - 1, 1.0 - float(Weight)),
> > + 0.1, 1.0, 10.0, 1000.0, 50).
> > +
> > +:- func depth_for_desired_weight(int, float) = int.
> > +
> > +depth_for_desired_weight(Weight, BranchingFactor) =
> > + %
> > + % To find the depth of a tree given it's average branching
> s/it's/its/
>
Fixed.
> (You've just posted another version of this bit, so I'll ignore this one).
>
> ...
>
> > @@ -801,6 +838,18 @@
> >
> > call = MR_trace_matching_call(prev);
> > MR_decl_checkpoint_match(call);
> > +
> > + /*
> > + ** We need to add 1 to MR_edt_depth since this is an EXIT
> > + ** event, so 1 would already have been subtracted from MR_edt_depth
> s/would/should/ (and below)
>
Fixed.
> > + ** in MR_trace_calculate_event_depth.
> > + */
> > + if (MR_edt_depth + 1 == MR_edt_max_depth) {
> > + MR_DD_call_node_update_implicit_tree_info(call,
> > + MR_edt_implicit_tree_max_depth
> > + - event_info->MR_call_depth);
> > + }
> > +
> > MR_TRACE_CALL_MERCURY(
> > last_interface = MR_DD_call_node_get_last_interface(
> >
>
> Julien.
Cheers,
Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list