Changeset 16816
- Timestamp:
- 04/18/19 14:06:00 (6 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4
- Files:
-
- 8 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/HeuristicLab.Problems.ExternalEvaluation-3.4.csproj
r16723 r16816 137 137 <Compile Include="Interfaces\IMultiObjectiveOptimizationSupport.cs" /> 138 138 <Compile Include="MultiObjectiveExternalEvaluationProblem.cs" /> 139 <Compile Include="ExternalEvaluationProblem.cs" /> 139 <Compile Include="ExternalEvaluationProblemInstances.cs" /> 140 <Compile Include="SingleObjectiveExternalEvaluationProblem.cs" /> 140 141 <Compile Include="Interfaces\IEvaluationServiceClient.cs" /> 141 142 <Compile Include="Interfaces\IEvaluationChannel.cs" /> … … 144 145 <Compile Include="Plugin.cs" /> 145 146 <Compile Include="Programmable\CompiledOptimizationSupport.cs" /> 146 <Co mpile Include="Programmable\CompiledMultiObjectiveOptimizationSupport.cs" />147 <Co mpile Include="Programmable\CompiledSingleObjectiveOptimizationSupport.cs" />148 <Compile Include="Programmable\MultiObjective OptimizationSupportScript.cs" />147 <Content Include="Programmable\MultiObjective\CompiledMultiObjectiveOptimizationSupport.cs" /> 148 <Content Include="Programmable\SingleObjective\CompiledSingleObjectiveOptimizationSupport.cs" /> 149 <Compile Include="Programmable\MultiObjective\MultiObjectiveOptimizationSupportScript.cs" /> 149 150 <Compile Include="Programmable\OptimizationSupportScript.cs" /> 150 <Compile Include="Programmable\SingleObjective OptimizationSupportScript.cs" />151 <Compile Include="Programmable\SingleObjective\SingleObjectiveOptimizationSupportScript.cs" /> 151 152 <Compile Include="Programmable\OptimizationSupportScriptException.cs" /> 152 153 <Compile Include="Programmable\Templates.Designer.cs"> … … 187 188 <Generator>ResXFileCodeGenerator</Generator> 188 189 <LastGenOutput>Templates.Designer.cs</LastGenOutput> 190 <SubType>Designer</SubType> 189 191 </EmbeddedResource> 190 192 </ItemGroup> … … 218 220 <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project> 219 221 <Name>HeuristicLab.Data-3.3</Name> 222 <Private>False</Private> 223 </ProjectReference> 224 <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj"> 225 <Project>{66d249c3-a01d-42a8-82a2-919bc8ec3d83}</Project> 226 <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name> 227 <Private>False</Private> 228 </ProjectReference> 229 <ProjectReference Include="..\..\HeuristicLab.Encodings.IntegerVectorEncoding\3.3\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.csproj"> 230 <Project>{ddfb14dd-2a85-493c-a52d-e69729bbaeb0}</Project> 231 <Name>HeuristicLab.Encodings.IntegerVectorEncoding-3.3</Name> 232 <Private>False</Private> 233 </ProjectReference> 234 <ProjectReference Include="..\..\HeuristicLab.Encodings.LinearLinkageEncoding\3.4\HeuristicLab.Encodings.LinearLinkageEncoding-3.4.csproj"> 235 <Project>{be698769-975a-429e-828c-72bb2b6182c8}</Project> 236 <Name>HeuristicLab.Encodings.LinearLinkageEncoding-3.4</Name> 237 <Private>False</Private> 238 </ProjectReference> 239 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj"> 240 <Project>{dbecb8b0-b166-4133-baf1-ed67c3fd7fca}</Project> 241 <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name> 242 <Private>False</Private> 243 </ProjectReference> 244 <ProjectReference Include="..\..\HeuristicLab.Encodings.RealVectorEncoding\3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj"> 245 <Project>{bb6d334a-4bb6-4674-9883-31a6ebb32cab}</Project> 246 <Name>HeuristicLab.Encodings.RealVectorEncoding-3.3</Name> 247 <Private>False</Private> 248 </ProjectReference> 249 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 250 <Project>{06d4a186-9319-48a0-bade-a2058d462eea}</Project> 251 <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name> 220 252 <Private>False</Private> 221 253 </ProjectReference> -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/Interfaces/IMultiObjectiveOptimizationSupport.cs
r16751 r16816 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Optimization; 24 using HEAL.Attic;25 25 26 26 namespace HeuristicLab.Problems.ExternalEvaluation { 27 27 [StorableType("f924ef9c-d824-40d2-89b2-6dd1220df98b")] 28 public interface IMultiObjectiveOptimizationSupport {29 void Analyze( IEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random);28 public interface IMultiObjectiveOptimizationSupport<TEncodedSolution> { 29 void Analyze(TEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random); 30 30 } 31 31 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/Interfaces/ISingleObjectiveOptimizationSupport.cs
r16751 r16816 21 21 22 22 using System.Collections.Generic; 23 using HEAL.Attic; 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; 24 26 using HeuristicLab.Optimization; 25 using HEAL.Attic;26 27 27 28 namespace HeuristicLab.Problems.ExternalEvaluation { 28 29 [StorableType("09d522e0-c10f-474c-b7c0-7d7f98e63f44")] 29 public interface ISingleObjectiveOptimizationSupport { 30 void Analyze(IEncodedSolution[] individuals, double[] qualities, ResultCollection results, IRandom random); 31 IEnumerable<IEncodedSolution> GetNeighbors(IEncodedSolution individual, IRandom random); 30 public interface ISingleObjectiveOptimizationSupport<TEncodedSolution> 31 where TEncodedSolution : IDeepCloneable { 32 33 void Analyze(TEncodedSolution[] individuals, double[] qualities, ResultCollection results, IRandom random); 34 IEnumerable<TEncodedSolution> GetNeighbors(TEncodedSolution individual, IRandom random); 32 35 } 33 36 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/MultiObjectiveExternalEvaluationProblem.cs
r16751 r16816 26 26 using System.Threading; 27 27 using Google.ProtocolBuffers; 28 using HEAL.Attic; 28 29 using HeuristicLab.Common; 29 30 using HeuristicLab.Core; … … 31 32 using HeuristicLab.Optimization; 32 33 using HeuristicLab.Parameters; 33 using HEAL.Attic;34 34 35 35 namespace HeuristicLab.Problems.ExternalEvaluation { … … 37 37 [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 200)] 38 38 [StorableType("CCA50199-A6AB-4C84-B4FA-0262CAF416EC")] 39 public class MultiObjectiveExternalEvaluationProblem : MultiObjectiveProblem<IEncoding<IEncodedSolution>, IEncodedSolution>, IExternalEvaluationProblem { 39 public class MultiObjectiveExternalEvaluationProblem<TEncoding, TEncodedSolution> : MultiObjectiveProblem<TEncoding, TEncodedSolution>, IExternalEvaluationProblem 40 where TEncoding : class, IEncoding<TEncodedSolution> 41 where TEncodedSolution : class, IEncodedSolution { 40 42 41 43 public static new Image StaticItemImage { … … 53 55 get { return (IValueParameter<SolutionMessageBuilder>)Parameters["MessageBuilder"]; } 54 56 } 55 public IFixedValueParameter<MultiObjectiveOptimizationSupportScript> SupportScriptParameter { 56 get { return (IFixedValueParameter<MultiObjectiveOptimizationSupportScript>)Parameters["SupportScript"]; } 57 } 58 59 private IFixedValueParameter<BoolArray> MaximizationParameter { 60 get { return (IFixedValueParameter<BoolArray>)Parameters["Maximization"]; } 57 public IFixedValueParameter<MultiObjectiveOptimizationSupportScript<TEncodedSolution>> SupportScriptParameter { 58 get { return (IFixedValueParameter<MultiObjectiveOptimizationSupportScript<TEncodedSolution>>)Parameters["SupportScript"]; } 61 59 } 62 60 #endregion 63 61 64 62 #region Properties 65 public new IEncoding<IEncodedSolution>Encoding {63 public new TEncoding Encoding { 66 64 get { return base.Encoding; } 67 65 set { base.Encoding = value; } … … 76 74 get { return MessageBuilderParameter.Value; } 77 75 } 78 public MultiObjectiveOptimizationSupportScript OptimizationSupportScript {76 public MultiObjectiveOptimizationSupportScript<TEncodedSolution> OptimizationSupportScript { 79 77 get { return SupportScriptParameter.Value; } 80 78 } 81 private IMultiObjectiveOptimizationSupport OptimizationSupport {79 private IMultiObjectiveOptimizationSupport<TEncodedSolution> OptimizationSupport { 82 80 get { return SupportScriptParameter.Value; } 83 81 } … … 86 84 [StorableConstructor] 87 85 protected MultiObjectiveExternalEvaluationProblem(StorableConstructorFlag _) : base(_) { } 88 protected MultiObjectiveExternalEvaluationProblem(MultiObjectiveExternalEvaluationProblem original, Cloner cloner) : base(original, cloner) { }86 protected MultiObjectiveExternalEvaluationProblem(MultiObjectiveExternalEvaluationProblem<TEncoding, TEncodedSolution> original, Cloner cloner) : base(original, cloner) { } 89 87 public override IDeepCloneable Clone(Cloner cloner) { 90 return new MultiObjectiveExternalEvaluationProblem (this, cloner);88 return new MultiObjectiveExternalEvaluationProblem<TEncoding, TEncodedSolution>(this, cloner); 91 89 } 92 public MultiObjectiveExternalEvaluationProblem( )93 : base( ) {90 public MultiObjectiveExternalEvaluationProblem(TEncoding encoding) 91 : base(encoding) { 94 92 Parameters.Remove("Maximization"); // readonly in base class 95 93 Parameters.Add(new FixedValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", new BoolArray())); … … 97 95 Parameters.Add(new ValueParameter<CheckedItemCollection<IEvaluationServiceClient>>("Clients", "The clients that are used to communicate with the external application.", new CheckedItemCollection<IEvaluationServiceClient>() { new EvaluationServiceClient() })); 98 96 Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder()) { Hidden = true }); 99 Parameters.Add(new FixedValueParameter<MultiObjectiveOptimizationSupportScript >("SupportScript", "A script that can analyze the results of the optimization.", new MultiObjectiveOptimizationSupportScript()));97 Parameters.Add(new FixedValueParameter<MultiObjectiveOptimizationSupportScript<TEncodedSolution>>("SupportScript", "A script that can analyze the results of the optimization.", new MultiObjectiveOptimizationSupportScript<TEncodedSolution>())); 100 98 } 101 99 … … 114 112 } 115 113 116 public override double[] Evaluate( IEncodedSolution individual, IRandom random) {114 public override double[] Evaluate(TEncodedSolution individual, IRandom random) { 117 115 var qualityMessage = Evaluate(BuildSolutionMessage(individual)); 118 116 if (!qualityMessage.HasExtension(MultiObjectiveQualityMessage.QualityMessage_)) … … 126 124 } 127 125 128 public override void Analyze( IEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random) {126 public override void Analyze(TEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random) { 129 127 OptimizationSupport.Analyze(individuals, qualities, results, random); 130 128 } … … 164 162 } 165 163 166 private SolutionMessage BuildSolutionMessage( IEncodedSolution solution, int solutionId = 0) {164 private SolutionMessage BuildSolutionMessage(TEncodedSolution solution, int solutionId = 0) { 167 165 lock (clientLock) { 168 166 SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder(); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/Plugin.cs.frame
r16723 r16816 32 32 [PluginDependency("HeuristicLab.Core", "3.3")] 33 33 [PluginDependency("HeuristicLab.Data", "3.3")] 34 [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")] 34 35 [PluginDependency("HeuristicLab.Optimization", "3.3")] 35 36 [PluginDependency("HeuristicLab.Parameters", "3.3")] -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.Designer.cs
r13183 r16816 20 20 // To add or remove a member, edit your .ResX file then rerun ResGen 21 21 // with the /str option, or rebuild your VS project. 22 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", " 4.0.0.0")]22 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 23 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 24 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] … … 62 62 63 63 /// <summary> 64 /// Looks up a localized string similar to using System; 65 ///using System.Linq; 66 ///using System.Collections.Generic; 67 ///using HeuristicLab.Common; 68 ///using HeuristicLab.Core; 69 ///using HeuristicLab.Data; 64 /// Looks up a localized string similar to using HeuristicLab.Core; 70 65 ///using HeuristicLab.Optimization; 66 ///using ENCODING_NAMESPACE; 71 67 /// 72 68 ///namespace HeuristicLab.Problems.ExternalEvaluation { 73 /// public class CompiledMultiObjectiveOptimizationSupport : CompiledOptimizationSupport, IMultiObjectiveOptimizationSupport {69 /// public class CompiledMultiObjectiveOptimizationSupport : CompiledOptimizationSupport, IMultiObjectiveOptimizationSupport<SOLUTION_CLASS> { 74 70 /// 75 /// public void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) { 76 /// // Use vars.yourVaria [rest of string was truncated]";. 71 /// public void Analyze(SOLUTION_CLASS[] solutions, double[][] qualities, ResultCollection results, IRandom random) { 72 /// // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 73 /// // Write [rest of string was truncated]";. 77 74 /// </summary> 78 75 internal static string CompiledMultiObjectiveOptimizationSupport { … … 83 80 84 81 /// <summary> 85 /// Looks up a localized string similar to using System; 86 ///using System.Linq; 87 ///using System.Collections.Generic; 82 /// Looks up a localized string similar to using System.Collections.Generic; 88 83 ///using HeuristicLab.Common; 89 84 ///using HeuristicLab.Core; 90 ///using HeuristicLab.Data;91 85 ///using HeuristicLab.Optimization; 86 ///using ENCODING_NAMESPACE; 92 87 /// 93 88 ///namespace HeuristicLab.Problems.ExternalEvaluation { 94 /// public class CompiledSingleObjectiveOptimizationSupport : CompiledOptimizationSupport, ISingleObjectiveOptimizationSupport {89 /// public class CompiledSingleObjectiveOptimizationSupport : CompiledOptimizationSupport, ISingleObjectiveOptimizationSupport<SOLUTION_CLASS> { 95 90 /// 96 /// public void Analyze( Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) {97 /// // Use vars.yourVaria [rest of string was truncated]";.91 /// public void Analyze(SOLUTION_CLASS[] solutions, double[] qualities, ResultCollection results, IRandom random) { 92 /// // Use vars.yourVariable to access va [rest of string was truncated]";. 98 93 /// </summary> 99 94 internal static string CompiledSingleObjectiveOptimizationSupport { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.resx
r13183 r16816 120 120 <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 121 121 <data name="CompiledMultiObjectiveOptimizationSupport" type="System.Resources.ResXFileRef, System.Windows.Forms"> 122 <value> compiledmultiobjectiveoptimizationsupport.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>122 <value>MultiObjective\CompiledMultiObjectiveOptimizationSupport.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> 123 123 </data> 124 124 <data name="CompiledSingleObjectiveOptimizationSupport" type="System.Resources.ResXFileRef, System.Windows.Forms"> 125 <value> CompiledSingleObjectiveOptimizationSupport.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>125 <value>SingleObjective\CompiledSingleObjectiveOptimizationSupport.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> 126 126 </data> 127 127 </root>
Note: See TracChangeset
for help on using the changeset viewer.