Changeset 11880 for branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/New/Scripts/Templates/CompiledMultiObjectiveProblemDefinition.cs
- Timestamp:
- 02/04/15 00:03:14 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/New/Scripts/Templates/CompiledMultiObjectiveProblemDefinition.cs
r11786 r11880 14 14 15 15 public override void Initialize() { 16 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 16 17 // Define the solution encoding which can also consist of multiple vectors, examples below 17 18 //Encoding = new BinaryEncoding("b", length: 5); … … 19 20 //Encoding = new RealEncoding("r", length: 5, min: -1.0, max: 1.0); 20 21 //Encoding = new PermutationEncoding("p", length: 5, type: PermutationTypes.Absolute); 21 22 // The encoding can also be a combination 22 23 //Encoding = new MultiEncoding() 23 24 //.Add(new BinaryEncoding("b", length: 5)) … … 26 27 //.Add(new PermutationEncoding("p", length: 5, type: PermutationTypes.Absolute)) 27 28 ; 29 // Add additional initialization code e.g. private variables that you need for evaluating 28 30 } 29 31 30 32 public double[] Evaluate(Individual individual, IRandom random) { 33 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 31 34 var qualities = new[] { 0.0, 0.0 }; 32 // use vars.yourVariable to access variables in the variable store i.e. yourVariable 33 // qualities = new [] { individual.RealVector("r").Sum(x => x * x), individual.RealVector("r").Sum(x => x * x * x) }; 35 //qualities = new [] { individual.RealVector("r").Sum(x => x * x), individual.RealVector("r").Sum(x => x * x * x) }; 34 36 return qualities; 35 37 } 36 38 37 public void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results ) {38 // write or update results given the range of vectors and resulting qualities39 // use e.g. vars.yourVariable to access variables in the variable store i.e. yourVariable39 public void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) { 40 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 41 // Write or update results given the range of vectors and resulting qualities 40 42 } 41 // implement further classes and methods43 // Implement further classes and methods 42 44 } 43 45 }
Note: See TracChangeset
for help on using the changeset viewer.