File size: 2,059 Bytes
e320e82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import OAI.Combinatorics.EditApproximation.Specification.RawBand
import OAI.Combinatorics.EditApproximation.Definitions

namespace OAI.EditApproximation.BinaryFraction

section Group
variable {ny M T : ℕ} (b exponent Q : ℕ)
  (initial current : Fin M → TargetInterval ny → BinaryFraction × ℕ)
  (initialAllocation currentAllocation : Fin M → TargetInterval ny → ℕ)
  (scales : Fin T → BinaryFraction)
  (draw : ∀ t, Fin (groupSampleCount M Q b (scales t).value) → Fin M)
  (drawSource : ∀ t, Fin (groupSampleCount M Q b (scales t).value) → Fin M × ℕ)
  (drawAllocation : ∀ t, Fin (groupSampleCount M Q b (scales t).value) → ℕ)

def unskippedEstimateReadWithWorkRaw (member : (RawUnskippedBand M ny)) : BinaryFraction × ℕ :=
  let mass := envelopeVectorReadWithWork b member.actions initial
  let rounded := roundedBandReadWithWork exponent b member.actions member.nonempty initial
  let values := vectorMapWithWork M fun i => current i (rounded.1.get i)
  let connection := endpointConnectionWithWork member.center rounded.1.get
  let result := countedGroupMemberWithWork Q b scales connection.1 mass.1 values.1 draw
  (result.1, mass.2 + rounded.2 + values.2 + connection.2 + result.2 + 5)

def chooseUnskippedReadWithWorkRaw (members : List (RawUnskippedBand M ny)) (hne : members ≠ []) : (RawUnskippedBand M ny) × ℕ :=
  selectGroupWithWork members hne
    (unskippedEstimateReadWithWorkRaw b exponent Q initial current scales draw)

def sampledGroupActionReadWithWorkRaw (members : List (RawUnskippedBand M ny)) (hne : members ≠ []) :
    BinaryBellmanAction (TargetInterval ny) (Fin M × TargetInterval ny) M × ℕ :=
  let selected := chooseUnskippedReadWithWorkRaw b exponent Q initial current scales draw members hne
  let rounded := roundedBandReadWithWork exponent b selected.1.actions selected.1.nonempty initial
  let result := endpointActionWithWork selected.1.center rounded.1.get
  (result.1, selected.2 + rounded.2 + result.2 + 3)













end Group

end OAI.EditApproximation.BinaryFraction