source: branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProgrammableProblems.cs @ 13357

Last change on this file since 13357 was 13357, checked in by abeham, 4 years ago

#2521: changed solution name of combined encoding

File size: 9.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.Optimization;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Problems.Programmable {
31  [Item("Binary Vector Programmable Problem (multi-objective)", "Represents a binary vector multi-objective problem that can be programmed with a script.")]
32  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
33  [StorableClass]
34  public sealed class MultiObjectiveBinaryVectorProgrammableProblem : MultiObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> {
35
36    [StorableConstructor]
37    private MultiObjectiveBinaryVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
38    private MultiObjectiveBinaryVectorProgrammableProblem(MultiObjectiveBinaryVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
39
40    public MultiObjectiveBinaryVectorProgrammableProblem()
41      : base() {
42      var codeTemplate = ScriptTemplates.CompiledMultiObjectiveProblemDefinition_Template;
43      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
44      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "BinaryVectorEncoding");
45      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "BinaryVector");
46      ProblemScript.Code = codeTemplate;
47    }
48
49
50    public override IDeepCloneable Clone(Cloner cloner) {
51      return new MultiObjectiveBinaryVectorProgrammableProblem(this, cloner);
52    }
53  }
54
55  [Item("Multi Solution Programmable Problem (multi-objective)", "Represents a multi solution multi-objective problem that can be programmed with a script.")]
56  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
57  [StorableClass]
58  public sealed class MultiObjectiveMultiSolutionProgrammableProblem : MultiObjectiveProgrammableProblem<MultiEncoding, CombinedSolution> {
59
60    [StorableConstructor]
61    private MultiObjectiveMultiSolutionProgrammableProblem(bool deserializing) : base(deserializing) { }
62    private MultiObjectiveMultiSolutionProgrammableProblem(MultiObjectiveMultiSolutionProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
63
64    public MultiObjectiveMultiSolutionProgrammableProblem()
65      : base() {
66      var codeTemplate = ScriptTemplates.CompiledSingleObjectiveProblemDefinition_Template;
67      codeTemplate = codeTemplate.Replace(ENCODING_NAMESPACE, "HeuristicLab.Encodings.BinaryVectorEncoding");
68      codeTemplate = codeTemplate.Replace(ENCODING_CLASS, "MultiEncoding");
69      codeTemplate = codeTemplate.Replace(SOLUTION_CLASS, "CombinedSolution");
70      ProblemScript.Code = codeTemplate;
71    }
72
73
74    public override IDeepCloneable Clone(Cloner cloner) {
75      return new MultiObjectiveMultiSolutionProgrammableProblem(this, cloner);
76    }
77  }
78
79  //TODO
80  /*
81  [Item("Integer Vector Programmable Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")]
82  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
83  [StorableClass]
84  public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> {
85
86    [StorableConstructor]
87    private MultiObjectiveIntegerVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
88    private MultiObjectiveIntegerVectorProgrammableProblem(MultiObjectiveIntegerVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
89    public MultiObjectiveIntegerVectorProgrammableProblem()
90      : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.IntegerVectorEncoding", "IntegerVectorEncoding", "IntegerVector")) { }
91
92    public override IDeepCloneable Clone(Cloner cloner) {
93      return new MultiObjectiveIntegerVectorProgrammableProblem(this, cloner);
94    }
95  }
96
97  [Item("Real Vector Programmable Problem (multi-objective)", "Represents a real vector multi-objective problem that can be programmed with a script.")]
98  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
99  [StorableClass]
100  public sealed class MultiObjectiveRealVectorProgrammableProblem : MultiObjectiveProgrammableProblem<RealVectorEncoding, RealVector> {
101
102    [StorableConstructor]
103    private MultiObjectiveRealVectorProgrammableProblem(bool deserializing) : base(deserializing) { }
104    private MultiObjectiveRealVectorProgrammableProblem(MultiObjectiveRealVectorProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
105    public MultiObjectiveRealVectorProgrammableProblem()
106      : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.RealVectorEncoding", "RealVectorEncoding", "RealVector")) { }
107
108    public override IDeepCloneable Clone(Cloner cloner) {
109      return new MultiObjectiveRealVectorProgrammableProblem(this, cloner);
110    }
111  }
112
113  [Item("Permutation Programmable Problem (multi-objective)", "Represents a permutation multi-objective problem that can be programmed with a script.")]
114  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
115  [StorableClass]
116  public sealed class MultiObjectivePermutationProgrammableProblem : MultiObjectiveProgrammableProblem<PermutationEncoding, Permutation> {
117
118    [StorableConstructor]
119    private MultiObjectivePermutationProgrammableProblem(bool deserializing) : base(deserializing) { }
120    private MultiObjectivePermutationProgrammableProblem(MultiObjectivePermutationProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
121    public MultiObjectivePermutationProgrammableProblem()
122      : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.PermutationEncoding", "PermutationEncoding", "Permutation")) { }
123
124    public override IDeepCloneable Clone(Cloner cloner) {
125      return new MultiObjectivePermutationProgrammableProblem(this, cloner);
126    }
127  }
128
129  [Item("Symbolic Expression Tree Programmable Problem (multi-objective)", "Represents a symbolic expression tree multi-objective problem that can be programmed with a script.")]
130  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
131  [StorableClass]
132  public sealed class MultiObjectiveSymbolicExpressionTreeProgrammableProblem : MultiObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, SymbolicExpressionTree> {
133
134    [StorableConstructor]
135    private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { }
136    private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(MultiObjectiveSymbolicExpressionTreeProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
137    public MultiObjectiveSymbolicExpressionTreeProgrammableProblem()
138      : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "SymbolicExpressionTreeEncoding", "SymbolicExpressionTree")) { }
139
140    public override IDeepCloneable Clone(Cloner cloner) {
141      return new MultiObjectiveSymbolicExpressionTreeProgrammableProblem(this, cloner);
142    }
143  }
144
145  [Item("Linear Linkage Programmable Problem (multi-objective)", "Represents a linear linkage multi-objective problem that can be programmed with a script.")]
146  [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)]
147  [StorableClass]
148  public sealed class MultiObjectiveLinearLinkageProgrammableProblem : MultiObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> {
149
150    [StorableConstructor]
151    private MultiObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { }
152    private MultiObjectiveLinearLinkageProgrammableProblem(MultiObjectiveLinearLinkageProgrammableProblem original, Cloner cloner) : base(original, cloner) { }
153    public MultiObjectiveLinearLinkageProgrammableProblem()
154      : base(string.Format(ScriptTemplates.CompiledMultiObjectiveProblemDefinition, "HeuristicLab.Encodings.LinearLinkageEncoding", "LinearLinkageEncoding", "LinearLinkage")) { }
155
156    public override IDeepCloneable Clone(Cloner cloner) {
157      return new MultiObjectiveLinearLinkageProgrammableProblem(this, cloner);
158    }
159  }*/
160}
Note: See TracBrowser for help on using the repository browser.