Changeset 14552 for branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/BinaryMemPRContext.cs
- Timestamp:
- 01/09/17 00:36:20 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/BinaryMemPRContext.cs
r14450 r14552 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Algorithms.MemPR.Interfaces; 23 24 using HeuristicLab.Common; … … 31 32 [Item("MemPR Population Context (binary)", "MemPR population context for binary encoded problems.")] 32 33 [StorableClass] 33 public sealed class BinaryMemPRPopulationContext : MemPRPopulationContext< SingleObjectiveBasicProblem<BinaryVectorEncoding>, BinaryVector, BinaryMemPRPopulationContext, BinaryMemPRSolutionContext> {34 public sealed class BinaryMemPRPopulationContext : MemPRPopulationContext<ISingleObjectiveHeuristicOptimizationProblem, BinaryVector, BinaryMemPRPopulationContext, BinaryMemPRSolutionContext> { 34 35 35 36 [StorableConstructor] … … 47 48 return new BinaryMemPRSolutionContext(this, solution); 48 49 } 50 51 public override ISingleObjectiveSolutionScope<BinaryVector> ToScope(BinaryVector code, double fitness = double.NaN) { 52 var creator = Problem.SolutionCreator as IBinaryVectorCreator; 53 if (creator == null) throw new InvalidOperationException("MemPR (binary) context expects a problem with an IBinaryVectorCreator as solution creator."); 54 return new SingleObjectiveSolutionScope<BinaryVector>(code, creator.BinaryVectorParameter.ActualName, fitness, Problem.Evaluator.QualityParameter.ActualName) { 55 Parent = Scope 56 }; 57 } 49 58 } 50 59 51 60 [Item("MemPR Solution Context (binary)", "MemPR solution context for binary encoded problems.")] 52 61 [StorableClass] 53 public sealed class BinaryMemPRSolutionContext : MemPRSolutionContext< SingleObjectiveBasicProblem<BinaryVectorEncoding>, BinaryVector, BinaryMemPRPopulationContext, BinaryMemPRSolutionContext>, IBinaryVectorSubspaceContext {62 public sealed class BinaryMemPRSolutionContext : MemPRSolutionContext<ISingleObjectiveHeuristicOptimizationProblem, BinaryVector, BinaryMemPRPopulationContext, BinaryMemPRSolutionContext>, IBinaryVectorSubspaceContext { 54 63 55 64 [Storable]
Note: See TracChangeset
for help on using the changeset viewer.