Last change
on this file since 13459 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 | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Diagnostics;
|
---|
4 | using System.Linq;
|
---|
5 | using System.Text;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 | using HeuristicLab.Common;
|
---|
8 |
|
---|
9 | namespace 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.