bergsoe avatar bergsoe committed 75d75f4

The TreeIndex module is no longer used.

Such module might be worthwhile at some point, but currently it isn't
clear what interfaces are needed, and hence it is better to leave it
out.

Comments (0)

Files changed (2)

src/PaplTreeIndex.ml

-(*
-  Copyright (c) 2012 Anders Lau Olsen.
-  See LICENSE file for terms and conditions.
-*)
-
-module type BASE = sig
-  type t
-  type q_t
-  type node_t
-
-  val create : unit -> t
-  val add : t -> node_t -> q_t -> node_t
-  val add_root : t -> q_t -> node_t
-  val choose_connect : t -> q_t -> node_t option
-end
-
-module type S = sig
-  type q_t
-  type node_t = q_t PaplTree.node
-  include BASE with type q_t := q_t
-               and type node_t := node_t
-end
-
-module type S_DLT = sig
-  type q_t
-  type node_t = q_t PaplDLTree.node
-  include BASE with type q_t := q_t
-               and type node_t := node_t
-
-  val detach : t -> node_t -> unit
-end
-
-module type S_EST = sig
-  include S
-  val choose : t -> node_t option
-end
-
-module type S_EST_DLT = sig
-  include S_DLT
-  val choose : t -> node_t option
-end
-
-module type S_RRT = sig
-  include S
-  val nearest : t -> q_t -> node_t option
-end
-
-module type S_RRT_DLT = sig
-  include S_DLT
-  val nearest : t -> q_t -> node_t option
-end
-
-module BruteForce = struct
-  module type SETUP = sig
-    type q_t
-    val connect_dist : q_t PaplMetric.option_t
-    val connect_constr : q_t PaplEdgeConstraint.t option
-    val rng : PaplRandom.rng_t
-  end
-
-  module type SETUP_DLT = sig
-    include SETUP
-    val get_mark : q_t -> PaplIndex.BruteForce.mark_t
-  end
-
-  module MakeBase (M : SETUP) = struct
-    module Tree = PaplTree
-    type q_t = M.q_t
-    type node_t = q_t Tree.node
-
-    module IndexSetup = struct
-      type value_t = node_t
-      let rng = M.rng
-    end
-    module Index = PaplIndex.BruteForce.Make(IndexSetup)
-
-    type t = Index.t
-
-    let create () = Index.create ()
-
-    let add s parent q =
-      let node = Tree.add parent q in
-      let () = Index.add s node in
-        node
-
-    let add_root s q =
-      let node = Tree.add_root q in
-      let () = Index.add s node in
-        node
-
-    let get = Tree.get
-
-    let find dist constr s qa =
-      let nb =
-        Index.option_shortest s (fun nb -> dist qa (get nb))
-      in
-        match nb with
-            None -> None
-          | Some nb as result ->
-              if PaplConstraint.accept constr (qa, get nb)
-              then result
-              else None
-
-    let connect_constr = BatOption.default
-      (PaplConstraint.fixed_accept true)
-      M.connect_constr
-
-    let choose_connect s qa =
-      find M.connect_dist connect_constr s qa
-  end
-
-  module MakeBaseDLT (M : SETUP_DLT) = struct
-    module Tree = PaplDLTree
-    type q_t = M.q_t
-    type node_t = q_t Tree.node
-
-    let get_mark node = M.get_mark (Tree.get node)
-
-    module IndexSetup = struct
-      type value_t = node_t
-      let get_mark = get_mark
-      let rng = M.rng
-    end
-    module Index = PaplIndex.BruteForce.MakeMark(IndexSetup)
-
-    type t = Index.t
-
-    let create () = Index.create ()
-
-    let add s parent q =
-      let node = Tree.add parent q in
-      let () = Index.add s node in
-        node
-
-    let add_root s q =
-      let node = Tree.add_root q in
-      let () = Index.add s node in
-        node
-
-    let get = Tree.get
-
-    let find dist constr s qa =
-      let nb =
-        Index.option_shortest s (fun nb -> dist qa (get nb))
-      in
-        match nb with
-            None -> None
-          | Some nb as result ->
-              if PaplConstraint.accept constr (qa, get nb)
-              then result
-              else None
-
-    let connect_constr = BatOption.default
-      (PaplConstraint.fixed_accept true)
-      M.connect_constr
-
-    let choose_connect s qa =
-      find M.connect_dist connect_constr s qa
-
-    let mark node = get_mark node := true
-    let mark_tree tree = Tree.iter mark tree
-    let delete_marked_nodes s = Index.delete_marked s
-
-    let detach s tree =
-      mark_tree tree;
-      delete_marked_nodes s;
-      Tree.detach tree
-  end
-
-  module UnbiasedEST = struct
-    module type SETUP = SETUP
-    module type SETUP_DLT = SETUP_DLT
-
-    module Make (M : SETUP) = struct
-      include MakeBase (M)
-      let choose s = Index.choose_random s
-    end
-
-    module MakeDLT (M : SETUP_DLT) = struct
-      include MakeBaseDLT (M)
-      let choose s = Index.choose_random s
-    end
-  end
-
-  module RRT = struct
-    module type SETUP = sig
-      include SETUP
-      val expand_dist : q_t PaplMetric.option_t
-      val expand_constr : q_t PaplEdgeConstraint.t option
-    end
-    module type SETUP_DLT = sig
-      include SETUP_DLT
-      val expand_dist : q_t PaplMetric.option_t
-      val expand_constr : q_t PaplEdgeConstraint.t option
-    end
-
-    module Make (M : SETUP) = struct
-      include MakeBase (M)
-
-      let expand_constr = BatOption.default
-        (PaplConstraint.fixed_accept true)
-        M.expand_constr 
-
-      let nearest s qa = find M.expand_dist expand_constr s qa
-    end
-
-    module MakeDLT (M : SETUP_DLT) = struct
-      include MakeBaseDLT (M)
-
-      let expand_constr = BatOption.default
-        (PaplConstraint.fixed_accept true)
-        M.expand_constr 
-
-      let nearest s qa = find M.expand_dist expand_constr s qa
-    end
-  end
-end

src/PaplTreeIndex.mli

-(*
-  Copyright (c) 2012 Anders Lau Olsen.
-  See LICENSE file for terms and conditions.
-*)
-(** Index modules for tree nodes
-*)
-
-(** {2 Types} *)
-
-module type BASE = sig
-  type t
-  type q_t
-  type node_t
-
-  val create : unit -> t
-    (** Construct a new index.
-    *)
-
-  val add : t -> node_t -> q_t -> node_t
-    (** [add index parent q] adds to the index a node that contains the value
-        [q] and has a link to the node [parent]. The function returns the
-        resulting node.
-    *)
-
-  val add_root : t -> q_t -> node_t
-    (** [add_root index q] adds a root node containing the value [q] to the
-        index and returns the resulting node.
-    *)
-
-  val choose_connect : t -> q_t -> node_t option
-    (** [choose_connect index q] searches the index for a node suitable for
-        connecting to the configuration [q]. The function returns [Some node] if
-        such a node is found and [None] otherwise.
-
-        The [connect] function does not necessarily verify that the motion from
-        [node] to [q] is indeed acceptable. The function only gives its opinion
-        about what node of the index is reasonable for such a connection.
-    *)
-end
-
-module type S = sig
-  type q_t
-  type node_t = q_t PaplTree.node
-  include BASE with type q_t := q_t and type node_t := node_t
-end
-
-module type S_DLT = sig
-  type q_t
-  type node_t = q_t PaplDLTree.node
-  include BASE with type q_t := q_t and type node_t := node_t
-
-  val detach : t -> node_t -> unit
-end
-
-module type S_EST = sig
-  include S
-  val choose : t -> node_t option
-end
-
-module type S_EST_DLT = sig
-  include S_DLT
-  val choose : t -> node_t option
-end
-
-module type S_RRT = sig
-  include S
-  val nearest : t -> q_t -> node_t option
-end
-
-module type S_RRT_DLT = sig
-  include S_DLT
-  val nearest : t -> q_t -> node_t option
-end
-
-(** {2 Implementations} *)
-
-module BruteForce : sig
-  module type SETUP = sig
-    type q_t
-    val connect_dist : q_t PaplMetric.option_t
-    val connect_constr : q_t PaplEdgeConstraint.t option
-    val rng : PaplRandom.rng_t
-  end
-
-  module type SETUP_DLT = sig
-    include SETUP
-    val get_mark : q_t -> PaplIndex.BruteForce.mark_t
-  end
-
-  module UnbiasedEST : sig
-    module type SETUP = SETUP
-    module type SETUP_DLT = SETUP_DLT
-
-    module Make (M : SETUP) : S_EST with type q_t = M.q_t
-    module MakeDLT (M : SETUP_DLT) : S_EST_DLT with type q_t = M.q_t
-  end
-
-  module RRT : sig
-    module type SETUP = sig
-      include SETUP
-      val expand_dist : q_t PaplMetric.option_t
-      val expand_constr : q_t PaplEdgeConstraint.t option
-    end
-    module type SETUP_DLT = sig
-      include SETUP_DLT
-      val expand_dist : q_t PaplMetric.option_t
-      val expand_constr : q_t PaplEdgeConstraint.t option
-    end
-
-    module Make (M : SETUP) : S_RRT with type q_t = M.q_t
-    module MakeDLT (M : SETUP_DLT) : S_RRT_DLT with type q_t = M.q_t
-  end
-end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.