Changeset 11893 for branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/CompiledSingleObjectiveOptimizationSupport.cs
- Timestamp:
- 02/04/15 21:38:28 (9 years ago)
- Location:
- branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4
- Files:
-
- 1 added
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4
- Property svn:ignore
-
old new 5 5 *.vs10x 6 6 Plugin.cs 7 *.DotSettings
-
- Property svn:ignore
-
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/CompiledSingleObjectiveOptimizationSupport.cs
r11886 r11893 5 5 using HeuristicLab.Core; 6 6 using HeuristicLab.Data; 7 using HeuristicLab.Encodings.PermutationEncoding;8 7 using HeuristicLab.Optimization; 9 8 using HeuristicLab.Problems.Programmable; 10 9 11 namespace HeuristicLab.Problems.Programmable { 12 public class CompiledSingleObjectiveProblemDefinition : CompiledProblemDefinition, ISingleObjectiveProblemDefinition { 13 public bool Maximization { get { return false; } } 14 15 public override void Initialize() { 16 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 17 // Define the solution encoding which can also consist of multiple vectors, examples below 18 //Encoding = new BinaryEncoding("b", length: 5); 19 //Encoding = new IntegerEncoding("i", length: 5, min: 2, max: 14, step: 2); 20 //Encoding = new RealEncoding("r", length: 5, min: -1.0, max: 1.0); 21 //Encoding = new PermutationEncoding("p", length: 5, type: PermutationTypes.Absolute); 22 // The encoding can also be a combination 23 //Encoding = new MultiEncoding() 24 //.Add(new BinaryEncoding("b", length: 5)) 25 //.Add(new IntegerEncoding("i", length: 5, min: 2, max: 14, step: 4)) 26 //.Add(new RealEncoding("r", length: 5, min: -1.0, max: 1.0)) 27 //.Add(new PermutationEncoding("p", length: 5, type: PermutationTypes.Absolute)) 28 ; 29 // Add additional initialization code e.g. private variables that you need for evaluating 30 } 31 32 public double Evaluate(Individual individual, IRandom random) { 33 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 34 var quality = 0.0; 35 //quality = individual.RealVector("r").Sum(x => x * x); 36 return quality; 37 } 10 namespace HeuristicLab.Problems.ExternalEvaluation { 11 public class CompiledSingleObjectiveOptimizationSupport : CompiledOptimizationSupport, ISingleObjectiveOptimizationSupport { 38 12 39 13 public void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) {
Note: See TracChangeset
for help on using the changeset viewer.