Rev | Line | |
---|
[11708] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
[11727] | 3 | using System.Diagnostics;
|
---|
[11708] | 4 | using System.Linq;
|
---|
| 5 | using System.Text;
|
---|
| 6 | using System.Threading.Tasks;
|
---|
[11727] | 7 | using HeuristicLab.Common;
|
---|
[11708] | 8 |
|
---|
| 9 | namespace HeuristicLab.Algorithms.Bandits {
|
---|
[11732] | 10 | public class RandomPolicy : IPolicy {
|
---|
[11727] | 11 |
|
---|
[11732] | 12 | public override string ToString() {
|
---|
| 13 | return "RandomPolicy";
|
---|
[11708] | 14 | }
|
---|
| 15 |
|
---|
[11732] | 16 | public int SelectAction(Random random, IEnumerable<IPolicyActionInfo> actionInfos) {
|
---|
| 17 | return actionInfos
|
---|
| 18 | .Select((a, i) => Tuple.Create(a, i))
|
---|
| 19 | .Where(p => !p.Item1.Disabled)
|
---|
| 20 | .SelectRandom(random).Item2;
|
---|
[11708] | 21 | }
|
---|
[11732] | 22 |
|
---|
| 23 | public IPolicyActionInfo CreateActionInfo() {
|
---|
| 24 | return new EmptyPolicyActionInfo();
|
---|
[11708] | 25 | }
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.