Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/15 19:15:23 (9 years ago)
Author:
abeham
Message:

#2521: fixed template and bug in programmable problem with multi encoding

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  
    2222      // Add additional initialization code e.g. private variables that you need for evaluating
    2323      //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 });
    2727      //Encoding.Add(new LinearLinkageEncoding("lle") { Length = 30 });
    2828    }
     
    3131      // Use vars.yourVariable to access variables in the variable store i.e. yourVariable
    3232      var quality = new[] { 0.0, 0.0 };
    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
     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
    3737
    3838      // NOTE: Check the Maximization property above (true or false)!
  • branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates/SingleObjectiveCombinedEncodingProblem_Template.cs

    r13380 r13390  
    2222      // Add additional initialization code e.g. private variables that you need for evaluating
    2323      //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 });
    2727      //Encoding.Add(new LinearLinkageEncoding("lle") { Length = 30 });
    2828    }
     
    3131      // Use vars.yourVariable to access variables in the variable store i.e. yourVariable
    3232      var quality = 0.0;
    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
     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
    3737
    3838      // NOTE: Check the Maximization property above (true or false)!
Note: See TracChangeset for help on using the changeset viewer.