gambit/gang.go

23 lines
360 B
Go
Raw Normal View History

2023-07-06 09:10:29 +00:00
package gambit
type Gang struct {
b Bandit
}
func (g *Gang) WithBandit(b Bandit) {
g.b = b
}
func (g *Gang) AllocateSolution() ([]int, []float64) {
a := make([]int, g.b.Size())
b := make([]float64, g.b.Size())
g.b.Count(a)
g.b.Reward(b)
return a, b
}
2023-07-06 09:48:20 +00:00
func (g *Gang) Observe(score float64, reward float64) {
g.b.Update(g.b.Select(score), reward)
}