gambit/example/simple/main.go

29 lines
411 B
Go

package main
import (
"log"
"lukechampine.com/frand"
"tuxpa.in/a/gambit"
"tuxpa.in/a/gambit/algo"
)
func main() {
g := &gambit.Gang{}
b := &algo.EpsilonGreedy{Epsilon: 0.1}
b.Reset(4)
g.WithBandit(b)
n := 100
for i := 0; i < n; i++ {
g.Observe(
// select a random arm
frand.Float64(),
// and supply a random score
float64(frand.Intn(4)),
)
}
log.Println(g.AllocateSolution())
}