Commits

bergsoe committed 4d2494b

PaplSBLExpand.RRT.expand_t now returns a list of configurations
to match what PaplSBL expects.

Comments (0)

Files changed (2)

src/PaplSBLExpand.ml

 type 'a expand_sampler_t = 'a -> 'a PaplSampler.t
 type 'a expand_t = 'a -> 'a list
 
-let to_expand constr expansions = (); fun q ->
-  let enum = expansions q in
+let enum_to_expand constr enum =
   let rec loop () =
     match BatEnum.get enum with
         None -> []
           else loop ()
   in loop ()
 
+let to_expand constr expansions = ();
+  fun q -> enum_to_expand constr (expansions q)
+
 let random_range = PaplSampler.get_uniform
 
 let stop () = raise BatEnum.No_more_elements
 module RRT = struct
   type box_t = float * float
   type 'a expand_sampler_t = 'a -> 'a -> 'a PaplSampler.t
-  type 'a expand_t = 'a -> 'a -> 'a option
+  type 'a expand_t = 'a -> 'a -> 'a list
 
   let to_expand constr expansions = ();
-    fun qa qb ->
-      BatEnum.Exceptionless.find
-        (fun qt -> PaplConstraint.accept constr qt)
-        (expansions qa qb)
+    fun qa qb -> enum_to_expand constr (expansions qa qb)
 
   let random_subdivide_n_helper
       float_fun n interpolate dist (lower, upper) =
           BatEnum.unfold
             (n, min len upper /. len)
             (fun (n, s) ->
-                 if n == 0 then None
-                 else
-                   let s = float_fun s in
-                     if s < min_pos then
-                       let q = ip min_pos in
-                         Some (q, (0, 0.))
-                     else
-                       let q = ip s in
-                         Some (q, (n - 1, 0.5 *. s)))
+               if n == 0 then None
+               else
+                 let s = float_fun s in
+                   if s < min_pos then
+                     let q = ip min_pos in
+                       Some (q, (0, 0.))
+                   else
+                     let q = ip s in
+                       Some (q, (n - 1, 0.5 *. s)))
 
   let subdivide_n n interpolate dist range =
     random_subdivide_n_helper

src/PaplSBLExpand.mli

 module RRT : sig
   type box_t = float * float
   type 'a expand_sampler_t = 'a -> 'a -> 'a PaplSampler.t
-  type 'a expand_t = 'a -> 'a -> 'a option
+  type 'a expand_t = 'a -> 'a -> 'a list
 
   val to_expand :
     'a PaplConstraint.t ->