package lbvs_consent

  1. Overview
  2. Docs

Source file policy.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

(* A consensus is parameterized by a policy/strategy that dictates how the
   consensus is built *)

module Log = Dolog.Log

type t =
  (* control strategies are not consensus queries per se *)
  | Single (* control *)
  | Opportunist (* control *)
  | Optimist (* v *)
  | Realist (* % *)
  | Knowledgeable (* activity-weighted % *)

let of_string = function
  | "sing" -> Single
  | "oppo" -> Opportunist
  | "opti" -> Optimist
  | "real" -> Realist
  | "know" -> Knowledgeable
  | other ->
    let () = Log.fatal "of_string: unknown strat: %s" other in
    exit 1

let to_string = function
  | Single -> "sing"
  | Opportunist -> "oppo"
  | Optimist -> "opti"
  | Realist -> "real"
  | Knowledgeable -> "know"