Changeset 13376
- Timestamp:
- 11/24/15 17:44:26 (9 years ago)
- Location:
- branches/ProblemRefactoring
- Files:
-
- 1 deleted
- 9 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Core/3.3/Attributes/CreatableAttribute.cs
r12664 r13376 40 40 public const string GeneticProgrammingProblems = Problems + SplitToken + "2" + OrderToken + "Genetic Programming"; 41 41 public const string ExternalEvaluationProblems = Problems + SplitToken + "3" + OrderToken + "External Evaluation"; 42 public const string ProgrammableProblems = Problems + SplitToken + "4" + OrderToken + "Programmable"; 43 public const string ProgrammableProblemsSingleObjective = ProgrammableProblems + "1" + OrderToken + "Single Objective"; 44 public const string ProgrammableProblemsMultiObjective = ProgrammableProblems + "2" + OrderToken + "Multi Objective"; 42 45 43 46 public const string DataAnalysis = "3" + OrderToken + "Data Analysis"; -
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/CombinedEncoding.cs
r13372 r13376 29 29 30 30 namespace HeuristicLab.Optimization { 31 [Item(" MultiEncoding", "Describes a combined encoding consisting of multiple simpler encodings.")]31 [Item("CombinedEncoding", "Describes a combined encoding consisting of multiple simpler encodings.")] 32 32 [StorableClass] 33 public sealed class MultiEncoding : Encoding<CombinedSolution> {33 public sealed class CombinedEncoding : Encoding<CombinedSolution> { 34 34 35 35 private ItemCollection<IEncoding> encodings; … … 46 46 47 47 [StorableConstructor] 48 private MultiEncoding(bool deserializing) : base(deserializing) { }49 public override IDeepCloneable Clone(Cloner cloner) { return new MultiEncoding(this, cloner); }50 private MultiEncoding(MultiEncoding original, Cloner cloner)48 private CombinedEncoding(bool deserializing) : base(deserializing) { } 49 public override IDeepCloneable Clone(Cloner cloner) { return new CombinedEncoding(this, cloner); } 50 private CombinedEncoding(CombinedEncoding original, Cloner cloner) 51 51 : base(original, cloner) { 52 52 encodings = new ItemCollection<IEncoding>(original.Encodings.Select(cloner.Clone)); 53 53 } 54 public MultiEncoding()55 : base(" MultiEncoding") {54 public CombinedEncoding() 55 : base("CombinedEncoding") { 56 56 encodings = new ItemCollection<IEncoding>(); 57 57 SolutionCreator = new MultiEncodingCreator() { SolutionParameter = { ActualName = Name } }; … … 62 62 } 63 63 64 public MultiEncoding Add(IEncoding encoding) {65 if (encoding is MultiEncoding) throw new InvalidOperationException("Nesting of MultiEncodings is not supported.");64 public CombinedEncoding Add(IEncoding encoding) { 65 if (encoding is CombinedEncoding) throw new InvalidOperationException("Nesting of CombinedEncodings is not supported."); 66 66 if (Encodings.Any(e => e.Name == encoding.Name)) throw new ArgumentException("Encoding name must be unique", "encoding.Name"); 67 67 encodings.Add(encoding); -
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/CombinedSolution.cs
r13372 r13376 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using HeuristicLab.Common; … … 32 31 public sealed class CombinedSolution : Item, ISolution { 33 32 34 private MultiEncoding Encoding { get; set; }35 pr otected IScope Scope { get; privateset; }33 private CombinedEncoding Encoding { get; set; } 34 private IScope Scope { get; set; } 36 35 37 36 [StorableConstructor] 38 37 private CombinedSolution(bool deserializing) : base(deserializing) { } 39 40 38 private CombinedSolution(CombinedSolution original, Cloner cloner) 41 39 : base(original, cloner) { … … 43 41 Scope = cloner.Clone(original.Scope); 44 42 } 45 public CombinedSolution(IScope scope, MultiEncoding encoding) {43 public CombinedSolution(IScope scope, CombinedEncoding encoding) { 46 44 Encoding = encoding; 47 45 Scope = scope; -
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/MultiEncodingCreator.cs
r13359 r13376 65 65 66 66 public override IOperation InstrumentedApply() { 67 SolutionParameter.ActualValue = new CombinedSolution(ExecutionContext.Scope, ( MultiEncoding)EncodingParameter.ActualValue);67 SolutionParameter.ActualValue = new CombinedSolution(ExecutionContext.Scope, (CombinedEncoding)EncodingParameter.ActualValue); 68 68 return base.InstrumentedApply(); 69 69 } -
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/MultiEncodingCrossover.cs
r13359 r13376 38 38 39 39 public override IOperation InstrumentedApply() { 40 SolutionParameter.ActualValue = new CombinedSolution(ExecutionContext.Scope, ( MultiEncoding)EncodingParameter.ActualValue);40 SolutionParameter.ActualValue = new CombinedSolution(ExecutionContext.Scope, (CombinedEncoding)EncodingParameter.ActualValue); 41 41 return base.InstrumentedApply(); 42 42 } -
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs
r13365 r13376 127 127 if (oldEncoding.GetType() != newEncoding.GetType()) return; 128 128 129 if (oldEncoding.GetType() == typeof( MultiEncoding)) {130 var oldMultiEncoding = ( MultiEncoding)oldEncoding;131 var newMultiEncoding = ( MultiEncoding)newEncoding;129 if (oldEncoding.GetType() == typeof(CombinedEncoding)) { 130 var oldMultiEncoding = (CombinedEncoding)oldEncoding; 131 var newMultiEncoding = (CombinedEncoding)newEncoding; 132 132 if (!oldMultiEncoding.Encodings.SequenceEqual(newMultiEncoding.Encodings, new TypeEqualityComparer<IEncoding>())) return; 133 133 -
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r13361 r13376 121 121 <ItemGroup> 122 122 <Compile Include="Algorithms\BasicAlgorithm.cs" /> 123 <Compile Include="BasicProblems\ Individuals\MultiSolution.cs" />123 <Compile Include="BasicProblems\CombinedSolution.cs" /> 124 124 <Compile Include="BasicProblems\Interfaces\IMultiEncodingOperator.cs" /> 125 125 <Compile Include="BasicProblems\Interfaces\IMultiObjectiveProblem.cs" /> 126 126 <Compile Include="BasicProblems\Interfaces\ISingleObjectiveProblem.cs" /> 127 <Compile Include="BasicProblems\ MultiEncoding.cs" />127 <Compile Include="BasicProblems\CombinedEncoding.cs" /> 128 128 <Compile Include="BasicProblems\Operators\MultiEncodingCreator.cs" /> 129 129 <Compile Include="BasicProblems\Operators\MultiEncodingCrossover.cs" /> -
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/HeuristicLab.Problems.Programmable-3.3.csproj
r13373 r13376 160 160 <Private>False</Private> 161 161 </ProjectReference> 162 <ProjectReference Include="..\..\HeuristicLab.Encodings.LinearLinkageEncoding\3.3\HeuristicLab.Encodings.LinearLinkageEncoding-3.3.csproj"> 163 <Project>{be698769-975a-429e-828c-72bb2b6182c8}</Project> 164 <Name>HeuristicLab.Encodings.LinearLinkageEncoding-3.3</Name> 165 <Private>False</Private> 166 </ProjectReference> 162 167 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj"> 163 168 <Project>{dbecb8b0-b166-4133-baf1-ed67c3fd7fca}</Project> … … 168 173 <Project>{bb6d334a-4bb6-4674-9883-31a6ebb32cab}</Project> 169 174 <Name>HeuristicLab.Encodings.RealVectorEncoding-3.3</Name> 175 <Private>False</Private> 176 </ProjectReference> 177 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 178 <Project>{06d4a186-9319-48a0-bade-a2058d462eea}</Project> 179 <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name> 170 180 <Private>False</Private> 171 181 </ProjectReference> -
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProgrammableProblem.cs
r13365 r13376 88 88 Parameters.Remove("Maximization"); 89 89 Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()) { Hidden = true }); 90 var multiEnc = ProblemScript.Encoding as MultiEncoding;90 var multiEnc = ProblemScript.Encoding as CombinedEncoding; 91 91 if (multiEnc != null) multiEnc.Clear(); 92 92 ProblemScript.Initialize(); -
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/ProgrammableProblemInstances.cs
r13373 r13376 26 26 using HeuristicLab.Encodings.BinaryVectorEncoding; 27 27 using HeuristicLab.Encodings.IntegerVectorEncoding; 28 using HeuristicLab.Encodings.LinearLinkageEncoding; 28 29 using HeuristicLab.Encodings.PermutationEncoding; 29 30 using HeuristicLab.Encodings.RealVectorEncoding; 31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 30 32 using HeuristicLab.Optimization; 31 33 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 34 36 #region single-objective 35 37 [Item("Binary Vector Problem (single-objective)", "Represents a binary vector single-objective problem that can be programmed with a script.")] 36 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]38 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 100)] 37 39 [StorableClass] 38 40 public sealed class SingleObjectiveBinaryVectorProgrammableProblem : SingleObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> { … … 57 59 } 58 60 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 61 [Item("Integer Vector Problem (single-objective)", "Represents an integer vector single-objective problem that can be programmed with a script.")] 80 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]62 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 101)] 81 63 [StorableClass] 82 64 public sealed class SingleObjectiveIntegerVectorProgrammableProblem : SingleObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> { … … 101 83 102 84 [Item("Real Vector Problem (single-objective)", "Represents a real vector single-objective problem that can be programmed with a script.")] 103 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]85 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 102)] 104 86 [StorableClass] 105 87 public sealed class SingleObjectiveRealVectorProgrammableProblem : SingleObjectiveProgrammableProblem<RealVectorEncoding, RealVector> { … … 124 106 125 107 [Item("Permutation Problem (single-objective)", "Represents a permutation single-objective problem that can be programmed with a script.")] 126 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]108 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsSingleObjective, Priority = 103)] 127 109 [StorableClass] 128 110 public sealed class SingleObjectivePermutationProgrammableProblem : SingleObjectiveProgrammableProblem<PermutationEncoding, Permutation> { … … 146 128 } 147 129 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 //} 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 [StorableClass] 133 public sealed class SingleObjectiveSymbolicExpressionTreeProgrammableProblem : SingleObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> { 134 135 [StorableConstructor] 136 private SingleObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { } 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 [StorableClass] 155 public sealed class SingleObjectiveLinearLinkageProgrammableProblem : SingleObjectiveProgrammableProblem<LinearLinkageEncoding, LinearLinkage> { 156 157 [StorableConstructor] 158 private SingleObjectiveLinearLinkageProgrammableProblem(bool deserializing) : base(deserializing) { } 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 [StorableClass] 177 public sealed class SingleObjectiveCombinedEncodingProgrammableProblem : SingleObjectiveProgrammableProblem<CombinedEncoding, CombinedSolution> { 178 179 [StorableConstructor] 180 private SingleObjectiveCombinedEncodingProgrammableProblem(bool deserializing) : base(deserializing) { } 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 } 179 193 #endregion 180 194 181 195 #region multi-objective 182 196 [Item("Binary Vector Problem (multi-objective)", "Represents a binary vector multi-objective problem that can be programmed with a script.")] 183 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]197 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 100)] 184 198 [StorableClass] 185 199 public sealed class MultiObjectiveBinaryVectorProgrammableProblem : MultiObjectiveProgrammableProblem<BinaryVectorEncoding, BinaryVector> { … … 204 218 } 205 219 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 220 [Item("Integer Vector Problem (multi-objective)", "Represents an integer vector multi-objective problem that can be programmed with a script.")] 227 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]221 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 101)] 228 222 [StorableClass] 229 223 public sealed class MultiObjectiveIntegerVectorProgrammableProblem : MultiObjectiveProgrammableProblem<IntegerVectorEncoding, IntegerVector> { … … 248 242 249 243 [Item("Real Vector Problem (multi-objective)", "Represents a real vector multi-objective problem that can be programmed with a script.")] 250 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]244 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 102)] 251 245 [StorableClass] 252 246 public sealed class MultiObjectiveRealVectorProgrammableProblem : MultiObjectiveProgrammableProblem<RealVectorEncoding, RealVector> { … … 271 265 272 266 [Item("Permutation Problem (multi-objective)", "Represents a permutation multi-objective problem that can be programmed with a script.")] 273 [Creatable(CreatableAttribute.Categories.Pro blems, Priority = 100)]267 [Creatable(CreatableAttribute.Categories.ProgrammableProblemsMultiObjective, Priority = 103)] 274 268 [StorableClass] 275 269 public sealed class MultiObjectivePermutationProgrammableProblem : MultiObjectiveProgrammableProblem<PermutationEncoding, Permutation> { … … 292 286 } 293 287 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 //} 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 [StorableClass] 291 public sealed class MultiObjectiveSymbolicExpressionTreeProgrammableProblem : MultiObjectiveProgrammableProblem<SymbolicExpressionTreeEncoding, ISymbolicExpressionTree> { 292 293 [StorableConstructor] 294 private MultiObjectiveSymbolicExpressionTreeProgrammableProblem(bool deserializing) : base(deserializing) { } 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 [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() { 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 [StorableClass] 335 public sealed class MultiObjectiveCombinedEncodingProgrammableProblem : MultiObjectiveProgrammableProblem<CombinedEncoding, CombinedSolution> { 336 337 [StorableConstructor] 338 private MultiObjectiveCombinedEncodingProgrammableProblem(bool deserializing) : base(deserializing) { } 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 } 325 351 #endregion 326 352 } -
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblem.cs
r13365 r13376 91 91 Parameters.Remove("Maximization"); 92 92 Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "Set to false if the problem should be minimized.", (BoolValue)new BoolValue(Maximization).AsReadOnly()) { Hidden = true }); 93 var multiEnc = ProblemScript.Encoding as MultiEncoding;93 var multiEnc = ProblemScript.Encoding as CombinedEncoding; 94 94 if (multiEnc != null) multiEnc.Clear(); 95 95 ProblemScript.Initialize();
Note: See TracChangeset
for help on using the changeset viewer.