Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/16 14:40:02 (8 years ago)
Author:
gkronber
Message:

#2434: merged trunk changes r12934:14026 from trunk to branch

Location:
branches/crossvalidation-2434
Files:
1 deleted
11 edited
7 copied

Legend:

Unmodified
Added
Removed
  • branches/crossvalidation-2434

  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/EvaluationCache.cs

    r12012 r14029  
    3030using System.Text.RegularExpressions;
    3131using System.Threading;
     32using Google.ProtocolBuffers;
    3233using HeuristicLab.Common;
    3334using HeuristicLab.Common.Resources;
     
    4748
    4849      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        }
    5464      }
    5565
    5666      public CacheEntry(string key) {
    5767        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        }
    5882      }
    5983
     
    6993      }
    7094
     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
    71115      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);
    77121    #endregion
    78122
     
    126170
    127171    #region Persistence
     172    #region BackwardsCompatibility3.4
    128173    [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>>(); }
    137176      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); }
    140192    }
    141193    [StorableHook(HookType.AfterDeserialization)]
     
    149201    protected EvaluationCache(bool deserializing) : base(deserializing) { }
    150202    protected EvaluationCache(EvaluationCache original, Cloner cloner)
    151       : base(original, cloner) {
     203        : base(original, cloner) {
    152204      SetCacheValues(original.GetCacheValues());
    153205      Hits = original.Hits;
     
    190242    }
    191243
    192     public double GetValue(SolutionMessage message, Evaluator evaluate) {
     244    public QualityMessage GetValue(SolutionMessage message, Evaluator evaluate, ExtensionRegistry extensions) {
    193245      var entry = new CacheEntry(message.ToString());
    194246      bool lockTaken = false;
     
    205257            Monitor.Exit(cacheLock);
    206258            OnChanged();
    207             return node.Value.Value;
     259            return node.Value.GetMessage(extensions);
    208260          } else {
    209261            if (!waited && activeEvaluations.Contains(entry.Key)) {
     
    217269              OnChanged();
    218270              try {
    219                 entry.Value = evaluate(message);
     271                entry.SetMessage(evaluate(message));
    220272                Monitor.Enter(cacheLock, ref lockTaken);
    221273                index[entry] = list.AddLast(entry);
    222274                Trim();
    223               }
    224               finally {
     275              } finally {
    225276                if (!lockTaken)
    226277                  Monitor.Enter(cacheLock, ref lockTaken);
     
    231282              }
    232283              OnChanged();
    233               return entry.Value;
     284              return entry.GetMessage(extensions);
    234285            }
    235286          }
    236287        }
    237       }
    238       finally {
     288      } finally {
    239289        if (lockTaken)
    240290          Monitor.Exit(cacheLock);
     
    250300    }
    251301
    252     private IEnumerable<KeyValuePair<string, double>> GetCacheValues() {
     302    private IEnumerable<KeyValuePair<string, byte[]>> GetCacheValues() {
    253303      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) {
    259309      lock (cacheLock) {
    260         list = new LinkedList<CacheEntry>();
    261         index = new Dictionary<CacheEntry, LinkedListNode<CacheEntry>>();
     310        if (list == null) list = new LinkedList<CacheEntry>();
     311        if (index == null) index = new Dictionary<CacheEntry, LinkedListNode<CacheEntry>>();
    262312        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 };
    264314          index[entry] = list.AddLast(entry);
    265315        }
     
    274324              "\"{0}\", {1}",
    275325              Regex.Replace(entry.Key, "\\s", "").Replace("\"", "\"\""),
    276               entry.Value));
     326              entry.QualityString(CultureInfo.InvariantCulture)));
    277327          }
    278328        }
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/ExternalEvaluationProblem.cs

    r12504 r14029  
    3535
    3636namespace 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.")]
    3838  [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 100)]
    3939  [StorableClass]
    40   public sealed class ExternalEvaluationProblem : SingleObjectiveBasicProblem<IEncoding> {
     40  // BackwardsCompatibility3.3
     41  // Rename class to SingleObjectiveExternalEvaluationProblem
     42  public class ExternalEvaluationProblem : SingleObjectiveBasicProblem<IEncoding>, IExternalEvaluationProblem {
    4143
    4244    public static new Image StaticItemImage {
     
    5759      get { return (IFixedValueParameter<SingleObjectiveOptimizationSupportScript>)Parameters["SupportScript"]; }
    5860    }
     61
     62    private IFixedValueParameter<BoolValue> MaximizationParameter {
     63      get { return (IFixedValueParameter<BoolValue>)Parameters["Maximization"]; }
     64    }
    5965    #endregion
    6066
    6167    #region Properties
     68    public new IEncoding Encoding {
     69      get { return base.Encoding; }
     70      set { base.Encoding = value; }
     71    }
    6272    public EvaluationCache Cache {
    6373      get { return CacheParameter.Value; }
     
    7888
    7989    [StorableConstructor]
    80     private ExternalEvaluationProblem(bool deserializing) : base(deserializing) { }
    81     private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner) : base(original, cloner) { }
     90    protected ExternalEvaluationProblem(bool deserializing) : base(deserializing) { }
     91    protected ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner) : base(original, cloner) { }
    8292    public override IDeepCloneable Clone(Cloner cloner) {
    8393      return new ExternalEvaluationProblem(this, cloner);
     
    8999      Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions."));
    90100      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()));
     101      Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder()) { Hidden = true });
    92102      Parameters.Add(new FixedValueParameter<SingleObjectiveOptimizationSupportScript>("SupportScript", "A script that can provide neighborhood and analyze the results of the optimization.", new SingleObjectiveOptimizationSupportScript()));
    93103
     
    100110    }
    101111
     112    public virtual void SetMaximization(bool maximization) {
     113      MaximizationParameter.Value.Value = maximization;
     114    }
     115
    102116    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);
     117      var qualityMessage = Evaluate(BuildSolutionMessage(individual));
     118      if (!qualityMessage.HasExtension(SingleObjectiveQualityMessage.QualityMessage_))
     119        throw new InvalidOperationException("The received message is not a SingleObjectiveQualityMessage.");
     120      return qualityMessage.GetExtension(SingleObjectiveQualityMessage.QualityMessage_).Quality;
     121    }
     122    public virtual QualityMessage Evaluate(SolutionMessage solutionMessage) {
     123      return Cache == null
     124        ? EvaluateOnNextAvailableClient(solutionMessage)
     125        : Cache.GetValue(solutionMessage, EvaluateOnNextAvailableClient, GetQualityMessageExtensions());
    105126    }
    106127
     
    114135    #endregion
    115136
    116     #region Evaluation Helpers
     137    public virtual ExtensionRegistry GetQualityMessageExtensions() {
     138      var extensions = ExtensionRegistry.CreateInstance();
     139      extensions.Add(SingleObjectiveQualityMessage.QualityMessage_);
     140      return extensions;
     141    }
     142
     143    #region Evaluation
    117144    private HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>();
    118145    private object clientLock = new object();
     146
    119147    private QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) {
    120148      IEvaluationServiceClient client = null;
     
    130158      try {
    131159        return client.Evaluate(message, GetQualityMessageExtensions());
    132       }
    133       finally {
     160      } finally {
    134161        lock (clientLock) {
    135162          activeClients.Remove(client);
     
    139166    }
    140167
    141     private ExtensionRegistry GetQualityMessageExtensions() {
    142       return ExtensionRegistry.CreateInstance();
    143     }
    144 
    145     private SolutionMessage BuildSolutionMessage(Individual individual) {
     168    private SolutionMessage BuildSolutionMessage(Individual individual, int solutionId = 0) {
    146169      lock (clientLock) {
    147170        SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder();
    148         protobufBuilder.SolutionId = 0;
     171        protobufBuilder.SolutionId = solutionId;
    149172        var scope = new Scope();
    150173        individual.CopyToScope(scope);
     
    152175          try {
    153176            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);
     177          } catch (ArgumentException ex) {
     178            throw new InvalidOperationException(string.Format("ERROR while building solution message: Parameter {0} cannot be added to the message", Name), ex);
    157179          }
    158180        }
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/HeuristicLab.Problems.ExternalEvaluation-3.4.csproj

    r11961 r14029  
    134134    <Compile Include="Drivers\EvaluationStreamChannel.cs" />
    135135    <Compile Include="Drivers\EvaluationTCPChannel.cs" />
     136    <Compile Include="Interfaces\IExternalEvaluationProblem.cs" />
     137    <Compile Include="Interfaces\IMultiObjectiveOptimizationSupport.cs" />
     138    <Compile Include="MultiObjectiveExternalEvaluationProblem.cs" />
    136139    <Compile Include="ExternalEvaluationProblem.cs" />
    137140    <Compile Include="Interfaces\IEvaluationServiceClient.cs" />
     
    141144    <Compile Include="Plugin.cs" />
    142145    <Compile Include="Programmable\CompiledOptimizationSupport.cs" />
     146    <Compile Include="Programmable\CompiledMultiObjectiveOptimizationSupport.cs" />
    143147    <Compile Include="Programmable\CompiledSingleObjectiveOptimizationSupport.cs" />
     148    <Compile Include="Programmable\MultiObjectiveOptimizationSupportScript.cs" />
     149    <Compile Include="Programmable\OptimizationSupportScript.cs" />
    144150    <Compile Include="Programmable\SingleObjectiveOptimizationSupportScript.cs" />
    145     <Compile Include="Programmable\SingleObjectiveOptimizationSupportScriptException.cs" />
     151    <Compile Include="Programmable\OptimizationSupportScriptException.cs" />
    146152    <Compile Include="Programmable\Templates.Designer.cs">
    147153      <AutoGen>True</AutoGen>
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/Plugin.cs.frame

    r12753 r14029  
    2323
    2424namespace HeuristicLab.Problems.ExternalEvaluation {
    25   [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3.4.22.$WCREV$")]
     25  [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3.4.23.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Problems.ExternalEvaluation-3.4.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Analysis", "3.3")]
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/CompiledSingleObjectiveOptimizationSupport.cs

    r11961 r14029  
    1 using System;
    2 using System.Linq;
    3 using System.Collections.Generic;
    4 using HeuristicLab.Common;
     1using System.Collections.Generic;
    52using HeuristicLab.Core;
    6 using HeuristicLab.Data;
    73using HeuristicLab.Optimization;
    84
     
    1410      // Write or update results given the range of vectors and resulting qualities
    1511      // 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];
    2017    }
    2118
     
    3835  }
    3936}
    40 
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/SingleObjectiveOptimizationSupportScript.cs

    r12012 r14029  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Reflection;
    2623using HeuristicLab.Common;
    2724using HeuristicLab.Core;
     
    2926using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3027using HeuristicLab.Problems.ExternalEvaluation.Programmable;
    31 using HeuristicLab.Scripting;
    3228
    3329namespace HeuristicLab.Problems.ExternalEvaluation {
    3430  [Item("ProblemDefinitionScript", "Script that defines the parameter vector and evaluates the solution for a programmable problem.")]
    3531  [StorableClass]
    36   public sealed class SingleObjectiveOptimizationSupportScript : Script, ISingleObjectiveOptimizationSupport {
    37 
    38     [Storable]
    39     private VariableStore variableStore;
    40     public VariableStore VariableStore {
    41       get { return variableStore; }
    42     }
    43 
    44     protected override string CodeTemplate {
    45       get { return Templates.CompiledSingleObjectiveOptimizationSupport; }
    46     }
    47 
     32  public sealed class SingleObjectiveOptimizationSupportScript : OptimizationSupportScript<ISingleObjectiveOptimizationSupport>, ISingleObjectiveOptimizationSupport {
    4833    [StorableConstructor]
    4934    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     }
     35    private SingleObjectiveOptimizationSupportScript(SingleObjectiveOptimizationSupportScript original, Cloner cloner) : base(original, cloner) { }
     36    public SingleObjectiveOptimizationSupportScript() : base(Templates.CompiledSingleObjectiveOptimizationSupport) { }
    5837
    5938    public override IDeepCloneable Clone(Cloner cloner) {
    6039      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;
    10840    }
    10941
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.Designer.cs

    r11893 r14029  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.34209
     4//     Runtime Version:4.0.30319.42000
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    6868        ///using HeuristicLab.Core;
    6969        ///using HeuristicLab.Data;
    70         ///using HeuristicLab.Encodings.PermutationEncoding;
    7170        ///using HeuristicLab.Optimization;
    72         ///using HeuristicLab.Problems.Programmable;
    7371        ///
    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 {
    7774        ///
    78         ///     [rest of string was truncated]&quot;;.
     75        ///    public void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) {
     76        ///      // Use vars.yourVaria [rest of string was truncated]&quot;;.
     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]&quot;;.
    7998        /// </summary>
    8099        internal static string CompiledSingleObjectiveOptimizationSupport {
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.resx

    r11893 r14029  
    119119  </resheader>
    120120  <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>
    121124  <data name="CompiledSingleObjectiveOptimizationSupport" type="System.Resources.ResXFileRef, System.Windows.Forms">
    122125    <value>CompiledSingleObjectiveOptimizationSupport.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/Properties/AssemblyInfo.cs.frame

    r12753 r14029  
    3434// [assembly: AssemblyVersion("1.0.*")]
    3535[assembly: AssemblyVersion("3.4.0.0")]
    36 [assembly: AssemblyFileVersion("3.4.22.$WCREV$")]
     36[assembly: AssemblyFileVersion("3.4.23.$WCREV$")]
  • branches/crossvalidation-2434/HeuristicLab.Problems.ExternalEvaluation/3.4/Protos/ExternalEvaluationMessages.proto

    r8298 r14029  
    6464}
    6565
     66// Nested Extensions http://www.indelible.org/ink/protobuf-polymorphism/
    6667message QualityMessage {
    6768  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;
    7074  extensions 1000 to max;
    7175}
     76
     77message SingleObjectiveQualityMessage {
     78  extend QualityMessage {
     79    required SingleObjectiveQualityMessage qualityMessage = 1000;  // unique QualityMessage extension number
     80  }
     81  required double quality = 1;
     82}
     83message MultiObjectiveQualityMessage {
     84  extend QualityMessage {
     85    required MultiObjectiveQualityMessage qualityMessage = 1001;  // unique QualityMessage extension number
     86  }
     87  repeated double qualities = 1;
     88}
     89
    7290 
    7391service EvaluationService {
    74   rpc Evaluate (SolutionMessage) returns (QualityMessage);
     92  rpc EvaluateSingleObjective (SolutionMessage) returns (SingleObjectiveQualityMessage);
     93  rpc EvaluateMultiObjectives (SolutionMessage) returns (MultiObjectiveQualityMessage);
    7594}
Note: See TracChangeset for help on using the changeset viewer.