Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3872


Ignore:
Timestamp:
05/30/10 22:31:40 (14 years ago)
Author:
abeham
Message:

#866

  • Updated ExternalEvaluationProblem
  • Removed the custom crossover, manipulator, and solution creator (they're replaced with the UserDefined ones)
  • Renamed all drivers to channels
  • Added a client that takes the role of the previous driver
  • Moved the BestScopeSolutionAnalyzer into Analysis (it's a generic operator after all)
Location:
trunk/sources
Files:
13 added
11 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r3832 r3872  
    8787    <Compile Include="BestAverageWorstQualityAnalyzer.cs" />
    8888    <Compile Include="BestAverageWorstQualityCalculator.cs" />
     89    <Compile Include="BestScopeSolutionAnalyzer.cs" />
    8990    <Compile Include="BestQualityMemorizer.cs" />
    9091    <Compile Include="QualityAnalyzer.cs" />
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/HeuristicLab.Problems.ExternalEvaluation.Views-3.3.csproj

    r3865 r3872  
    8383  </ItemGroup>
    8484  <ItemGroup>
    85     <Compile Include="ExternalEvaluationProcessDriverView.cs">
     85    <Compile Include="EvaluationServiceClientView.cs">
    8686      <SubType>UserControl</SubType>
    8787    </Compile>
    88     <Compile Include="ExternalEvaluationProcessDriverView.Designer.cs">
    89       <DependentUpon>ExternalEvaluationProcessDriverView.cs</DependentUpon>
     88    <Compile Include="EvaluationServiceClientView.Designer.cs">
     89      <DependentUpon>EvaluationServiceClientView.cs</DependentUpon>
     90    </Compile>
     91    <Compile Include="EvaluationProcessChannelView.cs">
     92      <SubType>UserControl</SubType>
     93    </Compile>
     94    <Compile Include="EvaluationProcessChannelView.Designer.cs">
     95      <DependentUpon>EvaluationProcessChannelView.cs</DependentUpon>
    9096    </Compile>
    9197    <Compile Include="HeuristicLabProblemsExternalEvaluationViewsPlugin.cs" />
     
    126132  </ItemGroup>
    127133  <ItemGroup>
    128     <EmbeddedResource Include="ExternalEvaluationProcessDriverView.resx">
    129       <DependentUpon>ExternalEvaluationProcessDriverView.cs</DependentUpon>
     134    <EmbeddedResource Include="EvaluationProcessChannelView.resx">
     135      <DependentUpon>EvaluationProcessChannelView.cs</DependentUpon>
     136    </EmbeddedResource>
     137    <EmbeddedResource Include="EvaluationServiceClientView.resx">
     138      <DependentUpon>EvaluationServiceClientView.cs</DependentUpon>
    130139    </EmbeddedResource>
    131140  </ItemGroup>
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs

    r3864 r3872  
    3131using HeuristicLab.Parameters;
    3232using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     33using HeuristicLab.Optimization.Operators;
     34using HeuristicLab.Analysis;
    3335
    3436namespace HeuristicLab.Problems.ExternalEvaluation {
     
    4850
    4951    #region Parameters
    50     private IValueParameter<IExternalEvaluationDriver> DriverParameter {
    51       get { return (IValueParameter<IExternalEvaluationDriver>)Parameters["Driver"]; }
    52     }
    53     private IValueParameter<IExternalEvaluationProblemEvaluator> EvaluatorParameter {
     52    public IValueParameter<IEvaluationServiceClient> ClientParameter {
     53      get { return (IValueParameter<IEvaluationServiceClient>)Parameters["Client"]; }
     54    }
     55    public IValueParameter<IExternalEvaluationProblemEvaluator> EvaluatorParameter {
    5456      get { return (IValueParameter<IExternalEvaluationProblemEvaluator>)Parameters["Evaluator"]; }
    5557    }
     
    112114      get { return OperatorsParameter.Value; }
    113115    }
    114     private BestExternalEvaluationSolutionAnalyzer BestExternalEvaluationSolutionAnalyzer {
    115       get { return OperatorsParameter.Value.OfType<BestExternalEvaluationSolutionAnalyzer>().FirstOrDefault(); }
     116    private BestScopeSolutionAnalyzer BestScopeSolutionAnalyzer {
     117      get { return OperatorsParameter.Value.OfType<BestScopeSolutionAnalyzer>().FirstOrDefault(); }
    116118    }
    117119    #endregion
     
    122124      : base() {
    123125      ExternalEvaluator evaluator = new ExternalEvaluator();
    124       ExternalEvaluationSolutionCreator solutionCreator = new ExternalEvaluationSolutionCreator();
    125 
    126       Parameters.Add(new ValueParameter<IExternalEvaluationDriver>("Driver", "The communication driver that is used to exchange data with the external process."));
     126      UserDefinedSolutionCreator solutionCreator = new UserDefinedSolutionCreator();
     127
     128      Parameters.Add(new ValueParameter<IEvaluationServiceClient>("Client", "The client that is used to communicate with the external application."));
    127129      Parameters.Add(new ValueParameter<IExternalEvaluationProblemEvaluator>("Evaluator", "The evaluator that collects the values to exchange.", evaluator));
    128130      Parameters.Add(new ValueParameter<ISolutionCreator>("SolutionCreator", "An operator to create the solution components.", solutionCreator));
     
    168170    }
    169171    private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
     172      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     173      ParameterizeOperators();
    170174      OnEvaluatorChanged();
    171175    }
    172176    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    173       // TODO: Following code is not yet approved behavior, but it's the best effort I can make here regarding wiring
     177      ParameterizeOperators();
     178    }
     179    private void OperatorsParameter_ValueChanged(object sender, EventArgs e) {
     180      OnOperatorsChanged();
     181    }
     182    private void OperatorsParameter_Value_ItemsAdded(object sender, EventArgs e) {
     183      OnOperatorsChanged();
     184    }
     185    private void OperatorsParameter_Value_ItemsRemoved(object sender, EventArgs e) {
     186      OnOperatorsChanged();
     187    }
     188    private void OperatorsParameter_Value_CollectionReset(object sender, EventArgs e) {
     189      OnOperatorsChanged();
     190    }
     191    #endregion
     192
     193    #region Helpers
     194    private void InitializeOperators() {
     195      ItemList<IOperator> operators = OperatorsParameter.Value;
     196      operators.Add(new BestScopeSolutionAnalyzer());
     197      ParameterizeAnalyzers();
     198    }
     199    [StorableHook(HookType.AfterDeserialization)]
     200    private void AttachEventHandlers() {
     201      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
     202      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
     203      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     204      OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged);
     205      OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsAdded);
     206      OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsRemoved);
     207      OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_CollectionReset);
     208    }
     209    private void ParameterizeAnalyzers() {
     210      BestScopeSolutionAnalyzer.ResultsParameter.ActualName = "Results";
     211      BestScopeSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
     212      BestScopeSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
     213      BestScopeSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
     214      BestScopeSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
     215    }
     216    private void ParameterizeEvaluator() {
     217      Evaluator.ClientParameter.ActualName = ClientParameter.Name;
     218    }
     219    private void ParameterizeOperators() {
     220      // This is a best effort approach to wiring
    174221      string qualityName = Evaluator.QualityParameter.ActualName;
    175222      foreach (IOperator op in OperatorsParameter.Value) {
     
    182229      }
    183230    }
    184     private void OperatorsParameter_ValueChanged(object sender, EventArgs e) {
    185       OnOperatorsChanged();
    186     }
    187     private void OperatorsParameter_Value_ItemsAdded(object sender, EventArgs e) {
    188       OnOperatorsChanged();
    189     }
    190     private void OperatorsParameter_Value_ItemsRemoved(object sender, EventArgs e) {
    191       OnOperatorsChanged();
    192     }
    193     private void OperatorsParameter_Value_CollectionReset(object sender, EventArgs e) {
    194       OnOperatorsChanged();
    195     }
    196     #endregion
    197 
    198     #region Helpers
    199     private void InitializeOperators() {
    200       ItemList<IOperator> operators = OperatorsParameter.Value;
    201       operators.Add(new BestExternalEvaluationSolutionAnalyzer());
    202       ParameterizeAnalyzers();
    203     }
    204     [StorableHook(HookType.AfterDeserialization)]
    205     private void AttachEventHandlers() {
    206       SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    207       EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
    208       Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    209       OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged);
    210       OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsAdded);
    211       OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsRemoved);
    212       OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_CollectionReset);
    213     }
    214     private void ParameterizeAnalyzers() {
    215       BestExternalEvaluationSolutionAnalyzer.ResultsParameter.ActualName = "Results";
    216       BestExternalEvaluationSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    217       BestExternalEvaluationSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
    218       BestExternalEvaluationSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
    219       BestExternalEvaluationSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
    220     }
    221     private void ParameterizeEvaluator() {
    222       Evaluator.DriverParameter.ActualName = DriverParameter.Name;
    223     }
    224231    #endregion
    225232  }
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs

    r3862 r3872  
    3434      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
    3535    }
    36     public IValueLookupParameter<IExternalEvaluationDriver> DriverParameter {
    37       get { return (IValueLookupParameter<IExternalEvaluationDriver>)Parameters["Driver"]; }
     36    public IValueLookupParameter<IEvaluationServiceClient> ClientParameter {
     37      get { return (IValueLookupParameter<IEvaluationServiceClient>)Parameters["Client"]; }
    3838    }
    3939
     
    4141      : base() {
    4242      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the current solution."));
    43       Parameters.Add(new ValueLookupParameter<IExternalEvaluationDriver>("Driver", "The driver to communicate with the external process."));
     43      Parameters.Add(new ValueLookupParameter<IEvaluationServiceClient>("Client", "The client that communicates with the external process."));
    4444    }
    4545
    4646    public override IOperation Apply() {
    47       IExternalEvaluationDriver driver = DriverParameter.ActualValue;
     47      IEvaluationServiceClient client = ClientParameter.ActualValue;
    4848      SolutionMessage.Builder messageBuilder = SolutionMessage.CreateBuilder();
    4949      messageBuilder.SolutionId = 0;
     
    6060        }
    6161      }
    62       QualityMessage answer = driver.Evaluate(messageBuilder.Build());
     62      QualityMessage answer = client.Evaluate(messageBuilder.Build());
    6363      if (QualityParameter.ActualValue == null)
    6464        QualityParameter.ActualValue = new DoubleValue(answer.Quality);
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj

    r3870 r3872  
    8282  </ItemGroup>
    8383  <ItemGroup>
    84     <Compile Include="Analyzers\BestExternalEvaluationSolutionAnalyzer.cs" />
    8584    <None Include="HeuristicLabProblemsExternalEvaluationPlugin.cs.frame" />
    86     <Compile Include="ExternalEvaluationManipulator.cs" />
    87     <Compile Include="Drivers\ExternalEvaluationDriver.cs" />
    88     <Compile Include="Drivers\ExternalEvaluationProcessDriver.cs" />
    89     <Compile Include="Drivers\ExternalEvaluationStreamDriver.cs" />
    90     <Compile Include="ExternalEvaluationCrossover.cs" />
     85    <Compile Include="Drivers\EvaluationServiceClient.cs" />
     86    <Compile Include="Drivers\EvaluationChannel.cs" />
     87    <Compile Include="Drivers\EvaluationProcessChannel.cs" />
     88    <Compile Include="Drivers\EvaluationStreamChannel.cs" />
    9189    <Compile Include="ExternalEvaluationProblem.cs" />
    92     <Compile Include="ExternalEvaluationSolutionCreator.cs" />
    9390    <Compile Include="ExternalEvaluator.cs" />
    9491    <Compile Include="HeuristicLabProblemsExternalEvaluationPlugin.cs" />
    95     <Compile Include="Interfaces\IExternalEvaluationDriver.cs" />
     92    <Compile Include="Interfaces\IEvaluationServiceClient.cs" />
     93    <Compile Include="Interfaces\IEvaluationChannel.cs" />
    9694    <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" />
    9795    <Compile Include="Properties\AssemblyInfo.cs" />
     
    102100  </ItemGroup>
    103101  <ItemGroup>
     102    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     103      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     104      <Name>HeuristicLab.Analysis-3.3</Name>
     105    </ProjectReference>
    104106    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    105107      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     
    133135      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    134136      <Name>HeuristicLab.Operators-3.3</Name>
     137    </ProjectReference>
     138    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">
     139      <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project>
     140      <Name>HeuristicLab.Optimization.Operators-3.3</Name>
    135141    </ProjectReference>
    136142    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLabProblemsExternalEvaluationPlugin.cs.frame

    r3862 r3872  
    2525  [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3.3.0.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Problems.ExternalEvaluation-3.3.dll", PluginFileType.Assembly)]
     27  [PluginDependency("HeuristicLab.Analysis", "3.3")]
    2728  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2829  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3233  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3334  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     35  [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
    3436  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3537  [PluginDependency("HeuristicLab.Persistence", "3.3")]
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Interfaces/IExternalEvaluationProblemEvaluator.cs

    r3862 r3872  
    2525namespace HeuristicLab.Problems.ExternalEvaluation {
    2626  public interface IExternalEvaluationProblemEvaluator : ISingleObjectiveEvaluator {
    27     IValueLookupParameter<IExternalEvaluationDriver> DriverParameter { get; }
     27    IValueLookupParameter<IEvaluationServiceClient> ClientParameter { get; }
    2828  }
    2929}
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto

    r3859 r3872  
    6565}
    6666 
    67 service ExchangeService {
    68   rpc EvaluateSingleObjectively (SolutionMessage) returns (QualityMessage);
     67service EvaluationService {
     68  rpc Evaluate (SolutionMessage) returns (QualityMessage);
    6969}
Note: See TracChangeset for help on using the changeset viewer.