- Timestamp:
- 07/18/12 03:22:03 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs
r7259 r8298 24 24 using System.Linq; 25 25 using System.Threading; 26 using Google.ProtocolBuffers; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; … … 35 36 [StorableClass] 36 37 public class ExternalEvaluator : ValuesCollector, IExternalEvaluationProblemEvaluator { 38 protected HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>(); 39 protected object clientLock = new object(); 37 40 38 41 #region Parameters … … 48 51 #endregion 49 52 50 #region Parameter Values53 #region Parameter Properties 51 54 protected SolutionMessageBuilder MessageBuilder { 52 55 get { return MessageBuilderParameter.Value; } … … 55 58 get { return ClientsParameter.ActualValue; } 56 59 } 57 #endregion58 59 #region Fields60 protected HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>();61 protected object clientLock = new object();62 60 #endregion 63 61 … … 103 101 } 104 102 105 protected QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) {103 protected virtual QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) { 106 104 IEvaluationServiceClient client = null; 107 105 lock (clientLock) { … … 115 113 } 116 114 try { 117 return client.Evaluate(message );115 return client.Evaluate(message, GetQualityMessageExtensions()); 118 116 } finally { 119 117 lock (clientLock) { … … 124 122 } 125 123 126 protected SolutionMessage BuildSolutionMessage() { 124 protected virtual ExtensionRegistry GetQualityMessageExtensions() { 125 return ExtensionRegistry.CreateInstance(); 126 } 127 128 protected virtual SolutionMessage BuildSolutionMessage() { 127 129 lock (clientLock) { 128 130 SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder();
Note: See TracChangeset
for help on using the changeset viewer.