Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblems.cs @ 13348

Last change on this file since 13348 was 13348, checked in by mkommend, 8 years ago

#2521: Refactored single-objective programmable problem.

File size: 7.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 HeuristicLab.Common;
25using HeuristicLab.Core;
26using HeuristicLab.Encodings.BinaryVectorEncoding;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.Programmable {
30  [Item("Binary Vector Programmable Problem (single-objective)", "Represents a binary vector single-objective problem that can be programmed with a script.")]
31  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
32  [StorableClass]
33  public sealed class SingleObjectiveBinaryVectorProgrammableProblem : SingleObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
34
35    [StorableConstructor]
36    private SingleObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
37    private SingleObjectiveBinaryVectorProgrammableProblem(SingleObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
38
39    public SingleObjectiveBinaryVectorProgrammableProblem()
40      : base() {
41      var codeTemplate = ScriptTemplates.CompiledSingleObjectiveProblemDefinition_Template;
42      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
43      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "BinaryVectorEncoding");
44      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "BinaryVector");
45      ProblemScript.Code = codeTemplate;
46    }
47
48
49    public override IDeepCloneable Clone(Cloner cloner) {
50      return new SingleObjectiveBinaryVectorProgrammableProblem(this, cloner);
51    }
52  }
53  /*
54  [Item("Integer Vector Programmable Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
55  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
56  [StorableClass]
57  public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
58
59    [StorableConstructor]
60    private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
61    private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
62    public SingleObjectiveIntegerVectorProgrammableProblem()
63      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
64
65    public override IDeepCloneable Clone(Cloner cloner) {
66      return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
67    }
68  }
69
70  [Item("Real Vector Programmable Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")]
71  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
72  [StorableClass]
73  public sealed class SingleObjectiveRealVectorProgrammableProblem : SingleObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
74
75    [StorableConstructor]
76    private SingleObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
77    private SingleObjectiveRealVectorProgrammableProblem(SingleObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
78    public SingleObjectiveRealVectorProgrammableProblem()
79      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.RealVectorEncoding", "RealVectorEncoding", "RealVector")) { }
80
81    public override IDeepCloneable Clone(Cloner cloner) {
82      return new SingleObjectiveRealVectorProgrammableProblem(this, cloner);
83    }
84  }
85
86  [Item("Permutation Programmable Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")]
87  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
88  [StorableClass]
89  public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
90
91    [StorableConstructor]
92    private SingleObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
93    private SingleObjectivePermutationProgrammableProblem(SingleObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
94    public SingleObjectivePermutationProgrammableProblem()
95      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.PermutationEncoding", "PermutationEncoding", "Permutation")) { }
96
97    public override IDeepCloneable Clone(Cloner cloner) {
98      return new SingleObjectivePermutationProgrammableProblem(this, cloner);
99    }
100  }
101
102  [Item("Symbolic Expression Tree Programmable Problem (single-objective)", "Represents a symbolic expression tree single-objective problem that can be programmed with a script.")]
103  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
104  [StorableClass]
105  public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
106
107    [StorableConstructor]
108    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
109    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(SingleObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
110    public SingleObjectiveSymbolicExpressionTreeProgrammableProblem()
111      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
112
113    public override IDeepCloneable Clone(Cloner cloner) {
114      return new SingleObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
115    }
116  }
117
118  [Item("Linear Linkage Programmable Problem (single-objective)", "Represents a linear linkage single-objective problem that can be programmed with a script.")]
119  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
120  [StorableClass]
121  public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
122
123    [StorableConstructor]
124    private SingleObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
125    private SingleObjectiveLinearLinkageProgrammableProblem(SingleObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
126    public SingleObjectiveLinearLinkageProgrammableProblem()
127      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
128
129    public override IDeepCloneable Clone(Cloner cloner) {
130      return new SingleObjectiveLinearLinkageProgrammableProblem(this, cloner);
131    }
132  }*/
133}
Note: See TracBrowser for help on using the repository browser.