using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using HeuristicLab.Common; namespace HeuristicLab.Algorithms.Bandits.Models { // uniform distribution [a..b[ public class UniformModel : IModel { private readonly double a; private readonly double b; public UniformModel(double lower = 0.0, double upper = 1.0) { this.a = lower; this.b = upper; } public double Sample(Random random) { return random.NextDouble() * (b - a) + a; } public void Update(double reward) { throw new NotSupportedException(); } public void Reset() { throw new NotSupportedException(); } public object Clone() { return new UniformModel(a, b); } public override string ToString() { return string.Format("U({0:F2},{1:F2})", a, b); } } }