Changeset 3881 for trunk/sources/HeuristicLab.Problems.ExternalEvaluation
- Timestamp:
- 05/31/10 21:06:45 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3
- Files:
-
- 9 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs
r3872 r3881 38 38 } 39 39 40 public IValueParameter<SolutionMessageBuilder> MessageBuilderParameter { 41 get { return (IValueParameter<SolutionMessageBuilder>)Parameters["MessageBuilder"]; } 42 } 43 44 private SolutionMessageBuilder MessageBuilder { 45 get { return MessageBuilderParameter.Value; } 46 } 47 40 48 public ExternalEvaluator() 41 49 : base() { 42 50 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the current solution.")); 43 51 Parameters.Add(new ValueLookupParameter<IEvaluationServiceClient>("Client", "The client that communicates with the external process.")); 52 Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder())); 44 53 } 45 54 46 55 public override IOperation Apply() { 47 56 IEvaluationServiceClient client = ClientParameter.ActualValue; 48 SolutionMessage.Builder messageBuilder = SolutionMessage.CreateBuilder();49 messageBuilder.SolutionId = 0;57 SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder(); 58 protobufBuilder.SolutionId = 0; 50 59 foreach (IParameter param in CollectedValues) { 51 60 IItem value = param.ActualValue; … … 54 63 string name = lookupParam != null ? lookupParam.TranslatedName : param.Name; 55 64 try { 56 value.AddToSolutionMessage(name, messageBuilder);65 MessageBuilder.AddToMessage(value, name, protobufBuilder); 57 66 } catch (ArgumentException ex) { 58 67 throw new InvalidOperationException("ERROR in " + Name + ": Parameter " + name + " cannot be added to the message.", ex); … … 60 69 } 61 70 } 62 QualityMessage answer = client.Evaluate( messageBuilder.Build());71 QualityMessage answer = client.Evaluate(protobufBuilder.Build()); 63 72 if (QualityParameter.ActualValue == null) 64 73 QualityParameter.ActualValue = new DoubleValue(answer.Quality); -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj
r3872 r3881 83 83 <ItemGroup> 84 84 <None Include="HeuristicLabProblemsExternalEvaluationPlugin.cs.frame" /> 85 <Compile Include="Converters\BoolConverter.cs" /> 86 <Compile Include="Converters\TimeSpanValueConverter.cs" /> 87 <Compile Include="Converters\DateTimeValueConverter.cs" /> 88 <Compile Include="Converters\DoubleConverter.cs" /> 89 <Compile Include="Converters\IntegerConverter.cs" /> 90 <Compile Include="Converters\StringConverter.cs" /> 85 91 <Compile Include="Drivers\EvaluationServiceClient.cs" /> 86 92 <Compile Include="Drivers\EvaluationChannel.cs" /> … … 93 99 <Compile Include="Interfaces\IEvaluationChannel.cs" /> 94 100 <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" /> 101 <Compile Include="Interfaces\IItemToSolutionMessageConverter.cs" /> 95 102 <Compile Include="Properties\AssemblyInfo.cs" /> 96 103 <None Include="Properties\AssemblyInfo.frame" /> 97 104 <Compile Include="Protos\ExternalEvaluationMessages.cs" /> 98 <Compile Include="SolutionMessageBuild ing.cs" />105 <Compile Include="SolutionMessageBuilder.cs" /> 99 106 <None Include="Protos\ProcessProtos.cmd" /> 100 107 </ItemGroup> -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto
r3872 r3881 14 14 required string name = 1; 15 15 repeated int32 data = 2; 16 optional int32 length = 3; 16 17 } 17 18 repeated IntegerArrayVariable integerArrayVars = 3; … … 26 27 required string name = 1; 27 28 repeated double data = 2; 29 optional int32 length = 3; 28 30 } 29 31 repeated DoubleArrayVariable doubleArrayVars = 5; … … 38 40 required string name = 1; 39 41 repeated bool data = 2; 42 optional int32 length = 3; 40 43 } 41 44 repeated BoolArrayVariable boolArrayVars = 7; … … 50 53 required string name = 1; 51 54 repeated string data = 2; 55 optional int32 length = 3; 52 56 } 53 57 repeated StringArrayVariable stringArrayVars = 9;
Note: See TracChangeset
for help on using the changeset viewer.