Slight improvement

This commit is contained in:
Ian Gulliver
2023-12-30 21:00:37 -07:00
parent 780a9b599b
commit 58e3a477ef
3 changed files with 18 additions and 25 deletions

View File

@@ -24,26 +24,16 @@ func main() {
chat := seeds.ChatState()
log.Printf("chat=%d [%s]", totalLength(chat, samples), chat)
chatOpt := optimize(chat, samples)
if chatOpt == nil {
log.Printf("\toptimal from further additions")
} else {
log.Printf("\tnot optimal [%s]", chatOpt)
}
opt := optimize(state.NewState(), samples)
log.Printf("opt=%d [%s]", totalLength(opt, samples), opt)
}
func optimize(st *state.State, samples [][]byte) *state.State {
var best *state.State
for true {
better := optimize2(st, samples)
if better == nil {
return best
return st
}
best = better
st = better
log.Printf("\titer=%d [%s]", totalLength(st, samples), st)
}