source: branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/ProgrammableProblemInstances.cs @ 16725

Last change on this file since 16725 was 16725, checked in by abeham, 6 months ago

#2521:

  • Adapt Encodings.ScheduleEncoding to new persistence
  • Adapt Problems.Programmable to new persistence
File size: 19.8 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 HEAL.Attic;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Encodings.BinaryVectorEncoding;
28using HeuristicLab.Encodings.IntegerVectorEncoding;
29using HeuristicLab.Encodings.LinearLinkageEncoding;
30using HeuristicLab.Encodings.PermutationEncoding;
31using HeuristicLab.Encodings.RealVectorEncoding;
32using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
33using HeuristicLab.Optimization;
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  [StorableType("FD06DC4B-FB2C-4325-817A-AC030683537B")]
40  public sealed class SingleObjectiveBinaryVectorProgrammableProblem : SingleObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
41
42    [StorableConstructor]
43    private SingleObjectiveBinaryVectorProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("650DF07C-886D-48DF-B796-CE8C18471E40")]
64  public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
65
66    [StorableConstructor]
67    private SingleObjectiveIntegerVectorProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("FA01E098-D70B-4782-85E0-8DCF9D1F72D3")]
87  public sealed class SingleObjectiveRealVectorProgrammableProblem : SingleObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
88
89    [StorableConstructor]
90    private SingleObjectiveRealVectorProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("51D851AD-8F12-4C00-A626-CDF785574C07")]
110  public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
111
112    [StorableConstructor]
113    private SingleObjectivePermutationProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("49EE7342-D54E-42D4-ADC1-0E79599385A2")]
133  public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> {
134
135    [StorableConstructor]
136    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("C6D025AC-C09A-49F1-BB2C-F40A16687E95")]
155  public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
156
157    [StorableConstructor]
158    private SingleObjectiveLinearLinkageProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("BF5186A9-8695-484D-888D-0DAE0F344AAD")]
177  public sealed class SingleObjectiveCombinedEncodingProgrammableProblem : SingleObjectiveProgrammableProblem<CombinedEncoding, CombinedSolution> {
178
179    [StorableConstructor]
180    private SingleObjectiveCombinedEncodingProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("750F0CF5-2779-49A7-BC32-EA3C593B50DE")]
199  public sealed class MultiObjectiveBinaryVectorProgrammableProblem : MultiObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
200
201    [StorableConstructor]
202    private MultiObjectiveBinaryVectorProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("442F242E-29E6-416A-8CA3-C216300A1FA5")]
223  public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
224
225    [StorableConstructor]
226    private MultiObjectiveIntegerVectorProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("2DEFF24A-755A-4E22-8DD8-B791C0BCC832")]
246  public sealed class MultiObjectiveRealVectorProgrammableProblem : MultiObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
247
248    [StorableConstructor]
249    private MultiObjectiveRealVectorProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("23FC641C-770B-49A2-AA3C-5862F4A55F94")]
269  public sealed class MultiObjectivePermutationProgrammableProblem : MultiObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
270
271    [StorableConstructor]
272    private MultiObjectivePermutationProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("FAEA5ED6-EA8F-4EA2-B84C-7A1B4491292A")]
291  public sealed class MultiObjectiveSymbolicExpressionTreeProgrammableProblem : MultiObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> {
292
293    [StorableConstructor]
294    private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("207E3110-4937-4A95-9331-39880739D7CF")]
313  public sealed class MultiObjectiveLinearLinkageProgrammableProblem : MultiObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
314
315    [StorableConstructor]
316    private MultiObjectiveLinearLinkageProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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  [StorableType("1EE16E10-63DD-41F1-8739-ACE7437D551B")]
335  public sealed class MultiObjectiveCombinedEncodingProgrammableProblem : MultiObjectiveProgrammableProblem<CombinedEncoding, CombinedSolution> {
336
337    [StorableConstructor]
338    private MultiObjectiveCombinedEncodingProgrammableProblem(StorableConstructorFlag _) : base(_) { }
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.