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

Last change on this file since 13350 was 13350, checked in by mkommend, 7 years ago

#2521: Adapted multi-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  //TODO
54  /*
55  [Item("Integer Vector Programmable Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")]
56  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
57  [StorableClass]
58  public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
59
60    [StorableConstructor]
61    private SingleObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
62    private SingleObjectiveIntegerVectorProgrammableProblem(SingleObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
63    public SingleObjectiveIntegerVectorProgrammableProblem()
64      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
65
66    public override IDeepCloneable Clone(Cloner cloner) {
67      return new SingleObjectiveIntegerVectorProgrammableProblem(this, cloner);
68    }
69  }
70
71  [Item("Real Vector Programmable Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")]
72  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
73  [StorableClass]
74  public sealed class SingleObjectiveRealVectorProgrammableProblem : SingleObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
75
76    [StorableConstructor]
77    private SingleObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
78    private SingleObjectiveRealVectorProgrammableProblem(SingleObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
79    public SingleObjectiveRealVectorProgrammableProblem()
80      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.RealVectorEncoding", "RealVectorEncoding", "RealVector")) { }
81
82    public override IDeepCloneable Clone(Cloner cloner) {
83      return new SingleObjectiveRealVectorProgrammableProblem(this, cloner);
84    }
85  }
86
87  [Item("Permutation Programmable Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")]
88  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
89  [StorableClass]
90  public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
91
92    [StorableConstructor]
93    private SingleObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
94    private SingleObjectivePermutationProgrammableProblem(SingleObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
95    public SingleObjectivePermutationProgrammableProblem()
96      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.PermutationEncoding", "PermutationEncoding", "Permutation")) { }
97
98    public override IDeepCloneable Clone(Cloner cloner) {
99      return new SingleObjectivePermutationProgrammableProblem(this, cloner);
100    }
101  }
102
103  [Item("Symbolic Expression Tree Programmable Problem (single-objective)", "Represents a symbolic expression tree single-objective problem that can be programmed with a script.")]
104  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
105  [StorableClass]
106  public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
107
108    [StorableConstructor]
109    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
110    private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(SingleObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
111    public SingleObjectiveSymbolicExpressionTreeProgrammableProblem()
112      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
113
114    public override IDeepCloneable Clone(Cloner cloner) {
115      return new SingleObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
116    }
117  }
118
119  [Item("Linear Linkage Programmable Problem (single-objective)", "Represents a linear linkage single-objective problem that can be programmed with a script.")]
120  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
121  [StorableClass]
122  public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
123
124    [StorableConstructor]
125    private SingleObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
126    private SingleObjectiveLinearLinkageProgrammableProblem(SingleObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
127    public SingleObjectiveLinearLinkageProgrammableProblem()
128      : base(string.Format(ScriptTemplates.CompiledSingleObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
129
130    public override IDeepCloneable Clone(Cloner cloner) {
131      return new SingleObjectiveLinearLinkageProgrammableProblem(this, cloner);
132    }
133  }*/
134}
Note: See TracBrowser for help on using the repository browser.