Stable_matching(3)

πŸ“¦
version 5.5.0 Β· 2 versions
, in arch rolling

πŸ’… NAME πŸ’…

okay bestie, welcome to the Stable_matching(3) page from the OCaml library ✨. The NAME section is literally:

Stable_matching - no description

and that’s it β€” β€œno description” 😭 no cap. The docs are being mysterious, but the rest of the page has the actual module tea πŸ«–.


🧚 Module 🧚

This section just says:

Module   Stable_matching

like, that’s the module we’re talking about, periodt πŸ’….


✨ Documentation ✨

okay so the docs open with:

Module Stable_matching
 : sig end

then:

module Item : sig end

Item is literally just sig end β€” that’s the whole thing, no cap 🫢.

The type lines are giving:

  • type left_index = int β€” a left index is just an int, iconic.
  • type right_index = int β€” a right index is also just an int, slay.
  • type rank = int β€” and a rank? also an int, we love consistency πŸ’–.

Then there’s this type:

type ('a, 'v) matches = {
 left : 'a list ;
 pairs : ('v * 'v) list ;
 right : 'a list ;
 }

and this one:

type ('v, 'k) item_matches = (('v, 'k) Item.t, 'v) matches

then the unstable_matching type:

type unstable_matching = {
 first : left_index * right_index ;
 second : left_index * right_index ;
 current_rank : rank * rank ;
 optimal : rank * rank ;
 }

Now the values, bestie πŸ‘‘

val stable_matches : distance:(int -> int -> int) -> ('a, int) matches
-> (unit, unstable_matching) Result.t
val strong_stable_matches : distance:(int -> int -> int) -> ('a, int)
matches -> (unit, unstable_matching) Result.t
val matches : compatible:(left_index -> right_index -> bool) ->
preferences:(right_index -> (left_index * rank) array) -> size:int * int
-> (int, int) matches

so matches ~compatible ~preferences ~size:(ls,rs) computes a matching between a set of ls left items and rs right items favoring the right side. The matches are compatible and weakly stable according to the preferences matrix. The size of the matching is at least 2/3 of the optimal matching size β€” and yeah, computing optimal matching with partial preferences and ties is in NP 😭. that’s the drama, not me.

val fuzzy_match_names : compatibility:('k -> 'k -> bool) ->
max_right_items:int -> cutoff:(string -> int) -> ('v, 'k) Item.t list ->
('v, 'k) Item.t list -> ('v, 'k) item_matches

and fuzzy_match_names ~compatibility ~max_right_item ~cutoff left right calls the Stable_matching.matches function using the OSA edit distance to compute preferences with a cutoff function. To avoid quadratic complexity on large module size we limit the right side to the first max_right_item items. (the signature above says max_right_items, the prose says max_right_item β€” im just reading the page, bestie πŸ’…).


This page came from OCamldoc, dated 2026-06-22, for Stable_matching(3). mwah, bye bestie πŸ«ΆπŸ’–πŸŽ€

πŸ“¦ where this page comes from