Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3881 for trunk


Ignore:
Timestamp:
05/31/10 21:06:45 (15 years ago)
Author:
abeham
Message:

#866

  • Added license headers to designer files
  • Refactored message building, to be user customizable and better extendable
    • A SolutionMessageBuilder holds several Converters
    • A Converter specifies several types to convert and a conversion method
  • ExternalEvaluator has the message builder as parameter and exposes it to the UI through the parameters collection
  • The proto file has been updated to include a length field in the array variables
  • Converters exist for all types in HeuristicLab.Data
Location:
trunk/sources
Files:
12 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/EvaluationProcessChannelView.Designer.cs

    r3872 r3881  
    1 namespace HeuristicLab.Problems.ExternalEvaluation.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.ExternalEvaluation.Views {
    223  partial class EvaluationProcessChannelView {
    324    /// <summary>
  • TabularUnified trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/EvaluationServiceClientView.Designer.cs

    r3872 r3881  
    1 namespace HeuristicLab.Problems.ExternalEvaluation.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.ExternalEvaluation.Views {
    223  partial class EvaluationServiceClientView {
    324    /// <summary>
  • TabularUnified trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/HeuristicLab.Problems.ExternalEvaluation.Views-3.3.csproj

    r3872 r3881  
    9797    <Compile Include="HeuristicLabProblemsExternalEvaluationViewsPlugin.cs" />
    9898    <Compile Include="Properties\AssemblyInfo.cs" />
     99    <Compile Include="SolutionMessageBuilderView.cs">
     100      <SubType>UserControl</SubType>
     101    </Compile>
     102    <Compile Include="SolutionMessageBuilderView.Designer.cs">
     103      <DependentUpon>SolutionMessageBuilderView.cs</DependentUpon>
     104    </Compile>
    99105  </ItemGroup>
    100106  <ItemGroup>
     107    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     108      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     109      <Name>HeuristicLab.Collections-3.3</Name>
     110    </ProjectReference>
    101111    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    102112      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
     
    138148      <DependentUpon>EvaluationServiceClientView.cs</DependentUpon>
    139149    </EmbeddedResource>
     150    <EmbeddedResource Include="SolutionMessageBuilderView.resx">
     151      <DependentUpon>SolutionMessageBuilderView.cs</DependentUpon>
     152    </EmbeddedResource>
    140153  </ItemGroup>
    141154  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • TabularUnified trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/HeuristicLabProblemsExternalEvaluationViewsPlugin.cs

    r3865 r3881  
    2929  [Plugin("HeuristicLab.Problems.ExternalEvaluation.Views", "3.3.0.0")]
    3030  [PluginFile("HeuristicLab.Problems.ExternalEvaluation.Views-3.3.dll", PluginFileType.Assembly)]
    31   //[PluginDependency("HeuristicLab.Collections", "3.3")]
     31  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3232  [PluginDependency("HeuristicLab.Common", "3.3")]
    3333  //[PluginDependency("HeuristicLab.Common.Resources", "3.3")]
  • TabularUnified trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs

    r3872 r3881  
    3838    }
    3939
     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
    4048    public ExternalEvaluator()
    4149      : base() {
    4250      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the current solution."));
    4351      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()));
    4453    }
    4554
    4655    public override IOperation Apply() {
    4756      IEvaluationServiceClient client = ClientParameter.ActualValue;
    48       SolutionMessage.Builder messageBuilder = SolutionMessage.CreateBuilder();
    49       messageBuilder.SolutionId = 0;
     57      SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder();
     58      protobufBuilder.SolutionId = 0;
    5059      foreach (IParameter param in CollectedValues) {
    5160        IItem value = param.ActualValue;
     
    5463          string name = lookupParam != null ? lookupParam.TranslatedName : param.Name;
    5564          try {
    56             value.AddToSolutionMessage(name, messageBuilder);
     65            MessageBuilder.AddToMessage(value, name, protobufBuilder);
    5766          } catch (ArgumentException ex) {
    5867            throw new InvalidOperationException("ERROR in " + Name + ": Parameter " + name + " cannot be added to the message.", ex);
     
    6069        }
    6170      }
    62       QualityMessage answer = client.Evaluate(messageBuilder.Build());
     71      QualityMessage answer = client.Evaluate(protobufBuilder.Build());
    6372      if (QualityParameter.ActualValue == null)
    6473        QualityParameter.ActualValue = new DoubleValue(answer.Quality);
  • TabularUnified trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj

    r3872 r3881  
    8383  <ItemGroup>
    8484    <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" />
    8591    <Compile Include="Drivers\EvaluationServiceClient.cs" />
    8692    <Compile Include="Drivers\EvaluationChannel.cs" />
     
    9399    <Compile Include="Interfaces\IEvaluationChannel.cs" />
    94100    <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" />
     101    <Compile Include="Interfaces\IItemToSolutionMessageConverter.cs" />
    95102    <Compile Include="Properties\AssemblyInfo.cs" />
    96103    <None Include="Properties\AssemblyInfo.frame" />
    97104    <Compile Include="Protos\ExternalEvaluationMessages.cs" />
    98     <Compile Include="SolutionMessageBuilding.cs" />
     105    <Compile Include="SolutionMessageBuilder.cs" />
    99106    <None Include="Protos\ProcessProtos.cmd" />
    100107  </ItemGroup>
  • TabularUnified trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto

    r3872 r3881  
    1414    required string name = 1;
    1515    repeated int32 data = 2;
     16    optional int32 length = 3;
    1617  }
    1718  repeated IntegerArrayVariable integerArrayVars = 3;
     
    2627    required string name = 1;
    2728    repeated double data = 2;
     29    optional int32 length = 3;
    2830  }
    2931  repeated DoubleArrayVariable doubleArrayVars = 5;
     
    3840    required string name = 1;
    3941    repeated bool data = 2;
     42    optional int32 length = 3;
    4043  }
    4144  repeated BoolArrayVariable boolArrayVars = 7;
     
    5053    required string name = 1;
    5154    repeated string data = 2;
     55    optional int32 length = 3;
    5256  }
    5357  repeated StringArrayVariable stringArrayVars = 9;
Note: See TracChangeset for help on using the changeset viewer.