Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/12 03:22:03 (12 years ago)
Author:
abeham
Message:

#1896:

  • Added tags 1000 to max which can be used as extensions to the quality message
  • Updated the evaluator to allow better subclassing in case extensions are used
  • Updated the method signatures to pipe the extension registry down to the channel
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs

    r7259 r8298  
    2424using System.Linq;
    2525using System.Threading;
     26using Google.ProtocolBuffers;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
     
    3536  [StorableClass]
    3637  public class ExternalEvaluator : ValuesCollector, IExternalEvaluationProblemEvaluator {
     38    protected HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>();
     39    protected object clientLock = new object();
    3740
    3841    #region Parameters
     
    4851    #endregion
    4952
    50     #region Parameter Values
     53    #region Parameter Properties
    5154    protected SolutionMessageBuilder MessageBuilder {
    5255      get { return MessageBuilderParameter.Value; }
     
    5558      get { return ClientsParameter.ActualValue; }
    5659    }
    57     #endregion
    58 
    59     #region Fields
    60     protected HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>();
    61     protected object clientLock = new object();
    6260    #endregion
    6361
     
    103101    }
    104102
    105     protected QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) {
     103    protected virtual QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) {
    106104      IEvaluationServiceClient client = null;
    107105      lock (clientLock) {
     
    115113      }
    116114      try {
    117         return client.Evaluate(message);
     115        return client.Evaluate(message, GetQualityMessageExtensions());
    118116      } finally {
    119117        lock (clientLock) {
     
    124122    }
    125123
    126     protected SolutionMessage BuildSolutionMessage() {
     124    protected virtual ExtensionRegistry GetQualityMessageExtensions() {
     125      return ExtensionRegistry.CreateInstance();
     126    }
     127
     128    protected virtual SolutionMessage BuildSolutionMessage() {
    127129      lock (clientLock) {
    128130        SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder();
Note: See TracChangeset for help on using the changeset viewer.