Changeset 14544 for branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/SolutionModel
- Timestamp:
- 01/05/17 00:32:43 (8 years ago)
- Location:
- branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/SolutionModel/Univariate
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/SolutionModel/Univariate/StaticAPI/Trainer.cs
r14466 r14544 23 23 using HeuristicLab.Algorithms.MemPR.Interfaces; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Encodings.LinearLinkageEncoding; 25 26 26 namespace HeuristicLab.Algorithms.MemPR. LinearLinkage.SolutionModel.Univariate {27 namespace HeuristicLab.Algorithms.MemPR.Grouping.SolutionModel.Univariate { 27 28 public static class Trainer { 28 29 29 public static ISolutionModel< Encodings.LinearLinkageEncoding.LinearLinkage> Train(IRandom random,30 IEnumerable< Encodings.LinearLinkageEncoding.LinearLinkage> pop) {30 public static ISolutionModel<LinearLinkage> Train(IRandom random, 31 IEnumerable<LinearLinkage> pop) { 31 32 return UnivariateModel.Create(random, pop); 32 33 } -
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/SolutionModel/Univariate/UnbiasedModelTrainer.cs
r14466 r14544 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; 26 using HeuristicLab.Encodings.LinearLinkageEncoding; 26 27 using HeuristicLab.Optimization; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 29 namespace HeuristicLab.Algorithms.MemPR. LinearLinkage.SolutionModel.Univariate {30 namespace HeuristicLab.Algorithms.MemPR.Grouping.SolutionModel.Univariate { 30 31 [Item("Unbiased Univariate Model Trainer (linear linkage)", "", ExcludeGenericTypeInfo = true)] 31 32 [StorableClass] 32 33 public class UniasedModelTrainer<TContext> : NamedItem, ISolutionModelTrainer<TContext> 33 where TContext : IPopulationBasedHeuristicAlgorithmContext<SingleObjectiveBasicProblem< Encodings.LinearLinkageEncoding.LinearLinkageEncoding>, Encodings.LinearLinkageEncoding.LinearLinkage>, ISolutionModelContext<Encodings.LinearLinkageEncoding.LinearLinkage> {34 where TContext : IPopulationBasedHeuristicAlgorithmContext<SingleObjectiveBasicProblem<LinearLinkageEncoding>, LinearLinkage>, ISolutionModelContext<LinearLinkage> { 34 35 35 36 [StorableConstructor] -
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/SolutionModel/Univariate/UnivariateSolutionModel.cs
r14487 r14544 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Data; 28 using HeuristicLab.Encodings.LinearLinkageEncoding; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 30 namespace HeuristicLab.Algorithms.MemPR. LinearLinkage.SolutionModel.Univariate {31 namespace HeuristicLab.Algorithms.MemPR.Grouping.SolutionModel.Univariate { 31 32 [Item("Univariate solution model (linear linkage)", "")] 32 33 [StorableClass] 33 public sealed class UnivariateModel : Item, ISolutionModel< Encodings.LinearLinkageEncoding.LinearLinkage> {34 public sealed class UnivariateModel : Item, ISolutionModel<LinearLinkage> { 34 35 [Storable] 35 36 public IntMatrix Frequencies { get; set; } … … 61 62 } 62 63 63 public Encodings.LinearLinkageEncoding.LinearLinkage Sample() {64 public LinearLinkage Sample() { 64 65 var N = Frequencies.Rows; 65 var centroid = Encodings.LinearLinkageEncoding.LinearLinkage.SingleElementGroups(N);66 var centroid = LinearLinkage.SingleElementGroups(N); 66 67 var dict = new Dictionary<int, int>(); 67 68 for (var i = N - 1; i >= 0; i--) { … … 87 88 } 88 89 89 public static ISolutionModel< Encodings.LinearLinkageEncoding.LinearLinkage> Create(IRandom random, IEnumerable<Encodings.LinearLinkageEncoding.LinearLinkage> population) {90 public static ISolutionModel<LinearLinkage> Create(IRandom random, IEnumerable<LinearLinkage> population) { 90 91 var iter = population.GetEnumerator(); 91 92 if (!iter.MoveNext()) throw new ArgumentException("Cannot create solution model from empty population.");
Note: See TracChangeset
for help on using the changeset viewer.