Changeset 15973 for branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.ExternalEvaluation/3.4/MultiObjectiveExternalEvaluationProblem.cs
- Timestamp:
- 06/28/18 11:13:37 (7 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.ExternalEvaluation/3.4/MultiObjectiveExternalEvaluationProblem.cs
r13257 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 56 56 get { return (IFixedValueParameter<MultiObjectiveOptimizationSupportScript>)Parameters["SupportScript"]; } 57 57 } 58 59 private IFixedValueParameter<BoolArray> MaximizationParameter { 60 get { return (IFixedValueParameter<BoolArray>)Parameters["Maximization"]; } 61 } 58 62 #endregion 59 63 60 64 #region Properties 65 public new IEncoding Encoding { 66 get { return base.Encoding; } 67 set { base.Encoding = value; } 68 } 61 69 public EvaluationCache Cache { 62 70 get { return CacheParameter.Value; } … … 97 105 return Parameters.ContainsKey("Maximization") ? ((IValueParameter<BoolArray>)Parameters["Maximization"]).Value.ToArray() : new bool[0]; 98 106 } 107 } 108 109 public virtual void SetMaximization(bool[] maximization) { 110 ((IStringConvertibleArray)MaximizationParameter.Value).Length = maximization.Length; 111 var array = MaximizationParameter.Value; 112 for (var i = 0; i < maximization.Length; i++) 113 array[i] = maximization[i]; 99 114 } 100 115 … … 140 155 try { 141 156 return client.Evaluate(message, GetQualityMessageExtensions()); 142 } finally { 157 } 158 finally { 143 159 lock (clientLock) { 144 160 activeClients.Remove(client); … … 152 168 SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder(); 153 169 protobufBuilder.SolutionId = solutionId; 154 var scope = new Scope(); 155 individual.CopyToScope(scope); 156 foreach (var variable in scope.Variables) { 170 foreach (var variable in individual.Values) { 157 171 try { 158 MessageBuilder.AddToMessage(variable.Value, variable.Name, protobufBuilder); 159 } catch (ArgumentException ex) { 172 MessageBuilder.AddToMessage(variable.Value, variable.Key, protobufBuilder); 173 } 174 catch (ArgumentException ex) { 160 175 throw new InvalidOperationException(string.Format("ERROR while building solution message: Parameter {0} cannot be added to the message", Name), ex); 161 176 }
Note: See TracChangeset
for help on using the changeset viewer.