Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/15 21:38:28 (9 years ago)
Author:
abeham
Message:

#2174:

  • Added possibility to define neighborhood and analyze function for external evaluation problems
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  
        55*.vs10x
        66Plugin.cs
         7*.DotSettings
  • branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/CompiledSingleObjectiveOptimizationSupport.cs

    r11886 r11893  
    55using HeuristicLab.Core;
    66using HeuristicLab.Data;
    7 using HeuristicLab.Encodings.PermutationEncoding;
    87using HeuristicLab.Optimization;
    98using HeuristicLab.Problems.Programmable;
    109
    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     }
     10namespace HeuristicLab.Problems.ExternalEvaluation {
     11  public class CompiledSingleObjectiveOptimizationSupport : CompiledOptimizationSupport, ISingleObjectiveOptimizationSupport {
    3812
    3913    public void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) {
Note: See TracChangeset for help on using the changeset viewer.