Ignore:
Timestamp:
11/24/15 16:01:02 (4 years ago)
Author:
mkommend
Message:

#2521: Adapted real vector encoding, test function problems, P3, CMA-ES and optimization.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/ProgrammableProblemInstances.cs

    r13360 r13361  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Encodings.BinaryVectorEncoding;
     27using HeuristicLab.Encodings.RealVectorEncoding;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    3031namespace HeuristicLab.Problems.Programmable {
     32  #region single-objective
    3133  [Item("Binary Vector Programmable Problem (single-objective)", "Represents a binary vector single-objective problem that can be programmed with a script.")]
    3234  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     
    7678    }
    7779  }
    78   //TODO
    79   /*
    80   [Item("Integer Vector Programmable Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
    81   [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
    82   [StorableClass]
    83   public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
    84 
    85     [StorableConstructor]
    86     private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
    87     private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    88     public SingleObjectiveIntegerVectorProgrammableProblem()
    89       : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
    90 
    91     public override IDeepCloneable Clone(Cloner cloner) {
    92       return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
    93     }
    94   }
     80
     81  //[Item("Integer Vector Programmable Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
     82  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     83  //[StorableClass]
     84  //public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
     85
     86  //  [StorableConstructor]
     87  //  private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
     88  //  private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     89  //  public SingleObjectiveIntegerVectorProgrammableProblem()
     90  //    : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
     91
     92  //  public override IDeepCloneable Clone(Cloner cloner) {
     93  //    return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
     94  //  }
     95  //}
    9596
    9697  [Item("Real Vector Programmable Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")]
     
    102103    private SingleObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
    103104    private SingleObjectiveRealVectorProgrammableProblem(SingleObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     105
    104106    public SingleObjectiveRealVectorProgrammableProblem()
    105       : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.RealVectorEncoding", "RealVectorEncoding", "RealVector")) { }
     107      : base() {
     108      var codeTemplate = ScriptTemplates.CompiledSingleObjectiveProblemDefinition_Template;
     109      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
     110      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "RealVectorEncoding");
     111      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "RealVector");
     112      ProblemScript.Code = codeTemplate;
     113    }
    106114
    107115    public override IDeepCloneable Clone(Cloner cloner) {
     
    110118  }
    111119
    112   [Item("Permutation Programmable Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")]
    113   [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
    114   [StorableClass]
    115   public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
    116 
    117     [StorableConstructor]
    118     private SingleObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
    119     private SingleObjectivePermutationProgrammableProblem(SingleObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    120     public SingleObjectivePermutationProgrammableProblem()
    121       : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.PermutationEncoding", "PermutationEncoding", "Permutation")) { }
    122 
    123     public override IDeepCloneable Clone(Cloner cloner) {
    124       return new SingleObjectivePermutationProgrammableProblem(this, cloner);
    125     }
    126   }
    127 
    128   [Item("Symbolic Expression Tree Programmable Problem (single-objective)", "Represents a symbolic expression tree single-objective problem that can be programmed with a script.")]
    129   [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
    130   [StorableClass]
    131   public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
    132 
    133     [StorableConstructor]
    134     private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
    135     private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(SingleObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    136     public SingleObjectiveSymbolicExpressionTreeProgrammableProblem()
    137       : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
    138 
    139     public override IDeepCloneable Clone(Cloner cloner) {
    140       return new SingleObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
    141     }
    142   }
    143 
    144   [Item("Linear Linkage Programmable Problem (single-objective)", "Represents a linear linkage single-objective problem that can be programmed with a script.")]
    145   [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
    146   [StorableClass]
    147   public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
    148 
    149     [StorableConstructor]
    150     private SingleObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
    151     private SingleObjectiveLinearLinkageProgrammableProblem(SingleObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
    152     public SingleObjectiveLinearLinkageProgrammableProblem()
    153       : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
    154 
    155     public override IDeepCloneable Clone(Cloner cloner) {
    156       return new SingleObjectiveLinearLinkageProgrammableProblem(this, cloner);
    157     }
    158   }*/
     120  //[Item("Permutation Programmable Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")]
     121  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     122  //[StorableClass]
     123  //public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
     124
     125  //  [StorableConstructor]
     126  //  private SingleObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
     127  //  private SingleObjectivePermutationProgrammableProblem(SingleObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     128  //  public SingleObjectivePermutationProgrammableProblem()
     129  //    : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.PermutationEncoding", "PermutationEncoding", "Permutation")) { }
     130
     131  //  public override IDeepCloneable Clone(Cloner cloner) {
     132  //    return new SingleObjectivePermutationProgrammableProblem(this, cloner);
     133  //  }
     134  //}
     135
     136  //[Item("Symbolic Expression Tree Programmable Problem (single-objective)", "Represents a symbolic expression tree single-objective problem that can be programmed with a script.")]
     137  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     138  //[StorableClass]
     139  //public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
     140
     141  //  [StorableConstructor]
     142  //  private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
     143  //  private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(SingleObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     144  //  public SingleObjectiveSymbolicExpressionTreeProgrammableProblem()
     145  //    : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
     146
     147  //  public override IDeepCloneable Clone(Cloner cloner) {
     148  //    return new SingleObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
     149  //  }
     150  //}
     151
     152  //[Item("Linear Linkage Programmable Problem (single-objective)", "Represents a linear linkage single-objective problem that can be programmed with a script.")]
     153  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     154  //[StorableClass]
     155  //public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
     156
     157  //  [StorableConstructor]
     158  //  private SingleObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
     159  //  private SingleObjectiveLinearLinkageProgrammableProblem(SingleObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     160  //  public SingleObjectiveLinearLinkageProgrammableProblem()
     161  //    : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
     162
     163  //  public override IDeepCloneable Clone(Cloner cloner) {
     164  //    return new SingleObjectiveLinearLinkageProgrammableProblem(this, cloner);
     165  //  }
     166  //}
     167  #endregion
     168
     169  #region multi-objective
     170  [Item("Binary Vector Programmable Problem (multi-objective)", "Represents a binary vector multi-objective problem that can be programmed with a script.")]
     171  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     172  [StorableClass]
     173  public sealed class MultiObjectiveBinaryVectorProgrammableProblem : MultiObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
     174
     175    [StorableConstructor]
     176    private MultiObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
     177    private MultiObjectiveBinaryVectorProgrammableProblem(MultiObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     178
     179    public MultiObjectiveBinaryVectorProgrammableProblem()
     180      : base() {
     181      var codeTemplate = ScriptTemplates.CompiledMultiObjectiveProblemDefinition_Template;
     182      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
     183      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "BinaryVectorEncoding");
     184      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "BinaryVector");
     185      ProblemScript.Code = codeTemplate;
     186    }
     187
     188
     189    public override IDeepCloneable Clone(Cloner cloner) {
     190      return new MultiObjectiveBinaryVectorProgrammableProblem(this, cloner);
     191    }
     192  }
     193
     194  [Item("Multi Solution Programmable Problem (multi-objective)", "Represents a multi solution multi-objective problem that can be programmed with a script.")]
     195  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     196  [StorableClass]
     197  public sealed class MultiObjectiveMultiSolutionProgrammableProblem : MultiObjectiveProgrammableProblem<MultiEncoding, CombinedSolution> {
     198
     199    [StorableConstructor]
     200    private MultiObjectiveMultiSolutionProgrammableProblem(bool deserializing) : base(deserializing) { }
     201    private MultiObjectiveMultiSolutionProgrammableProblem(MultiObjectiveMultiSolutionProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     202
     203    public MultiObjectiveMultiSolutionProgrammableProblem()
     204      : base() {
     205      var codeTemplate = ScriptTemplates.CompiledSingleObjectiveProblemDefinition_Template;
     206      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
     207      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "MultiEncoding");
     208      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "CombinedSolution");
     209      ProblemScript.Code = codeTemplate;
     210    }
     211
     212
     213    public override IDeepCloneable Clone(Cloner cloner) {
     214      return new MultiObjectiveMultiSolutionProgrammableProblem(this, cloner);
     215    }
     216  }
     217
     218  //[Item("Integer Vector Programmable Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")]
     219  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     220  //[StorableClass]
     221  //public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
     222
     223  //  [StorableConstructor]
     224  //  private MultiObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
     225  //  private MultiObjectiveIntegerVectorProgrammableProblem(MultiObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     226  //  public MultiObjectiveIntegerVectorProgrammableProblem()
     227  //    : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
     228
     229  //  public override IDeepCloneable Clone(Cloner cloner) {
     230  //    return new MultiObjectiveIntegerVectorProgrammableProblem(this, cloner);
     231  //  }
     232  //}
     233
     234  [Item("Real Vector Programmable Problem (multi-objective)", "Represents a real vector multi-objective problem that can be programmed with a script.")]
     235  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     236  [StorableClass]
     237  public sealed class MultiObjectiveRealVectorProgrammableProblem : MultiObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
     238
     239    [StorableConstructor]
     240    private MultiObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
     241    private MultiObjectiveRealVectorProgrammableProblem(MultiObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     242
     243    public MultiObjectiveRealVectorProgrammableProblem()
     244      : base() {
     245      var codeTemplate = ScriptTemplates.CompiledSingleObjectiveProblemDefinition_Template;
     246      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
     247      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "RealVectorEncoding");
     248      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "RealVector");
     249      ProblemScript.Code = codeTemplate;
     250    }
     251
     252    public override IDeepCloneable Clone(Cloner cloner) {
     253      return new MultiObjectiveRealVectorProgrammableProblem(this, cloner);
     254    }
     255  }
     256
     257  //[Item("Permutation Programmable Problem (multi-objective)", "Represents a permutation multi-objective problem that can be programmed with a script.")]
     258  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     259  //[StorableClass]
     260  //public sealed class MultiObjectivePermutationProgrammableProblem : MultiObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
     261
     262  //  [StorableConstructor]
     263  //  private MultiObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
     264  //  private MultiObjectivePermutationProgrammableProblem(MultiObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     265  //  public MultiObjectivePermutationProgrammableProblem()
     266  //    : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.PermutationEncoding", "PermutationEncoding", "Permutation")) { }
     267
     268  //  public override IDeepCloneable Clone(Cloner cloner) {
     269  //    return new MultiObjectivePermutationProgrammableProblem(this, cloner);
     270  //  }
     271  //}
     272
     273  //[Item("Symbolic Expression Tree Programmable Problem (multi-objective)", "Represents a symbolic expression tree multi-objective problem that can be programmed with a script.")]
     274  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     275  //[StorableClass]
     276  //public sealed class MultiObjectiveSymbolicExpressionTreeProgrammableProblem : MultiObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
     277
     278  //  [StorableConstructor]
     279  //  private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
     280  //  private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(MultiObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     281  //  public MultiObjectiveSymbolicExpressionTreeProgrammableProblem()
     282  //    : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
     283
     284  //  public override IDeepCloneable Clone(Cloner cloner) {
     285  //    return new MultiObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
     286  //  }
     287  //}
     288
     289  //[Item("Linear Linkage Programmable Problem (multi-objective)", "Represents a linear linkage multi-objective problem that can be programmed with a script.")]
     290  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
     291  //[StorableClass]
     292  //public sealed class MultiObjectiveLinearLinkageProgrammableProblem : MultiObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
     293
     294  //  [StorableConstructor]
     295  //  private MultiObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
     296  //  private MultiObjectiveLinearLinkageProgrammableProblem(MultiObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
     297  //  public MultiObjectiveLinearLinkageProgrammableProblem()
     298  //    : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
     299
     300  //  public override IDeepCloneable Clone(Cloner cloner) {
     301  //    return new MultiObjectiveLinearLinkageProgrammableProblem(this, cloner);
     302  //  }
     303  //}
     304  #endregion
    159305}
Note: See TracChangeset for help on using the changeset viewer.