source: stable/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/Policies/PolicyBase.cs @ 15060

Last change on this file since 15060 was 15060, checked in by gkronber, 2 years ago

#2581: merged r13645,r13648,r13650,r13651,r13652,r13654,r13657,r13658,r13659,r13661,r13662,r13669,r13708,r14142 from trunk to stable (to be deleted in the next commit)

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Diagnostics.Contracts;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7using HeuristicLab.Common;
8using HeuristicLab.Core;
9using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
10
11namespace HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression.Policies {
12  [StorableClass]
13  public abstract class PolicyBase : Item, IParameterizedItem, IPolicy {
14    [Storable]
15    public IKeyedItemCollection<string, IParameter> Parameters { get; private set; }
16
17    [StorableConstructor]
18    protected PolicyBase(bool deserializing) : base(deserializing) { }
19    protected PolicyBase(PolicyBase original, Cloner cloner)
20      : base(original, cloner) {
21      Parameters = cloner.Clone(original.Parameters);
22    }
23    protected PolicyBase()
24      : base() {
25      Parameters = new ParameterCollection();
26    }
27
28    public void CollectParameterValues(IDictionary<string, IItem> values) {
29      foreach (var p in Parameters) values.Add(this.ItemName + "." + p.Name, p.ActualValue);
30    }
31
32    public abstract int Select(IEnumerable<IActionStatistics> actions, IRandom random);
33    public abstract void Update(IActionStatistics action, double q);
34    public abstract IActionStatistics CreateActionStatistics();
35  }
36}
Note: See TracBrowser for help on using the repository browser.