sml-050222a-move_dn1: intermediate state for new get_allpos sml-050222a-move_dn1
authorwneuper
Tue, 22 Feb 2005 17:03:43 +0100
changeset 211731f79b68d66a
parent 2116 f6774aa3bfb3
child 2118 4b3a4b3392fc
sml-050222a-move_dn1: intermediate state for new get_allpos
src/sml/ME/ctree.sml
src/sml/ME/ctreeNEW.sml
src/sml/systest/ctree.sml
     1.1 --- a/src/sml/ME/ctree.sml	Tue Feb 22 11:50:11 2005 +0100
     1.2 +++ b/src/sml/ME/ctree.sml	Tue Feb 22 17:03:43 2005 +0100
     1.3 @@ -1729,24 +1729,27 @@
     1.4     *)
     1.5      if is_pblobj c 
     1.6      then case p_ of (*Frm => ([], Pbl) 1.12.03
     1.7 -		  |*) Res => raise PTREE "end of calculation"
     1.8 +		  |*) Res => raise PTREE "move_dn: end of calculation"
     1.9  		  | _ => if null ns (*go down from Pbl + Met*)
    1.10 -			 then raise PTREE "solve problem not started"
    1.11 +			 then raise PTREE "move_dn: solve problem not started"
    1.12  			 else ([1], Frm)
    1.13 -    else raise PTREE "pos not existent 1"
    1.14 +    else (case p_ of Res => raise PTREE "move_dn: end of (sub-)tree"
    1.15 +		  | _ => if null ns
    1.16 +			 then raise PTREE "move_dn: pos not existent 1"
    1.17 +			 else ([1], Frm))
    1.18  
    1.19    (*iterate towards end of pos*)
    1.20  (* val (P,(Nd (_, ns)),(p::(ps as (_::_)),p_)) = ([]:pos, pt, get_pos cI uI);
    1.21     val (P,(Nd (_, ns)),(p::(ps as (_::_)),p_)) = ((P@[p]),(nth p ns),(ps, p_));
    1.22     *) 
    1.23   | move_dn P  (Nd (_, ns)) (p::(ps as (_::_)),p_) =
    1.24 -    if p > length ns then raise PTREE "pos not existent 2"
    1.25 +    if p > length ns then raise PTREE "move_dn: pos not existent 2"
    1.26      else move_dn ((P@[p]): pos) (nth p ns) (ps, p_)
    1.27  (* val (P, (Nd (c, ns)), ([p], p_)) = ((P@[p]), (nth p ns), (ps, p_));
    1.28     val (P, (Nd (c, ns)), ([p], p_)) = ([],pt,get_pos cI uI);
    1.29     *)
    1.30    | move_dn P (Nd (c, ns)) ([p], p_) = (*act on last element of pos*)
    1.31 -    if p > length ns then raise PTREE "pos not existent 3"
    1.32 +    if p > length ns then raise PTREE "move_dn: pos not existent 3"
    1.33      else if is_pblnd (nth p ns)  then
    1.34  	((*writeln("### move_dn: is_pblnd (nth p ns), P= "^ints2str' P^", \n"^
    1.35  		 "length ns= "^((string_of_int o length) ns)^
    1.36 @@ -1761,7 +1764,7 @@
    1.37  			   else (P@[p+1], if is_pblnd (nth (p+1) ns) 
    1.38  					  then Pbl else Frm)
    1.39  		  | _ => if (null o children o (nth p)) ns (*go down from Pbl*)
    1.40 -			 then raise PTREE "solve subproblem not started"
    1.41 +			 then raise PTREE "move_dn: solve subproblem not started"
    1.42  			 else (P @ [p, 1], 
    1.43  			       if (is_pblnd o hd o children o (nth p)) ns
    1.44  			       then Pbl else Frm)
    1.45 @@ -1772,7 +1775,7 @@
    1.46  			 (*then if g_ostate c = Complete then (P@[p],Res)*)
    1.47  			   then if g_ostate' (nth p ns) = Complete 
    1.48  				then (P@[p],Res)
    1.49 -				else raise PTREE "pos not existent 4"
    1.50 +				else raise PTREE "move_dn: pos not existent 4"
    1.51  			   else (P @ [p, 1], (*go down*) 
    1.52  				 if (is_pblnd o hd o children o (nth p)) ns
    1.53  				 then Pbl else Frm)
     2.1 --- a/src/sml/ME/ctreeNEW.sml	Tue Feb 22 11:50:11 2005 +0100
     2.2 +++ b/src/sml/ME/ctreeNEW.sml	Tue Feb 22 17:03:43 2005 +0100
     2.3 @@ -40,6 +40,7 @@
     2.4  	else (cuts @ [nxt]): pos' list
     2.5       end) handle PTREE _ => cuts;
     2.6  print_depth 3;
     2.7 +(*###################################################################*)
     2.8  print_depth 11;
     2.9  (* val (cuts, P, pt, pos) = ([], [3], get_nd pt [3], ([], Frm):pos');
    2.10     val (cuts, P, pt, pos) = ([], [2], get_nd pt [2], ([], Frm):pos');
    2.11 @@ -52,6 +53,7 @@
    2.12  	else (map (apfst (curry op@ P)) (cuts @ [nxt])): pos' list
    2.13       end) handle PTREE _ => (map (apfst (curry op@ P)) cuts);
    2.14  print_depth 3;
    2.15 +(*###################################################################*)
    2.16  
    2.17  
    2.18  
    2.19 @@ -143,4 +145,4 @@
    2.20  	     cuts @ cuts' @ ([(*Res pt'*)]))
    2.21      end
    2.22  *)
    2.23 -fun cut_tree pt (p,_) = cut_tre [] [] pt pos;
    2.24 +fun cut_tree pt (pos,_) = cut_tre [] [] pt pos;
     3.1 --- a/src/sml/systest/ctree.sml	Tue Feb 22 11:50:11 2005 +0100
     3.2 +++ b/src/sml/systest/ctree.sml	Tue Feb 22 17:03:43 2005 +0100
     3.3 @@ -11,6 +11,7 @@
     3.4  "-------------- cut_tree (from ptree above)-----------------------";
     3.5  "=====new ptree 1a miniscript with mini-subpbl ===================";
     3.6  "-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
     3.7 +(**)#####################################################################**)
     3.8  "=====new ptree 2 miniscript with mini-subpbl ====================";
     3.9  "-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
    3.10  "-------------- cappend (from ptree above)------------------------";
    3.11 @@ -40,8 +41,11 @@
    3.12  "=====new ptree 5 minisubpbl =====================================";
    3.13  "-------------- pt_extract form, tac, asm ------------------------";
    3.14  
    3.15 +(**#####################################################################(**)
    3.16 +"=====new ptree 6 minisubpbl intersteps ==========================";
    3.17 +"-------------- get_allpos' new ----------------------------------";
    3.18 +"-------------- cut_tree new (from ptree above)-------------------";
    3.19  (**)#####################################################################**)
    3.20 -"-------------- cut_tree new (from ptree above)-------------------";
    3.21  
    3.22  "-----------------------------------------------------------------";
    3.23  
    3.24 @@ -322,7 +326,7 @@
    3.25  show_pt pt';
    3.26  print_depth 99;cuts;print_depth 3;
    3.27  print_depth 99;map fst (get_interval ([],Frm) ([],Res) 9999 pt');print_depth 3;
    3.28 -####################################################################*)
    3.29 +####################################################################*)*)
    3.30  
    3.31  "=====new ptree 2 miniscript with mini-subpbl ====================";
    3.32  "=====new ptree 2 miniscript with mini-subpbl ====================";
    3.33 @@ -341,9 +345,9 @@
    3.34   val ((pt,_),_) = get_calc 1;
    3.35   show_pt pt;
    3.36  
    3.37 -"-------------- cut_tree (from 3rd level)-------------------------";
    3.38 -"-------------- cut_tree (from 3rd level)-------------------------";
    3.39 -"-------------- cut_tree (from 3rd level)-------------------------";
    3.40 +"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
    3.41 +"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
    3.42 +"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
    3.43  
    3.44   val (pt', cuts) = cut_tree pt ([3,2,1],Frm);
    3.45   if cuts = [([3, 2, 1], Res),
    3.46 @@ -929,9 +933,6 @@
    3.47      ("[x = 1]", None, []) => ()
    3.48    | _ => raise error "diff.behav.in ctree.sml: pt_extract ([], Res)";
    3.49  
    3.50 -(**)##############################################################**)
    3.51 -
    3.52 -
    3.53  "=====new ptree 6 minisubpbl intersteps ==========================";
    3.54  "=====new ptree 6 minisubpbl intersteps ==========================";
    3.55  "=====new ptree 6 minisubpbl intersteps ==========================";