Last change
on this file since 14923 was
13669,
checked in by gkronber, 9 years ago
|
#2581: made policies storable and added iteration of best solution to results
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Diagnostics.Contracts;
|
---|
4 | using System.Linq;
|
---|
5 | using System.Text;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 | using HeuristicLab.Common;
|
---|
8 | using HeuristicLab.Core;
|
---|
9 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
10 |
|
---|
11 | namespace 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.