|
|
|
@ -204,15 +204,16 @@ let divide_token (fam, n_star) toklist graph const prob fstar checked_stars =
|
|
|
|
|
in if links = [] then Some (toklist,prob,fstar,n_star::checked_stars,fam) |
|
|
|
|
else aux links toklist prob fstar checked_stars |
|
|
|
|
|
|
|
|
|
(* should be deterministic exec, graph shouldn't be empty *) |
|
|
|
|
let exec const = |
|
|
|
|
(* should be deterministic exec, graph shouldn't be empty, takes a constellation and a list of stars that are gonna be beginning points *) |
|
|
|
|
let exec const start_star_list = |
|
|
|
|
let const_ext = extends_varname_const const in |
|
|
|
|
let graph = List.flatten (clean_dgraph (dgraph const_ext)) in |
|
|
|
|
let max_fam = List.length start_star_list in |
|
|
|
|
let rec aux (toklist,prob,star,checked_stars,current_fam) = |
|
|
|
|
begin match toklist with |
|
|
|
|
| [] -> let gen_token = List.filter (fun ((i,_),(_,_)) -> not( List.mem i checked_stars)) graph in |
|
|
|
|
if gen_token = [] then star,prob |
|
|
|
|
else let ((i,_),(_,_)) = (List.hd gen_token) in aux ([(current_fam+1,i)],prob,star,checked_stars,current_fam+1) |
|
|
|
|
| [] -> (*let gen_token = List.filter (fun ((i,_),(_,_)) -> not( List.mem i checked_stars)) graph in *) |
|
|
|
|
if current_fam = max_fam then star,prob |
|
|
|
|
else aux ([(current_fam+1, List.nth start_star_list (current_fam+1))], prob, star, checked_stars, current_fam+1) |
|
|
|
|
| h::t -> aux (Option.get (divide_token h t graph const_ext prob star checked_stars)) |
|
|
|
|
end |
|
|
|
|
in let ((i,_),(_,_)) = (List.hd graph) |
|
|
|
|