Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Distributions/GammaModel.cs @ 13834

Last change on this file since 13834 was 12893, checked in by gkronber, 9 years ago

#2283: experiments on grammatical optimization algorithms (maxreward instead of avg reward, ...)

File size: 899 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Diagnostics;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7using HeuristicLab.Common;
8
9namespace HeuristicLab.Algorithms.Bandits.Models {
10  public class GammaModel : IModel {
11
12    private readonly double a;
13    private readonly double b;
14
15    public GammaModel(double a = 1.0, double b = 1.0) {
16      this.a = a;
17      this.b = b;
18    }
19
20    public double Sample(Random random) {
21      return Rand.GammaRand(random, a) * b;
22    }
23
24    public void Update(double reward) {
25      throw new NotSupportedException();
26    }
27
28    public void Reset() {
29      throw new NotSupportedException();
30    }
31
32    public object Clone() {
33      return new GammaModel(a, b);
34    }
35
36    public override string ToString() {
37      return string.Format("Gamma({0:F2},{1:F2})", a, b);
38    }
39  }
40}
Note: See TracBrowser for help on using the repository browser.