Weight_as_Depth_and_Size.WMap
This module implements a map from weights to lists of computational states of same weight.
type 'a t
The type of the map
val empty : 'a t
empty returns the empty map
empty
val optimum : 'a t -> w option
optimum m returns None if m is empty and Some w if w is the best weight of the current computations stored in the map m.
optimum m
None
m
Some w
w
val pp : Stdlib.Format.formatter -> 'a t -> unit
pp fmt m pretty prints (a summary of) the map m on the formatter fmt.
pp fmt m
fmt
val add : w -> 'a -> 'a t -> 'a t
add w e m returns m where e was added with weight w.
add w e m
e
val pop_optimum : 'a t -> ('a * w * 'a t) option
pop_optimum m returns None if m is empty and Some (c, w, m') where w is the best weight of the current computations stored in the map m, c is a computation with this weight, and m' is m where c was removed.
pop_optimum m
Some (c, w, m')
c
m'