Skip to content

Commit 4895480

Browse files
committed
Implemented efficiecy computation
1 parent c355abd commit 4895480

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

analysis/markov/Linleios/Evolve.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,12 @@ def ebDistribution : Probabilities → HashMap Nat Probability :=
6767
$ singleton ⟨ state.ebCount , p ⟩
6868
)
6969
70+
71+
def ebEfficiency (states : Probabilities) : Float :=
72+
let rbCount := states.keys.head!.rbCount
73+
let ebCount :=
74+
HashMap.fold
75+
(fun acc state p =>acc + state.ebCount.toFloat * p)
76+
0
77+
states
78+
ebCount / (rbCount.toFloat - 1)

analysis/markov/Main.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Linleios
44

55
def env : Environment := makeEnvironment 0.05 0.95 0.90 600 0.75 1 4 7
66

7-
def sn := simulate env default 1e-6 10
7+
def sn := simulate env default 1e-6 25
88

99
def main : IO Unit :=
1010
do
@@ -14,4 +14,6 @@ def main : IO Unit :=
1414
IO.println ""
1515
print $ ebDistribution sn
1616
IO.println ""
17+
print $ ebEfficiency sn
18+
IO.println ""
1719
print $ 1 - totalProbability sn

0 commit comments

Comments
 (0)