Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2521: working on refactoring

File size: 19.4 KB
Line 
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;
27using HeuristicLab.Encodings.IntegerVectorEncoding;
28using HeuristicLab.Encodings.LinearLinkageEncoding;
29using HeuristicLab.Encodings.PermutationEncoding;
30using HeuristicLab.Encodings.RealVectorEncoding;
31using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
32using HeuristicLab.Optimization;
33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
34
35namespace HeuristicLab.Problems.Programmable {
36  #region single-objective
37  [Item("Binary Vector Problem (single-objective)", "Represents a binary vector single-objective problem that can be programmed with a script.")]
38  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 100)]
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) { }
45
46    public SingleObjectiveBinaryVectorProgrammableProblem()
47      : base() {
48      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
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    }
54
55
56    public override IDeepCloneable Clone(Cloner cloner) {
57      return new SingleObjectiveBinaryVectorProgrammableProblem(this, cloner);
58    }
59  }
60
61  [Item("Integer Vector Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
62  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 101)]
63  [StorableClass]
64  public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
65
66    [StorableConstructor]
67    private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
68    private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
69
70    public SingleObjectiveIntegerVectorProgrammableProblem()
71      : base() {
72      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
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    }
78
79    public override IDeepCloneable Clone(Cloner cloner) {
80      return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
81    }
82  }
83
84  [Item("Real Vector Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")]
85  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 102)]
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) { }
92
93    public SingleObjectiveRealVectorProgrammableProblem()
94      : base() {
95      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
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    }
101
102    public override IDeepCloneable Clone(Cloner cloner) {
103      return new SingleObjectiveRealVectorProgrammableProblem(this, cloner);
104    }
105  }
106
107  [Item("Permutation Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")]
108  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 103)]
109  [StorableClass]
110  public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
111
112    [StorableConstructor]
113    private SingleObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
114    private SingleObjectivePermutationProgrammableProblem(SingleObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
115
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    }
124
125    public override IDeepCloneable Clone(Cloner cloner) {
126      return new SingleObjectivePermutationProgrammableProblem(this, cloner);
127    }
128  }
129
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> {
134
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    }
146
147    public override IDeepCloneable Clone(Cloner cloner) {
148      return new SingleObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
149    }
150  }
151
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> {
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() {
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    }
168
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  }
193  #endregion
194
195  #region multi-objective
196  [Item("Binary Vector Problem (multi-objective)", "Represents a binary vector multi-objective problem that can be programmed with a script.")]
197  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 100)]
198  [StorableClass]
199  public sealed class MultiObjectiveBinaryVectorProgrammableProblem : MultiObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
200
201    [StorableConstructor]
202    private MultiObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
203    private MultiObjectiveBinaryVectorProgrammableProblem(MultiObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
204
205    public MultiObjectiveBinaryVectorProgrammableProblem()
206      : base() {
207      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
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
215    public override IDeepCloneable Clone(Cloner cloner) {
216      return new MultiObjectiveBinaryVectorProgrammableProblem(this, cloner);
217    }
218  }
219
220  [Item("Integer Vector Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")]
221  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 101)]
222  [StorableClass]
223  public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
224
225    [StorableConstructor]
226    private MultiObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
227    private MultiObjectiveIntegerVectorProgrammableProblem(MultiObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
228
229    public MultiObjectiveIntegerVectorProgrammableProblem()
230      : base() {
231      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
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    }
237
238    public override IDeepCloneable Clone(Cloner cloner) {
239      return new MultiObjectiveIntegerVectorProgrammableProblem(this, cloner);
240    }
241  }
242
243  [Item("Real Vector Problem (multi-objective)", "Represents a real vector multi-objective problem that can be programmed with a script.")]
244  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 102)]
245  [StorableClass]
246  public sealed class MultiObjectiveRealVectorProgrammableProblem : MultiObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
247
248    [StorableConstructor]
249    private MultiObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
250    private MultiObjectiveRealVectorProgrammableProblem(MultiObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
251
252    public MultiObjectiveRealVectorProgrammableProblem()
253      : base() {
254      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
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
261    public override IDeepCloneable Clone(Cloner cloner) {
262      return new MultiObjectiveRealVectorProgrammableProblem(this, cloner);
263    }
264  }
265
266  [Item("Permutation Problem (multi-objective)", "Represents a permutation multi-objective problem that can be programmed with a script.")]
267  [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 103)]
268  [StorableClass]
269  public sealed class MultiObjectivePermutationProgrammableProblem : MultiObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
270
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    }
282
283    public override IDeepCloneable Clone(Cloner cloner) {
284      return new MultiObjectivePermutationProgrammableProblem(this, cloner);
285    }
286  }
287
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> {
292
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    }
304
305    public override IDeepCloneable Clone(Cloner cloner) {
306      return new MultiObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
307    }
308  }
309
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> {
314
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    }
326
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  }
351  #endregion
352}
Note: See TracBrowser for help on using the repository browser.