Changeset 13339 for branches/ProblemRefactoring/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs
- Timestamp:
- 11/23/15 16:14:57 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs
r13173 r13339 32 32 using HeuristicLab.Parameters; 33 33 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 34 using HeuristicLab.Problems.Binary;35 34 using HeuristicLab.Random; 36 35 … … 50 49 51 50 public override Type ProblemType { 52 get { return typeof( BinaryProblem); }51 get { return typeof(ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>); } 53 52 } 54 public new BinaryProblemProblem {55 get { return ( BinaryProblem)base.Problem; }53 public new ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector> Problem { 54 get { return (ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>)base.Problem; } 56 55 set { base.Problem = value; } 57 56 } … … 84 83 Results.Add(new Result("Best quality", BestQuality)); 85 84 for (int iteration = 0; iteration < Iterations; iteration++) { 86 var solution = new BinaryVector(Problem. Length);85 var solution = new BinaryVector(Problem.Encoding.Length); 87 86 for (int i = 0; i < solution.Length; i++) { 88 87 solution[i] = random.Next(2) == 1; … … 98 97 } 99 98 // In the GECCO paper, Section 2.1 100 public static double ImproveToLocalOptimum( BinaryProblemproblem, BinaryVector solution, double fitness, IRandom rand) {99 public static double ImproveToLocalOptimum(ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector> problem, BinaryVector solution, double fitness, IRandom rand) { 101 100 var tried = new HashSet<int>(); 102 101 do {
Note: See TracChangeset
for help on using the changeset viewer.