- Timestamp:
- 11/24/15 19:15:23 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates/MultiObjectiveCombinedEncodingProblem_Template.cs
r13380 r13390 22 22 // Add additional initialization code e.g. private variables that you need for evaluating 23 23 //Encoding.Add(new BinaryVectorEncoding("b") { Length = 10 }); 24 //Encoding.Add(new IntegerVectorEncoding("i") { Length = 10, Bounds = new int[,] { { -100, 100 } }});25 //Encoding.Add(new RealVectorEncoding("r") { Length = 10, Bounds = new double[,] { { -100, 100 } }});26 //Encoding.Add(new PermutationEncoding("p") { Length = 20, PermutationType = PermutationTypes.Absolute });24 //Encoding.Add(new IntegerVectorEncoding("i") { Length = 10, Bounds = new IntMatrix(new int[,] { { -100, 100 } }) }); 25 //Encoding.Add(new RealVectorEncoding("r") { Length = 10, Bounds = new DoubleMatrix(new double[,] { { -100, 100 } }) }); 26 //Encoding.Add(new PermutationEncoding("p") { Length = 20, Type = PermutationTypes.Absolute }); 27 27 //Encoding.Add(new LinearLinkageEncoding("lle") { Length = 30 }); 28 28 } … … 31 31 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 32 32 var quality = new[] { 0.0, 0.0 }; 33 // 34 // 35 // 36 // 33 //var b = solution.GetSolution<BinaryVector>("b"); 34 //quality[0] = b.Count(x => x); // one max! 35 //var r = solution.GetSolution<RealVector>("r"); 36 //quality[1] = r.Select((i, v) => new { Idx = i, Val = v }).Sum(x => b[x.Idx] ? x.Val * x.Val : 0.0); // sphere 37 37 38 38 // NOTE: Check the Maximization property above (true or false)! -
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates/SingleObjectiveCombinedEncodingProblem_Template.cs
r13380 r13390 22 22 // Add additional initialization code e.g. private variables that you need for evaluating 23 23 //Encoding.Add(new BinaryVectorEncoding("b") { Length = 10 }); 24 //Encoding.Add(new IntegerVectorEncoding("i") { Length = 10, Bounds = new int[,] { { -100, 100 } }});25 //Encoding.Add(new RealVectorEncoding("r") { Length = 10, Bounds = new double[,] { { -100, 100 } }});26 //Encoding.Add(new PermutationEncoding("p") { Length = 20, PermutationType = PermutationTypes.Absolute });24 //Encoding.Add(new IntegerVectorEncoding("i") { Length = 10, Bounds = new IntMatrix(new int[,] { { -100, 100 } }) }); 25 //Encoding.Add(new RealVectorEncoding("r") { Length = 10, Bounds = new DoubleMatrix(new double[,] { { -100, 100 } }) }); 26 //Encoding.Add(new PermutationEncoding("p") { Length = 20, Type = PermutationTypes.Absolute }); 27 27 //Encoding.Add(new LinearLinkageEncoding("lle") { Length = 30 }); 28 28 } … … 31 31 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 32 32 var quality = 0.0; 33 // 34 // 35 // 36 // 33 //var b = solution.GetSolution<BinaryVector>("b"); 34 //quality = b.Count(x => x); // one max! 35 //var r = solution.GetSolution<RealVector>("r"); 36 //quality += r.Sum(x => -x * x); // sphere 37 37 38 38 // NOTE: Check the Maximization property above (true or false)!
Note: See TracChangeset
for help on using the changeset viewer.