Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/ProgrammableProblemInstances.cs @ 14778

Last change on this file since 14778 was 13376, checked in by abeham, 9 years ago

#2521: working on refactoring

File size: 19.4 KB
RevLine 
[13345]1#region License Information
2
3/* HeuristicLab
4 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
5 *
6 * This file is part of HeuristicLab.
7 *
8 * HeuristicLab is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * HeuristicLab is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#endregion
23
24using HeuristicLab.Common;
25using HeuristicLab.Core;
26using HeuristicLab.Encodings.BinaryVectorEncoding;
[13364]27using HeuristicLab.Encodings.IntegerVectorEncoding;
[13376]28using HeuristicLab.Encodings.LinearLinkageEncoding;
[13373]29using HeuristicLab.Encodings.PermutationEncoding;
[13361]30using HeuristicLab.Encodings.RealVectorEncoding;
[13376]31using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
[13351]32using HeuristicLab.Optimization;
[13345]33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
34
35namespace HeuristicLab.Problems.Programmable {
[13361]36  #region single-objective
[13373]37  [Item("Binary Vector Problem (single-objective)", "Represents a binary vector single-objective problem that can be programmed with a script.")]
[13376]38  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 100)]
[13345]39  [StorableClass]
40  public sealed class SingleObjectiveBinaryVectorProgrammableProblem : SingleObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
41
42    [StorableConstructor]
43    private SingleObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
44    private SingleObjectiveBinaryVectorProgrammableProblem(SingleObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
[13348]45
[13345]46    public SingleObjectiveBinaryVectorProgrammableProblem()
[13348]47      : base() {
[13373]48      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
[13348]49      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
50      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "BinaryVectorEncoding");
51      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "BinaryVector");
52      ProblemScript.Code = codeTemplate;
53    }
[13345]54
[13348]55
[13345]56    public override IDeepCloneable Clone(Cloner cloner) {
57      return new SingleObjectiveBinaryVectorProgrammableProblem(this, cloner);
58    }
59  }
[13351]60
[13373]61  [Item("Integer Vector Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
[13376]62  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 101)]
[13364]63  [StorableClass]
64  public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
[13345]65
[13364]66    [StorableConstructor]
67    private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
68    private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
[13345]69
[13364]70    public SingleObjectiveIntegerVectorProgrammableProblem()
71      : base() {
[13373]72      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
[13364]73      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
74      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "IntegerVectorEncoding");
75      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "IntegerVector");
76      ProblemScript.Code = codeTemplate;
77    }
[13361]78
[13364]79    public override IDeepCloneable Clone(Cloner cloner) {
80      return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
81    }
82  }
83
[13373]84  [Item("Real Vector Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")]
[13376]85  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 102)]
[13345]86  [StorableClass]
87  public sealed class SingleObjectiveRealVectorProgrammableProblem : SingleObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
88
89    [StorableConstructor]
90    private SingleObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
91    private SingleObjectiveRealVectorProgrammableProblem(SingleObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
[13361]92
[13345]93    public SingleObjectiveRealVectorProgrammableProblem()
[13361]94      : base() {
[13373]95      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
[13361]96      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
97      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "RealVectorEncoding");
98      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "RealVector");
99      ProblemScript.Code = codeTemplate;
100    }
[13345]101
102    public override IDeepCloneable Clone(Cloner cloner) {
103      return new SingleObjectiveRealVectorProgrammableProblem(this, cloner);
104    }
105  }
106
[13373]107  [Item("Permutation Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")]
[13376]108  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 103)]
[13373]109  [StorableClass]
110  public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
[13361]111
[13373]112    [StorableConstructor]
113    private SingleObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
114    private SingleObjectivePermutationProgrammableProblem(SingleObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
[13361]115
[13373]116    public SingleObjectivePermutationProgrammableProblem()
117      : base() {
118      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
119      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.PermutationEncoding");
120      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "PermutationEncoding");
121      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "Permutation");
122      ProblemScript.Code = codeTemplate;
123    }
[13361]124
[13373]125    public override IDeepCloneable Clone(Cloner cloner) {
126      return new SingleObjectivePermutationProgrammableProblem(this, cloner);
127    }
128  }
129
[13376]130  [Item("Symbolic Expression Tree Problem (single-objective)", "Represents a symbolic expression tree single-objective problem that can be programmed with a script.")]
131  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 104)]
132  [StorableClass]
133  public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> {
[13361]134
[13376]135    [StorableConstructor]
136    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
137    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(SingleObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
138    public SingleObjectiveSymbolicExpressionTreeProgrammableProblem()
139      : base() {
140      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
141      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding");
142      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "SymbolicExpressionTreeEncoding");
143      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "ISymbolicExpressionTree");
144      ProblemScript.Code = codeTemplate;
145    }
[13361]146
[13376]147    public override IDeepCloneable Clone(Cloner cloner) {
148      return new SingleObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
149    }
150  }
[13361]151
[13376]152  [Item("Linear Linkage Problem (single-objective)", "Represents a linear linkage single-objective problem that can be programmed with a script.")]
153  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 105)]
154  [StorableClass]
155  public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
[13361]156
[13376]157    [StorableConstructor]
158    private SingleObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
159    private SingleObjectiveLinearLinkageProgrammableProblem(SingleObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
160    public SingleObjectiveLinearLinkageProgrammableProblem()
161      : base() {
162      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
163      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.LinearLinkageEncoding");
164      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "LinearLinkageEncoding");
165      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "LinearLinkage");
166      ProblemScript.Code = codeTemplate;
167    }
[13361]168
[13376]169    public override IDeepCloneable Clone(Cloner cloner) {
170      return new SingleObjectiveLinearLinkageProgrammableProblem(this, cloner);
171    }
172  }
173
174  [Item("Combined Encoding Problem (single-objective)", "Represents a combined encoding single-objective problem that can be programmed with a script.")]
175  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 1000)]
176  [StorableClass]
177  public sealed class SingleObjectiveCombinedEncodingProgrammableProblem : SingleObjectiveProgrammableProblem<CombinedEncoding, CombinedSolution> {
178
179    [StorableConstructor]
180    private SingleObjectiveCombinedEncodingProgrammableProblem(bool deserializing) : base(deserializing) { }
181    private SingleObjectiveCombinedEncodingProgrammableProblem(SingleObjectiveCombinedEncodingProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
182
183    public SingleObjectiveCombinedEncodingProgrammableProblem()
184      : base() {
185      ProblemScript.Code = ScriptTemplates.SingleObjectiveCombinedEncodingProblem_Template;
186    }
187
188
189    public override IDeepCloneable Clone(Cloner cloner) {
190      return new SingleObjectiveCombinedEncodingProgrammableProblem(this, cloner);
191    }
192  }
[13361]193  #endregion
194
195  #region multi-objective
[13373]196  [Item("Binary Vector Problem (multi-objective)", "Represents a binary vector multi-objective problem that can be programmed with a script.")]
[13376]197  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 100)]
[13345]198  [StorableClass]
[13361]199  public sealed class MultiObjectiveBinaryVectorProgrammableProblem : MultiObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
[13345]200
201    [StorableConstructor]
[13361]202    private MultiObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
203    private MultiObjectiveBinaryVectorProgrammableProblem(MultiObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
[13345]204
[13361]205    public MultiObjectiveBinaryVectorProgrammableProblem()
206      : base() {
[13373]207      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
[13361]208      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
209      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "BinaryVectorEncoding");
210      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "BinaryVector");
211      ProblemScript.Code = codeTemplate;
212    }
213
214
[13345]215    public override IDeepCloneable Clone(Cloner cloner) {
[13361]216      return new MultiObjectiveBinaryVectorProgrammableProblem(this, cloner);
[13345]217    }
218  }
219
[13373]220  [Item("Integer Vector Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")]
[13376]221  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 101)]
[13364]222  [StorableClass]
223  public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
[13361]224
[13364]225    [StorableConstructor]
226    private MultiObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
227    private MultiObjectiveIntegerVectorProgrammableProblem(MultiObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
[13361]228
[13364]229    public MultiObjectiveIntegerVectorProgrammableProblem()
230      : base() {
[13373]231      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
[13364]232      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
233      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "IntegerVectorEncoding");
234      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "IntegerVector");
235      ProblemScript.Code = codeTemplate;
236    }
[13361]237
[13364]238    public override IDeepCloneable Clone(Cloner cloner) {
239      return new MultiObjectiveIntegerVectorProgrammableProblem(this, cloner);
240    }
241  }
242
[13373]243  [Item("Real Vector Problem (multi-objective)", "Represents a real vector multi-objective problem that can be programmed with a script.")]
[13376]244  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 102)]
[13345]245  [StorableClass]
[13361]246  public sealed class MultiObjectiveRealVectorProgrammableProblem : MultiObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
[13345]247
248    [StorableConstructor]
[13361]249    private MultiObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
250    private MultiObjectiveRealVectorProgrammableProblem(MultiObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
[13345]251
[13361]252    public MultiObjectiveRealVectorProgrammableProblem()
253      : base() {
[13373]254      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
[13361]255      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
256      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "RealVectorEncoding");
257      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "RealVector");
258      ProblemScript.Code = codeTemplate;
259    }
260
[13345]261    public override IDeepCloneable Clone(Cloner cloner) {
[13361]262      return new MultiObjectiveRealVectorProgrammableProblem(this, cloner);
[13345]263    }
[13361]264  }
265
[13373]266  [Item("Permutation Problem (multi-objective)", "Represents a permutation multi-objective problem that can be programmed with a script.")]
[13376]267  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 103)]
[13373]268  [StorableClass]
269  public sealed class MultiObjectivePermutationProgrammableProblem : MultiObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
[13361]270
[13373]271    [StorableConstructor]
272    private MultiObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
273    private MultiObjectivePermutationProgrammableProblem(MultiObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
274    public MultiObjectivePermutationProgrammableProblem()
275      : base() {
276      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
277      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.PermutationEncoding");
278      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "PermutationEncoding");
279      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "Permutation");
280      ProblemScript.Code = codeTemplate;
281    }
[13361]282
[13373]283    public override IDeepCloneable Clone(Cloner cloner) {
284      return new MultiObjectivePermutationProgrammableProblem(this, cloner);
285    }
286  }
[13361]287
[13376]288  [Item("Symbolic Expression Tree Programmable Problem (multi-objective)", "Represents a symbolic expression tree multi-objective problem that can be programmed with a script.")]
289  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 104)]
290  [StorableClass]
291  public sealed class MultiObjectiveSymbolicExpressionTreeProgrammableProblem : MultiObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> {
[13361]292
[13376]293    [StorableConstructor]
294    private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
295    private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(MultiObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
296    public MultiObjectiveSymbolicExpressionTreeProgrammableProblem()
297      : base() {
298      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
299      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding");
300      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "SymbolicExpressionTreeEncoding");
301      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "ISymbolicExpressionTree");
302      ProblemScript.Code = codeTemplate;
303    }
[13361]304
[13376]305    public override IDeepCloneable Clone(Cloner cloner) {
306      return new MultiObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
307    }
308  }
[13361]309
[13376]310  [Item("Linear Linkage Programmable Problem (multi-objective)", "Represents a linear linkage multi-objective problem that can be programmed with a script.")]
311  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 105)]
312  [StorableClass]
313  public sealed class MultiObjectiveLinearLinkageProgrammableProblem : MultiObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
[13361]314
[13376]315    [StorableConstructor]
316    private MultiObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
317    private MultiObjectiveLinearLinkageProgrammableProblem(MultiObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
318    public MultiObjectiveLinearLinkageProgrammableProblem()
319      : base() {
320      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
321      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.LinearLinkageEncoding");
322      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "LinearLinkageEncoding");
323      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "LinearLinkage");
324      ProblemScript.Code = codeTemplate;
325    }
[13361]326
[13376]327    public override IDeepCloneable Clone(Cloner cloner) {
328      return new MultiObjectiveLinearLinkageProgrammableProblem(this, cloner);
329    }
330  }
331
332  [Item("Combined Encoding Problem (multi-objective)", "Represents a combined encoding multi-objective problem that can be programmed with a script.")]
333  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 1000)]
334  [StorableClass]
335  public sealed class MultiObjectiveCombinedEncodingProgrammableProblem : MultiObjectiveProgrammableProblem<CombinedEncoding, CombinedSolution> {
336
337    [StorableConstructor]
338    private MultiObjectiveCombinedEncodingProgrammableProblem(bool deserializing) : base(deserializing) { }
339    private MultiObjectiveCombinedEncodingProgrammableProblem(MultiObjectiveCombinedEncodingProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
340
341    public MultiObjectiveCombinedEncodingProgrammableProblem()
342      : base() {
343      ProblemScript.Code = ScriptTemplates.MultiObjectiveCombinedEncodingProblem_Template;
344    }
345
346
347    public override IDeepCloneable Clone(Cloner cloner) {
348      return new MultiObjectiveCombinedEncodingProgrammableProblem(this, cloner);
349    }
350  }
[13361]351  #endregion
[13345]352}
Note: See TracBrowser for help on using the repository browser.