Changeset 13373 for branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates/SingleObjectiveProblem_Template.cs
- Timestamp:
- 11/24/15 17:27:35 (8 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates/SingleObjectiveProblem_Template.cs
r13363 r13373 16 16 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 17 17 // Define e.g. the length of the solution encoding or the solution creator by modifying the Encoding property 18 // Encoding.Length = 100; 18 19 // Add additional initialization code e.g. private variables that you need for evaluating 19 20 } … … 25 26 } 26 27 27 public override void Analyze(SOLUTION_CLASS[] solution , double[] qualities, ResultCollection results, IRandom random) {28 public override void Analyze(SOLUTION_CLASS[] solutions, double[] qualities, ResultCollection results, IRandom random) { 28 29 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 29 30 // Write or update results given the range of vectors and resulting qualities 30 // Uncomment the following lines if you want to retrieve the best individual31 // Uncomment the following lines if you want to retrieve the best solution 31 32 32 //var ordered Individuals = individuals.Zip(qualities, (i, q) => new { Individual= i, Quality = q }).OrderBy(z => z.Quality);33 //var best = Maximization ? ordered Individuals.Last().Individual : orderedIndividuals.First().Individual;33 //var orderedSolutions = solutions.Zip(qualities, (i, q) => new { Solution = i, Quality = q }).OrderBy(z => z.Quality); 34 //var best = Maximization ? orderedSolutions.Last().Solution : orderedSolutions.First().Solution; 34 35 35 36 //if (!results.ContainsKey("Best Solution")) { … … 39 40 } 40 41 41 public override IEnumerable<SOLUTION_CLASS> GetNeighbors(SOLUTION_CLASS individual, IRandom random) {42 public override IEnumerable<SOLUTION_CLASS> GetNeighbors(SOLUTION_CLASS solution, IRandom random) { 42 43 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 43 44 // Create new vectors, based on the given one that represent small changes … … 46 47 // Algorithm will draw only a finite amount of samples 47 48 // Change to a for-loop to return a concrete amount of neighbors 48 var neighbor = (SOLUTION_CLASS) individual.Clone();49 var neighbor = (SOLUTION_CLASS)solution.Clone(); 49 50 // modify the solution specified as neighbor 50 51 yield return neighbor;
Note: See TracChangeset
for help on using the changeset viewer.