- Timestamp:
- 11/18/15 17:23:48 (9 years ago)
- Location:
- stable
- Files:
-
- 1 deleted
- 10 edited
- 7 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13180,13183,13203,13212,13257
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/EvaluationCache.cs
r12009 r13259 30 30 using System.Text.RegularExpressions; 31 31 using System.Threading; 32 using Google.ProtocolBuffers; 32 33 using HeuristicLab.Common; 33 34 using HeuristicLab.Common.Resources; … … 47 48 48 49 public readonly string Key; 49 public double Value; 50 51 public CacheEntry(string key, double value) { 52 Key = key; 53 Value = value; 50 51 private QualityMessage message; 52 private byte[] rawMessage; 53 54 private object lockObject = new object(); 55 56 public byte[] RawMessage { 57 get { return rawMessage; } 58 set { 59 lock (lockObject) { 60 rawMessage = value; 61 message = null; 62 } 63 } 54 64 } 55 65 56 66 public CacheEntry(string key) { 57 67 Key = key; 68 } 69 70 public QualityMessage GetMessage(ExtensionRegistry extensions) { 71 lock (lockObject) { 72 if (message == null && rawMessage != null) 73 message = QualityMessage.ParseFrom(ByteString.CopyFrom(rawMessage), extensions); 74 } 75 return message; 76 } 77 public void SetMessage(QualityMessage value) { 78 lock (lockObject) { 79 message = value; 80 rawMessage = value.ToByteArray(); 81 } 58 82 } 59 83 … … 69 93 } 70 94 95 public string QualityString(IFormatProvider formatProvider = null) { 96 if (formatProvider == null) formatProvider = CultureInfo.CurrentCulture; 97 if (RawMessage == null) return "-"; 98 var msg = message ?? CreateBasicQualityMessage(); 99 switch (msg.Type) { 100 case QualityMessage.Types.Type.SingleObjectiveQualityMessage: 101 return msg.GetExtension(SingleObjectiveQualityMessage.QualityMessage_).Quality.ToString(formatProvider); 102 case QualityMessage.Types.Type.MultiObjectiveQualityMessage: 103 var qualities = msg.GetExtension(MultiObjectiveQualityMessage.QualityMessage_).QualitiesList; 104 return string.Format("[{0}]", string.Join(",", qualities.Select(q => q.ToString(formatProvider)))); 105 default: 106 return "-"; 107 } 108 } 109 private QualityMessage CreateBasicQualityMessage() { 110 var extensions = ExtensionRegistry.CreateInstance(); 111 ExternalEvaluationMessages.RegisterAllExtensions(extensions); 112 return QualityMessage.ParseFrom(ByteString.CopyFrom(rawMessage), extensions); 113 } 114 71 115 public override string ToString() { 72 return string.Format("{{{0} : {1}}}", Key, Value);73 } 74 } 75 76 public delegate double Evaluator(SolutionMessage message);116 return string.Format("{{{0} : {1}}}", Key, QualityString()); 117 } 118 } 119 120 public delegate QualityMessage Evaluator(SolutionMessage message); 77 121 #endregion 78 122 … … 126 170 127 171 #region Persistence 172 #region BackwardsCompatibility3.4 128 173 [Storable(Name = "Cache")] 129 private IEnumerable<KeyValuePair<string, double>> Cache_Persistence { 130 get { 131 if (IsPersistent) { 132 return GetCacheValues(); 133 } else { 134 return Enumerable.Empty<KeyValuePair<string, double>>(); 135 } 136 } 174 private IEnumerable<KeyValuePair<string, double>> Cache_Persistence_backwardscompatability { 175 get { return Enumerable.Empty<KeyValuePair<string, double>>(); } 137 176 set { 138 SetCacheValues(value); 139 } 177 var rawMessages = value.ToDictionary(kvp => kvp.Key, 178 kvp => QualityMessage.CreateBuilder() 179 .SetSolutionId(0) 180 .SetExtension( 181 SingleObjectiveQualityMessage.QualityMessage_, 182 SingleObjectiveQualityMessage.CreateBuilder().SetQuality(kvp.Value).Build()) 183 .Build().ToByteArray()); 184 SetCacheValues(rawMessages); 185 } 186 } 187 #endregion 188 [Storable(Name = "CacheNew")] 189 private IEnumerable<KeyValuePair<string, byte[]>> Cache_Persistence { 190 get { return IsPersistent ? GetCacheValues() : Enumerable.Empty<KeyValuePair<string, byte[]>>(); } 191 set { SetCacheValues(value); } 140 192 } 141 193 [StorableHook(HookType.AfterDeserialization)] … … 149 201 protected EvaluationCache(bool deserializing) : base(deserializing) { } 150 202 protected EvaluationCache(EvaluationCache original, Cloner cloner) 151 : base(original, cloner) {203 : base(original, cloner) { 152 204 SetCacheValues(original.GetCacheValues()); 153 205 Hits = original.Hits; … … 190 242 } 191 243 192 public double GetValue(SolutionMessage message, Evaluator evaluate) {244 public QualityMessage GetValue(SolutionMessage message, Evaluator evaluate, ExtensionRegistry extensions) { 193 245 var entry = new CacheEntry(message.ToString()); 194 246 bool lockTaken = false; … … 205 257 Monitor.Exit(cacheLock); 206 258 OnChanged(); 207 return node.Value. Value;259 return node.Value.GetMessage(extensions); 208 260 } else { 209 261 if (!waited && activeEvaluations.Contains(entry.Key)) { … … 217 269 OnChanged(); 218 270 try { 219 entry. Value = evaluate(message);271 entry.SetMessage(evaluate(message)); 220 272 Monitor.Enter(cacheLock, ref lockTaken); 221 273 index[entry] = list.AddLast(entry); 222 274 Trim(); 223 } 224 finally { 275 } finally { 225 276 if (!lockTaken) 226 277 Monitor.Enter(cacheLock, ref lockTaken); … … 231 282 } 232 283 OnChanged(); 233 return entry. Value;284 return entry.GetMessage(extensions); 234 285 } 235 286 } 236 287 } 237 } 238 finally { 288 } finally { 239 289 if (lockTaken) 240 290 Monitor.Exit(cacheLock); … … 250 300 } 251 301 252 private IEnumerable<KeyValuePair<string, double>> GetCacheValues() {302 private IEnumerable<KeyValuePair<string, byte[]>> GetCacheValues() { 253 303 lock (cacheLock) { 254 return index.ToDictionary(kvp => kvp.Key.Key, kvp => kvp.Key. Value);255 } 256 } 257 258 private void SetCacheValues(IEnumerable<KeyValuePair<string, double>> value) {304 return index.ToDictionary(kvp => kvp.Key.Key, kvp => kvp.Key.RawMessage); 305 } 306 } 307 308 private void SetCacheValues(IEnumerable<KeyValuePair<string, byte[]>> value) { 259 309 lock (cacheLock) { 260 list = new LinkedList<CacheEntry>();261 i ndex = new Dictionary<CacheEntry, LinkedListNode<CacheEntry>>();310 if (list == null) list = new LinkedList<CacheEntry>(); 311 if (index == null) index = new Dictionary<CacheEntry, LinkedListNode<CacheEntry>>(); 262 312 foreach (var kvp in value) { 263 var entry = new CacheEntry(kvp.Key) { Value = kvp.Value };313 var entry = new CacheEntry(kvp.Key) { RawMessage = kvp.Value }; 264 314 index[entry] = list.AddLast(entry); 265 315 } … … 274 324 "\"{0}\", {1}", 275 325 Regex.Replace(entry.Key, "\\s", "").Replace("\"", "\"\""), 276 entry. Value));326 entry.QualityString(CultureInfo.InvariantCulture))); 277 327 } 278 328 } -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/ExternalEvaluationProblem.cs
r13197 r13259 35 35 36 36 namespace HeuristicLab.Problems.ExternalEvaluation { 37 [Item("External Evaluation Problem ", "A problem that is evaluated in a different process.")]37 [Item("External Evaluation Problem (single-objective)", "A problem that is evaluated in a different process.")] 38 38 [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 100)] 39 39 [StorableClass] 40 public class ExternalEvaluationProblem : SingleObjectiveBasicProblem<IEncoding> { 40 // BackwardsCompatibility3.3 41 // Rename class to SingleObjectiveExternalEvaluationProblem 42 public class ExternalEvaluationProblem : SingleObjectiveBasicProblem<IEncoding>, IExternalEvaluationProblem { 41 43 42 44 public static new Image StaticItemImage { … … 89 91 Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions.")); 90 92 Parameters.Add(new ValueParameter<CheckedItemCollection<IEvaluationServiceClient>>("Clients", "The clients that are used to communicate with the external application.", new CheckedItemCollection<IEvaluationServiceClient>() { new EvaluationServiceClient() })); 91 Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder()) );93 Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder()) { Hidden = true }); 92 94 Parameters.Add(new FixedValueParameter<SingleObjectiveOptimizationSupportScript>("SupportScript", "A script that can provide neighborhood and analyze the results of the optimization.", new SingleObjectiveOptimizationSupportScript())); 93 95 … … 101 103 102 104 public override double Evaluate(Individual individual, IRandom random) { 103 return Cache == null ? EvaluateOnNextAvailableClient(BuildSolutionMessage(individual)).Quality 104 : Cache.GetValue(BuildSolutionMessage(individual), m => EvaluateOnNextAvailableClient(m).Quality); 105 var qualityMessage = Evaluate(BuildSolutionMessage(individual)); 106 if (!qualityMessage.HasExtension(SingleObjectiveQualityMessage.QualityMessage_)) 107 throw new InvalidOperationException("The received message is not a SingleObjectiveQualityMessage."); 108 return qualityMessage.GetExtension(SingleObjectiveQualityMessage.QualityMessage_).Quality; 109 } 110 public virtual QualityMessage Evaluate(SolutionMessage solutionMessage) { 111 return Cache == null 112 ? EvaluateOnNextAvailableClient(solutionMessage) 113 : Cache.GetValue(solutionMessage, EvaluateOnNextAvailableClient, GetQualityMessageExtensions()); 105 114 } 106 115 … … 114 123 #endregion 115 124 116 #region Evaluation Helpers 125 public virtual ExtensionRegistry GetQualityMessageExtensions() { 126 var extensions = ExtensionRegistry.CreateInstance(); 127 extensions.Add(SingleObjectiveQualityMessage.QualityMessage_); 128 return extensions; 129 } 130 131 #region Evaluation 117 132 private HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>(); 118 133 private object clientLock = new object(); 134 119 135 private QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) { 120 136 IEvaluationServiceClient client = null; … … 130 146 try { 131 147 return client.Evaluate(message, GetQualityMessageExtensions()); 132 } 133 finally { 148 } finally { 134 149 lock (clientLock) { 135 150 activeClients.Remove(client); … … 139 154 } 140 155 141 protected virtual ExtensionRegistry GetQualityMessageExtensions() { 142 return ExtensionRegistry.CreateInstance(); 143 } 144 145 private SolutionMessage BuildSolutionMessage(Individual individual) { 156 private SolutionMessage BuildSolutionMessage(Individual individual, int solutionId = 0) { 146 157 lock (clientLock) { 147 158 SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder(); 148 protobufBuilder.SolutionId = 0;159 protobufBuilder.SolutionId = solutionId; 149 160 var scope = new Scope(); 150 161 individual.CopyToScope(scope); … … 152 163 try { 153 164 MessageBuilder.AddToMessage(variable.Value, variable.Name, protobufBuilder); 154 } 155 catch (ArgumentException ex) { 156 throw new InvalidOperationException(string.Format("ERROR while building solution message: Parameter {0} cannot be added to the message", name), ex); 165 } catch (ArgumentException ex) { 166 throw new InvalidOperationException(string.Format("ERROR while building solution message: Parameter {0} cannot be added to the message", Name), ex); 157 167 } 158 168 } -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/HeuristicLab.Problems.ExternalEvaluation-3.4.csproj
r11961 r13259 134 134 <Compile Include="Drivers\EvaluationStreamChannel.cs" /> 135 135 <Compile Include="Drivers\EvaluationTCPChannel.cs" /> 136 <Compile Include="Interfaces\IExternalEvaluationProblem.cs" /> 137 <Compile Include="Interfaces\IMultiObjectiveOptimizationSupport.cs" /> 138 <Compile Include="MultiObjectiveExternalEvaluationProblem.cs" /> 136 139 <Compile Include="ExternalEvaluationProblem.cs" /> 137 140 <Compile Include="Interfaces\IEvaluationServiceClient.cs" /> … … 141 144 <Compile Include="Plugin.cs" /> 142 145 <Compile Include="Programmable\CompiledOptimizationSupport.cs" /> 146 <Compile Include="Programmable\CompiledMultiObjectiveOptimizationSupport.cs" /> 143 147 <Compile Include="Programmable\CompiledSingleObjectiveOptimizationSupport.cs" /> 148 <Compile Include="Programmable\MultiObjectiveOptimizationSupportScript.cs" /> 149 <Compile Include="Programmable\OptimizationSupportScript.cs" /> 144 150 <Compile Include="Programmable\SingleObjectiveOptimizationSupportScript.cs" /> 145 <Compile Include="Programmable\ SingleObjectiveOptimizationSupportScriptException.cs" />151 <Compile Include="Programmable\OptimizationSupportScriptException.cs" /> 146 152 <Compile Include="Programmable\Templates.Designer.cs"> 147 153 <AutoGen>True</AutoGen> -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/MultiObjectiveExternalEvaluationProblem.cs
r13180 r13259 34 34 35 35 namespace HeuristicLab.Problems.ExternalEvaluation { 36 [Item(" Multi Objective External Evaluation Problem", "A multi-objective problem that is evaluated in a different process.")]36 [Item("External Evaluation Problem (multi-objective)", "A multi-objective problem that is evaluated in a different process.")] 37 37 [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 200)] 38 38 [StorableClass] … … 53 53 get { return (IValueParameter<SolutionMessageBuilder>)Parameters["MessageBuilder"]; } 54 54 } 55 //public IFixedValueParameter<MultiObjectiveOptimizationSupportScript> SupportScriptParameter {56 //get { return (IFixedValueParameter<MultiObjectiveOptimizationSupportScript>)Parameters["SupportScript"]; }57 //}55 public IFixedValueParameter<MultiObjectiveOptimizationSupportScript> SupportScriptParameter { 56 get { return (IFixedValueParameter<MultiObjectiveOptimizationSupportScript>)Parameters["SupportScript"]; } 57 } 58 58 #endregion 59 59 … … 68 68 get { return MessageBuilderParameter.Value; } 69 69 } 70 //public MultiObjectiveOptimizationSupportScript OptimizationSupportScript {71 //get { return SupportScriptParameter.Value; }72 //}73 //private IMultiObjectiveOptimizationSupport OptimizationSupport {74 //get { return SupportScriptParameter.Value; }75 //}70 public MultiObjectiveOptimizationSupportScript OptimizationSupportScript { 71 get { return SupportScriptParameter.Value; } 72 } 73 private IMultiObjectiveOptimizationSupport OptimizationSupport { 74 get { return SupportScriptParameter.Value; } 75 } 76 76 #endregion 77 77 … … 89 89 Parameters.Add(new ValueParameter<CheckedItemCollection<IEvaluationServiceClient>>("Clients", "The clients that are used to communicate with the external application.", new CheckedItemCollection<IEvaluationServiceClient>() { new EvaluationServiceClient() })); 90 90 Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder()) { Hidden = true }); 91 //Parameters.Add(new FixedValueParameter<MultiObjectiveOptimizationSupportScript>("SupportScript", "A script that can analyze the results of the optimization.", new MultiObjectiveOptimizationSupportScript())); 92 93 //Operators.Add(new BestScopeSolutionAnalyzer()); pareto front 91 Parameters.Add(new FixedValueParameter<MultiObjectiveOptimizationSupportScript>("SupportScript", "A script that can analyze the results of the optimization.", new MultiObjectiveOptimizationSupportScript())); 94 92 } 95 93 … … 114 112 115 113 public override void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) { 116 //OptimizationSupport.Analyze(individuals, qualities, results, random);114 OptimizationSupport.Analyze(individuals, qualities, results, random); 117 115 } 118 116 -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/CompiledMultiObjectiveOptimizationSupport.cs
r13183 r13259 1 using System; 2 using System.Linq; 3 using System.Collections.Generic; 4 using HeuristicLab.Common; 5 using HeuristicLab.Core; 6 using HeuristicLab.Data; 1 using HeuristicLab.Core; 7 2 using HeuristicLab.Optimization; 8 3 … … 13 8 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 14 9 // Write or update results given the range of vectors and resulting qualities 15 // Uncomment the following lines if you want to retrieve the best individual16 //var bestIndex = Maximization ?17 // qualities.Select((v, i) => Tuple.Create(i, v)).OrderByDescending(x => x.Item2).First().Item118 // : qualities.Select((v, i) => Tuple.Create(i, v)).OrderBy(x => x.Item2).First().Item1;19 //var best = individuals[bestIndex];20 10 } 21 11 -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/CompiledSingleObjectiveOptimizationSupport.cs
r11961 r13259 1 using System; 2 using System.Linq; 3 using System.Collections.Generic; 4 using HeuristicLab.Common; 1 using System.Collections.Generic; 5 2 using HeuristicLab.Core; 6 using HeuristicLab.Data;7 3 using HeuristicLab.Optimization; 8 4 … … 14 10 // Write or update results given the range of vectors and resulting qualities 15 11 // Uncomment the following lines if you want to retrieve the best individual 16 //var bestIndex = Maximization ? 17 // qualities.Select((v, i) => Tuple.Create(i, v)).OrderByDescending(x => x.Item2).First().Item1 18 // : qualities.Select((v, i) => Tuple.Create(i, v)).OrderBy(x => x.Item2).First().Item1; 19 //var best = individuals[bestIndex]; 12 // Maximization: 13 // var bestIndex = qualities.Select((v, i) => Tuple.Create(i, v)).OrderByDescending(x => x.Item2).First().Item1; 14 // Minimization: 15 // var bestIndex = qualities.Select((v, i) => Tuple.Create(i, v)).OrderBy(x => x.Item2).First().Item1; 16 // var best = individuals[bestIndex]; 20 17 } 21 18 … … 38 35 } 39 36 } 40 -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/SingleObjectiveOptimizationSupportScript.cs
r12009 r13259 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 using System.Linq;25 using System.Reflection;26 23 using HeuristicLab.Common; 27 24 using HeuristicLab.Core; … … 29 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 27 using HeuristicLab.Problems.ExternalEvaluation.Programmable; 31 using HeuristicLab.Scripting;32 28 33 29 namespace HeuristicLab.Problems.ExternalEvaluation { 34 30 [Item("ProblemDefinitionScript", "Script that defines the parameter vector and evaluates the solution for a programmable problem.")] 35 31 [StorableClass] 36 public sealed class SingleObjectiveOptimizationSupportScript : Script, ISingleObjectiveOptimizationSupport { 37 38 [Storable] 39 private VariableStore variableStore; 40 public VariableStore VariableStore { 41 get { return variableStore; } 42 } 32 public sealed class SingleObjectiveOptimizationSupportScript : OptimizationSupportScript<ISingleObjectiveOptimizationSupport>, ISingleObjectiveOptimizationSupport { 43 33 44 34 protected override string CodeTemplate { … … 48 38 [StorableConstructor] 49 39 private SingleObjectiveOptimizationSupportScript(bool deserializing) : base(deserializing) { } 50 private SingleObjectiveOptimizationSupportScript(SingleObjectiveOptimizationSupportScript original, Cloner cloner) 51 : base(original, cloner) { 52 variableStore = cloner.Clone(original.variableStore); 53 } 54 public SingleObjectiveOptimizationSupportScript() 55 : base() { 56 variableStore = new VariableStore(); 57 } 40 private SingleObjectiveOptimizationSupportScript(SingleObjectiveOptimizationSupportScript original, Cloner cloner) : base(original, cloner) { } 41 public SingleObjectiveOptimizationSupportScript() : base() { } 58 42 59 43 public override IDeepCloneable Clone(Cloner cloner) { 60 44 return new SingleObjectiveOptimizationSupportScript(this, cloner); 61 }62 63 private readonly object compileLock = new object();64 private volatile ISingleObjectiveOptimizationSupport compiledInstance;65 private ISingleObjectiveOptimizationSupport CompiledInstance {66 get {67 if (compiledInstance == null) {68 lock (compileLock) {69 if (compiledInstance == null) {70 Compile();71 }72 }73 }74 return compiledInstance;75 }76 set { compiledInstance = value; }77 }78 79 public override Assembly Compile() {80 var assembly = base.Compile();81 var types = assembly.GetTypes();82 if (!types.Any(x => typeof(CompiledOptimizationSupport).IsAssignableFrom(x)))83 throw new SingleObjectiveOptimizationSupportException("The compiled code doesn't contain an optimization support." + Environment.NewLine + "The support class must be a subclass of CompiledOptimizationSupport.");84 if (types.Count(x => typeof(CompiledOptimizationSupport).IsAssignableFrom(x)) > 1)85 throw new SingleObjectiveOptimizationSupportException("The compiled code contains multiple support classes." + Environment.NewLine + "Only one subclass of CompiledOptimizationSupport is allowed.");86 87 CompiledOptimizationSupport inst;88 try {89 inst = (CompiledOptimizationSupport)Activator.CreateInstance(types.Single(x => typeof(CompiledOptimizationSupport).IsAssignableFrom(x)));90 inst.vars = new Variables(VariableStore);91 } catch (Exception e) {92 compiledInstance = null;93 throw new SingleObjectiveOptimizationSupportException("Instantiating the optimization support class failed." + Environment.NewLine + "Check your default constructor.", e);94 }95 96 var soInst = inst as ISingleObjectiveOptimizationSupport;97 if (soInst == null)98 throw new SingleObjectiveOptimizationSupportException("The optimization support class does not implement ISingleObjectiveOptimizationSupport." + Environment.NewLine + "Please implement that interface in the subclass of CompiledOptimizationSupport.");99 100 CompiledInstance = soInst;101 102 return assembly;103 }104 105 protected override void OnCodeChanged() {106 base.OnCodeChanged();107 compiledInstance = null;108 45 } 109 46 -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.Designer.cs
r11893 r13259 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319. 342094 // Runtime Version:4.0.30319.42000 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 68 68 ///using HeuristicLab.Core; 69 69 ///using HeuristicLab.Data; 70 ///using HeuristicLab.Encodings.PermutationEncoding;71 70 ///using HeuristicLab.Optimization; 72 ///using HeuristicLab.Problems.Programmable;73 71 /// 74 ///namespace HeuristicLab.Problems.Programmable { 75 /// public class CompiledSingleObjectiveProblemDefinition : CompiledProblemDefinition, ISingleObjectiveProblemDefinition { 76 /// public bool Maximization { get { return false; } } 72 ///namespace HeuristicLab.Problems.ExternalEvaluation { 73 /// public class CompiledMultiObjectiveOptimizationSupport : CompiledOptimizationSupport, IMultiObjectiveOptimizationSupport { 77 74 /// 78 /// [rest of string was truncated]";. 75 /// public void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) { 76 /// // Use vars.yourVaria [rest of string was truncated]";. 77 /// </summary> 78 internal static string CompiledMultiObjectiveOptimizationSupport { 79 get { 80 return ResourceManager.GetString("CompiledMultiObjectiveOptimizationSupport", resourceCulture); 81 } 82 } 83 84 /// <summary> 85 /// Looks up a localized string similar to using System; 86 ///using System.Linq; 87 ///using System.Collections.Generic; 88 ///using HeuristicLab.Common; 89 ///using HeuristicLab.Core; 90 ///using HeuristicLab.Data; 91 ///using HeuristicLab.Optimization; 92 /// 93 ///namespace HeuristicLab.Problems.ExternalEvaluation { 94 /// public class CompiledSingleObjectiveOptimizationSupport : CompiledOptimizationSupport, ISingleObjectiveOptimizationSupport { 95 /// 96 /// public void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) { 97 /// // Use vars.yourVaria [rest of string was truncated]";. 79 98 /// </summary> 80 99 internal static string CompiledSingleObjectiveOptimizationSupport { -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.resx
r11893 r13259 119 119 </resheader> 120 120 <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 121 <data name="CompiledMultiObjectiveOptimizationSupport" type="System.Resources.ResXFileRef, System.Windows.Forms"> 122 <value>compiledmultiobjectiveoptimizationsupport.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> 123 </data> 121 124 <data name="CompiledSingleObjectiveOptimizationSupport" type="System.Resources.ResXFileRef, System.Windows.Forms"> 122 125 <value>CompiledSingleObjectiveOptimizationSupport.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> -
stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Protos/ExternalEvaluationMessages.proto
r8298 r13259 64 64 } 65 65 66 // Nested Extensions http://www.indelible.org/ink/protobuf-polymorphism/ 66 67 message QualityMessage { 67 68 required int32 solutionId = 1; 68 required double quality = 2; 69 69 enum Type { 70 SingleObjectiveQualityMessage = 1; 71 MultiObjectiveQualityMessage = 2; 72 } 73 required Type type = 2; 70 74 extensions 1000 to max; 71 75 } 76 77 message SingleObjectiveQualityMessage { 78 extend QualityMessage { 79 required SingleObjectiveQualityMessage qualityMessage = 1000; // unique QualityMessage extension number 80 } 81 required double quality = 1; 82 } 83 message MultiObjectiveQualityMessage { 84 extend QualityMessage { 85 required MultiObjectiveQualityMessage qualityMessage = 1001; // unique QualityMessage extension number 86 } 87 repeated double qualities = 1; 88 } 89 72 90 73 91 service EvaluationService { 74 rpc Evaluate (SolutionMessage) returns (QualityMessage); 92 rpc EvaluateSingleObjective (SolutionMessage) returns (SingleObjectiveQualityMessage); 93 rpc EvaluateMultiObjectives (SolutionMessage) returns (MultiObjectiveQualityMessage); 75 94 } -
stable/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProblemDefinitionScript.cs
r12009 r13259 28 28 [Item("Multi-objective Problem Definition Script", "Script that defines the parameter vector and evaluates the solution for a programmable problem.")] 29 29 [StorableClass] 30 public class MultiObjectiveProblemDefinitionScript : ProblemDefinitionScript, IMultiObjectiveProblemDefinition, IStorableContent {30 public sealed class MultiObjectiveProblemDefinitionScript : ProblemDefinitionScript, IMultiObjectiveProblemDefinition, IStorableContent { 31 31 public string Filename { get; set; } 32 32 … … 40 40 41 41 [StorableConstructor] 42 pr otectedMultiObjectiveProblemDefinitionScript(bool deserializing) : base(deserializing) { }43 pr otectedMultiObjectiveProblemDefinitionScript(MultiObjectiveProblemDefinitionScript original, Cloner cloner)42 private MultiObjectiveProblemDefinitionScript(bool deserializing) : base(deserializing) { } 43 private MultiObjectiveProblemDefinitionScript(MultiObjectiveProblemDefinitionScript original, Cloner cloner) 44 44 : base(original, cloner) { } 45 45
Note: See TracChangeset
for help on using the changeset viewer.