Last change
on this file since 13398 was
12893,
checked in by gkronber, 9 years ago
|
#2283: experiments on grammatical optimization algorithms (maxreward instead of avg reward, ...)
|
File size:
745 bytes
|
Rev | Line | |
---|
[11742] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Threading.Tasks;
|
---|
| 6 | using HeuristicLab.Common;
|
---|
| 7 | using HeuristicLab.Problems.GrammaticalOptimization;
|
---|
| 8 |
|
---|
| 9 | namespace HeuristicLab.Algorithms.Bandits.GrammarPolicies {
|
---|
[11770] | 10 | public class RandomPolicy : GrammarPolicy {
|
---|
| 11 | public RandomPolicy(IProblem problem, bool useCanonicalRepresentation)
|
---|
| 12 | : base(problem, useCanonicalRepresentation) {
|
---|
[11742] | 13 | }
|
---|
| 14 |
|
---|
[12893] | 15 | public override bool TrySelect(System.Random random, string curState, IEnumerable<string> afterStates, out int selectedStateIdx) {
|
---|
[11770] | 16 | // never fail => allows re-visits of terminal states
|
---|
[11793] | 17 | selectedStateIdx = random.Next(afterStates.Count());
|
---|
[11770] | 18 | return true;
|
---|
[11742] | 19 | }
|
---|
| 20 | }
|
---|
| 21 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.