Last change
on this file since 13401 was
11806,
checked in by gkronber, 10 years ago
|
#2283: separated value-states from done-states in GenericGrammarPolicy and removed disabling of actions from bandit policies
|
File size:
715 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.BanditPolicies {
|
---|
10 | public class RandomPolicy : IBanditPolicy {
|
---|
11 |
|
---|
12 | public override string ToString() {
|
---|
13 | return "RandomPolicy";
|
---|
14 | }
|
---|
15 |
|
---|
16 | public int SelectAction(Random random, IEnumerable<IBanditPolicyActionInfo> actionInfos) {
|
---|
17 | return actionInfos
|
---|
18 | .Select((aInfo, idx) => Tuple.Create(aInfo, idx))
|
---|
19 | .SelectRandom(random).Item2;
|
---|
20 | }
|
---|
21 |
|
---|
22 | public IBanditPolicyActionInfo CreateActionInfo() {
|
---|
23 | return new DefaultPolicyActionInfo();
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.