introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
2.06 kB
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