Tier proposal for the remaining series channels (read-only replay, nothing in the app)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -149,4 +149,37 @@ class WeightedRolloutReplayTest {
|
||||
File(dir, "weighted-rollout-replay.txt").writeText(out.toString())
|
||||
println(out)
|
||||
}
|
||||
|
||||
/**
|
||||
* Read-only: the remaining series channels, today's rule against weighted rotation with tiers proposed from each brief,
|
||||
* given in proposed-tiers.json ({"101": {"Frasier": 3.0, ...}}; a channel with no titles is tried with every show equal).
|
||||
* Writes tier-proposal-replay.txt. Nothing here changes the app.
|
||||
*/
|
||||
@Test fun proposedTiers() {
|
||||
val file = dir?.let { File(it, "proposed-tiers.json") }
|
||||
assumeTrue(file != null && file.exists())
|
||||
val proposed = JSONObject(file!!.readText())
|
||||
val out = StringBuilder("Tier proposal: four weeks of new bookings after each committed plan, today's rule against weighted rotation with tiers from each brief,\n" +
|
||||
"avoiding every other channel's programmes as the box does. Read-only.\n\n")
|
||||
val baseline = SmartChannels.filter { File(dir, "schedule-${it.number}.json").exists() && File(dir, "episodes-${it.number}.json").exists() }.associate { p ->
|
||||
p.number to replay(plan(File(dir, "schedule-${p.number}.json")), pool(File(dir, "episodes-${p.number}.json")), p, p.tierWeights?.let { p::weightOf }, keepCommitted = true)
|
||||
}
|
||||
for (key in proposed.keys().asSequence().sortedBy { it.toInt() }) {
|
||||
val number = key.toInt()
|
||||
val row = proposed.getJSONObject(key)
|
||||
val tiers = row.keys().asSequence().associate { seriesKey(it) to row.getDouble(it) }
|
||||
val programming = SmartChannels.first { it.number == number }.copy(tierWeights = tiers)
|
||||
val committed = plan(File(dir, "schedule-$number.json")); val series = pool(File(dir, "episodes-$number.json"))
|
||||
val weightOf = programming::weightOf
|
||||
val others = clashesWith(baseline.filterKeys { it != number }.values.map { ChannelPlan(it, ScheduleCursor()) })
|
||||
out.appendLine("== ${programming.name} ($number)" + if (tiers.isEmpty()) ": no tiers in the brief, tried with every show equal" else "")
|
||||
out.appendLine(" in the pool: ${series.size} shows; core ${series.count { weightOf(it) == TIER_CORE }}, supporting ${series.count { weightOf(it) == TIER_SUPPORTING }}, surprise ${series.count { weightOf(it) == TIER_SURPRISE }}")
|
||||
report("Today", replay(committed, series, programming, null, others), series, programming, weightOf, others, out)
|
||||
report("Weighted", replay(committed, series, programming, weightOf, others), series, programming, weightOf, others, out)
|
||||
out.appendLine()
|
||||
}
|
||||
File(dir, "tier-proposal-replay.txt").writeText(out.toString())
|
||||
println(out)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user