Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 13373 was 13373, checked in by abeham, 8 years ago

#2521: adapted templates, fixed missing reference in outdated plugin lawnmower

File size: 18.1 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.PermutationEncoding;
29using HeuristicLab.Encodings.RealVectorEncoding;
30using HeuristicLab.Optimization;
31using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
32
33namespace HeuristicLab.Problems.Programmable {
34  #region single-objective
35  [Item("Binary Vector Problem (single-objective)", "Represents a binary vector single-objective problem that can be programmed with a script.")]
36  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
37  [StorableClass]
38  public sealed class SingleObjectiveBinaryVectorProgrammableProblem : SingleObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
39
40    [StorableConstructor]
41    private SingleObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
42    private SingleObjectiveBinaryVectorProgrammableProblem(SingleObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
43
44    public SingleObjectiveBinaryVectorProgrammableProblem()
45      : base() {
46      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
47      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
48      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "BinaryVectorEncoding");
49      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "BinaryVector");
50      ProblemScript.Code = codeTemplate;
51    }
52
53
54    public override IDeepCloneable Clone(Cloner cloner) {
55      return new SingleObjectiveBinaryVectorProgrammableProblem(this, cloner);
56    }
57  }
58
59  [Item("Combined Encoding Problem (single-objective)", "Represents a combined encoding single-objective problem that can be programmed with a script.")]
60  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
61  [StorableClass]
62  public sealed class SingleObjectiveMultiSolutionProgrammableProblem : SingleObjectiveProgrammableProblem<MultiEncoding, CombinedSolution> {
63
64    [StorableConstructor]
65    private SingleObjectiveMultiSolutionProgrammableProblem(bool deserializing) : base(deserializing) { }
66    private SingleObjectiveMultiSolutionProgrammableProblem(SingleObjectiveMultiSolutionProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
67
68    public SingleObjectiveMultiSolutionProgrammableProblem()
69      : base() {
70      ProblemScript.Code = ScriptTemplates.SingleObjectiveCombinedEncodingProblem_Template;
71    }
72
73
74    public override IDeepCloneable Clone(Cloner cloner) {
75      return new SingleObjectiveMultiSolutionProgrammableProblem(this, cloner);
76    }
77  }
78
79  [Item("Integer Vector Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
80  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
81  [StorableClass]
82  public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
83
84    [StorableConstructor]
85    private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
86    private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
87
88    public SingleObjectiveIntegerVectorProgrammableProblem()
89      : base() {
90      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
91      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
92      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "IntegerVectorEncoding");
93      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "IntegerVector");
94      ProblemScript.Code = codeTemplate;
95    }
96
97    public override IDeepCloneable Clone(Cloner cloner) {
98      return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
99    }
100  }
101
102  [Item("Real Vector Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")]
103  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
104  [StorableClass]
105  public sealed class SingleObjectiveRealVectorProgrammableProblem : SingleObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
106
107    [StorableConstructor]
108    private SingleObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
109    private SingleObjectiveRealVectorProgrammableProblem(SingleObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
110
111    public SingleObjectiveRealVectorProgrammableProblem()
112      : base() {
113      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
114      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
115      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "RealVectorEncoding");
116      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "RealVector");
117      ProblemScript.Code = codeTemplate;
118    }
119
120    public override IDeepCloneable Clone(Cloner cloner) {
121      return new SingleObjectiveRealVectorProgrammableProblem(this, cloner);
122    }
123  }
124
125  [Item("Permutation Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")]
126  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
127  [StorableClass]
128  public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
129
130    [StorableConstructor]
131    private SingleObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
132    private SingleObjectivePermutationProgrammableProblem(SingleObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
133
134    public SingleObjectivePermutationProgrammableProblem()
135      : base() {
136      var codeTemplate = ScriptTemplates.SingleObjectiveProblem_Template;
137      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.PermutationEncoding");
138      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "PermutationEncoding");
139      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "Permutation");
140      ProblemScript.Code = codeTemplate;
141    }
142
143    public override IDeepCloneable Clone(Cloner cloner) {
144      return new SingleObjectivePermutationProgrammableProblem(this, cloner);
145    }
146  }
147
148  //[Item("Symbolic Expression Tree Programmable Problem (single-objective)", "Represents a symbolic expression tree single-objective problem that can be programmed with a script.")]
149  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
150  //[StorableClass]
151  //public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
152
153  //  [StorableConstructor]
154  //  private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
155  //  private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(SingleObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
156  //  public SingleObjectiveSymbolicExpressionTreeProgrammableProblem()
157  //    : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
158
159  //  public override IDeepCloneable Clone(Cloner cloner) {
160  //    return new SingleObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
161  //  }
162  //}
163
164  //[Item("Linear Linkage Programmable Problem (single-objective)", "Represents a linear linkage single-objective problem that can be programmed with a script.")]
165  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
166  //[StorableClass]
167  //public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
168
169  //  [StorableConstructor]
170  //  private SingleObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
171  //  private SingleObjectiveLinearLinkageProgrammableProblem(SingleObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
172  //  public SingleObjectiveLinearLinkageProgrammableProblem()
173  //    : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
174
175  //  public override IDeepCloneable Clone(Cloner cloner) {
176  //    return new SingleObjectiveLinearLinkageProgrammableProblem(this, cloner);
177  //  }
178  //}
179  #endregion
180
181  #region multi-objective
182  [Item("Binary Vector Problem (multi-objective)", "Represents a binary vector multi-objective problem that can be programmed with a script.")]
183  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
184  [StorableClass]
185  public sealed class MultiObjectiveBinaryVectorProgrammableProblem : MultiObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
186
187    [StorableConstructor]
188    private MultiObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
189    private MultiObjectiveBinaryVectorProgrammableProblem(MultiObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
190
191    public MultiObjectiveBinaryVectorProgrammableProblem()
192      : base() {
193      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
194      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
195      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "BinaryVectorEncoding");
196      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "BinaryVector");
197      ProblemScript.Code = codeTemplate;
198    }
199
200
201    public override IDeepCloneable Clone(Cloner cloner) {
202      return new MultiObjectiveBinaryVectorProgrammableProblem(this, cloner);
203    }
204  }
205
206  [Item("Combined Encoding Problem (multi-objective)", "Represents a combined encoding multi-objective problem that can be programmed with a script.")]
207  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
208  [StorableClass]
209  public sealed class MultiObjectiveMultiSolutionProgrammableProblem : MultiObjectiveProgrammableProblem<MultiEncoding, CombinedSolution> {
210
211    [StorableConstructor]
212    private MultiObjectiveMultiSolutionProgrammableProblem(bool deserializing) : base(deserializing) { }
213    private MultiObjectiveMultiSolutionProgrammableProblem(MultiObjectiveMultiSolutionProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
214
215    public MultiObjectiveMultiSolutionProgrammableProblem()
216      : base() {
217      ProblemScript.Code = ScriptTemplates.MultiObjectiveCombinedEncodingProblem_Template;
218    }
219
220
221    public override IDeepCloneable Clone(Cloner cloner) {
222      return new MultiObjectiveMultiSolutionProgrammableProblem(this, cloner);
223    }
224  }
225
226  [Item("Integer Vector Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")]
227  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
228  [StorableClass]
229  public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
230
231    [StorableConstructor]
232    private MultiObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
233    private MultiObjectiveIntegerVectorProgrammableProblem(MultiObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
234
235    public MultiObjectiveIntegerVectorProgrammableProblem()
236      : base() {
237      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
238      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.IntegerVectorEncoding");
239      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "IntegerVectorEncoding");
240      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "IntegerVector");
241      ProblemScript.Code = codeTemplate;
242    }
243
244    public override IDeepCloneable Clone(Cloner cloner) {
245      return new MultiObjectiveIntegerVectorProgrammableProblem(this, cloner);
246    }
247  }
248
249  [Item("Real Vector Problem (multi-objective)", "Represents a real vector multi-objective problem that can be programmed with a script.")]
250  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
251  [StorableClass]
252  public sealed class MultiObjectiveRealVectorProgrammableProblem : MultiObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
253
254    [StorableConstructor]
255    private MultiObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
256    private MultiObjectiveRealVectorProgrammableProblem(MultiObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
257
258    public MultiObjectiveRealVectorProgrammableProblem()
259      : base() {
260      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
261      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.RealVectorEncoding");
262      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "RealVectorEncoding");
263      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "RealVector");
264      ProblemScript.Code = codeTemplate;
265    }
266
267    public override IDeepCloneable Clone(Cloner cloner) {
268      return new MultiObjectiveRealVectorProgrammableProblem(this, cloner);
269    }
270  }
271
272  [Item("Permutation Problem (multi-objective)", "Represents a permutation multi-objective problem that can be programmed with a script.")]
273  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
274  [StorableClass]
275  public sealed class MultiObjectivePermutationProgrammableProblem : MultiObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
276
277    [StorableConstructor]
278    private MultiObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
279    private MultiObjectivePermutationProgrammableProblem(MultiObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
280    public MultiObjectivePermutationProgrammableProblem()
281      : base() {
282      var codeTemplate = ScriptTemplates.MultiObjectiveProblem_Template;
283      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.PermutationEncoding");
284      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "PermutationEncoding");
285      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "Permutation");
286      ProblemScript.Code = codeTemplate;
287    }
288
289    public override IDeepCloneable Clone(Cloner cloner) {
290      return new MultiObjectivePermutationProgrammableProblem(this, cloner);
291    }
292  }
293
294  //[Item("Symbolic Expression Tree Programmable Problem (multi-objective)", "Represents a symbolic expression tree multi-objective problem that can be programmed with a script.")]
295  //[Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
296  //[StorableClass]
297  //public sealed class MultiObjectiveSymbolicExpressionTreeProgrammableProblem : MultiObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
298
299  //  [StorableConstructor]
300  //  private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
301  //  private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(MultiObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
302  //  public MultiObjectiveSymbolicExpressionTreeProgrammableProblem()
303  //    : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
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.Problems, Priority = 100)]
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(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
320
321  //  public override IDeepCloneable Clone(Cloner cloner) {
322  //    return new MultiObjectiveLinearLinkageProgrammableProblem(this, cloner);
323  //  }
324  //}
325  #endregion
326}
Note: See TracBrowser for help on using the repository browser.