Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13259 for stable


Ignore:
Timestamp:
11/18/15 17:23:48 (9 years ago)
Author:
ascheibe
Message:

#1674 merged r13180,r13183,r13203,r13212,r13257 into stable

Location:
stable
Files:
1 deleted
10 edited
7 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/EvaluationCache.cs

    r12009 r13259  
    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        }
  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/ExternalEvaluationProblem.cs

    r13197 r13259  
    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 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 {
     
    8991      Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions."));
    9092      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 });
    9294      Parameters.Add(new FixedValueParameter<SingleObjectiveOptimizationSupportScript>("SupportScript", "A script that can provide neighborhood and analyze the results of the optimization.", new SingleObjectiveOptimizationSupportScript()));
    9395
     
    101103
    102104    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());
    105114    }
    106115
     
    114123    #endregion
    115124
    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
    117132    private HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>();
    118133    private object clientLock = new object();
     134
    119135    private QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) {
    120136      IEvaluationServiceClient client = null;
     
    130146      try {
    131147        return client.Evaluate(message, GetQualityMessageExtensions());
    132       }
    133       finally {
     148      } finally {
    134149        lock (clientLock) {
    135150          activeClients.Remove(client);
     
    139154    }
    140155
    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) {
    146157      lock (clientLock) {
    147158        SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder();
    148         protobufBuilder.SolutionId = 0;
     159        protobufBuilder.SolutionId = solutionId;
    149160        var scope = new Scope();
    150161        individual.CopyToScope(scope);
     
    152163          try {
    153164            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);
    157167          }
    158168        }
  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/HeuristicLab.Problems.ExternalEvaluation-3.4.csproj

    r11961 r13259  
    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>
  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/MultiObjectiveExternalEvaluationProblem.cs

    r13180 r13259  
    3434
    3535namespace 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.")]
    3737  [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 200)]
    3838  [StorableClass]
     
    5353      get { return (IValueParameter<SolutionMessageBuilder>)Parameters["MessageBuilder"]; }
    5454    }
    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    }
    5858    #endregion
    5959
     
    6868      get { return MessageBuilderParameter.Value; }
    6969    }
    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    }
    7676    #endregion
    7777
     
    8989      Parameters.Add(new ValueParameter<CheckedItemCollection<IEvaluationServiceClient>>("Clients", "The clients that are used to communicate with the external application.", new CheckedItemCollection<IEvaluationServiceClient>() { new EvaluationServiceClient() }));
    9090      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()));
    9492    }
    9593
     
    114112
    115113    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);
    117115    }
    118116
  • 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;
     1using HeuristicLab.Core;
    72using HeuristicLab.Optimization;
    83
     
    138      // Use vars.yourVariable to access variables in the variable store i.e. yourVariable
    149      // Write or update results given the range of vectors and resulting qualities
    15       // 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];
    2010    }
    2111
  • 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;
     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 
  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/SingleObjectiveOptimizationSupportScript.cs

    r12009 r13259  
    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     }
     32  public sealed class SingleObjectiveOptimizationSupportScript : OptimizationSupportScript<ISingleObjectiveOptimizationSupport>, ISingleObjectiveOptimizationSupport {
    4333
    4434    protected override string CodeTemplate {
     
    4838    [StorableConstructor]
    4939    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() { }
    5842
    5943    public override IDeepCloneable Clone(Cloner cloner) {
    6044      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;
    10845    }
    10946
  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.Designer.cs

    r11893 r13259  
    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 {
  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/Templates.resx

    r11893 r13259  
    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>
  • stable/HeuristicLab.Problems.ExternalEvaluation/3.4/Protos/ExternalEvaluationMessages.proto

    r8298 r13259  
    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}
  • stable/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProblemDefinitionScript.cs

    r12009 r13259  
    2828  [Item("Multi-objective Problem Definition Script", "Script that defines the parameter vector and evaluates the solution for a programmable problem.")]
    2929  [StorableClass]
    30   public class MultiObjectiveProblemDefinitionScript : ProblemDefinitionScript, IMultiObjectiveProblemDefinition, IStorableContent {
     30  public sealed class MultiObjectiveProblemDefinitionScript : ProblemDefinitionScript, IMultiObjectiveProblemDefinition, IStorableContent {
    3131    public string Filename { get; set; }
    3232
     
    4040
    4141    [StorableConstructor]
    42     protected MultiObjectiveProblemDefinitionScript(bool deserializing) : base(deserializing) { }
    43     protected MultiObjectiveProblemDefinitionScript(MultiObjectiveProblemDefinitionScript original, Cloner cloner)
     42    private MultiObjectiveProblemDefinitionScript(bool deserializing) : base(deserializing) { }
     43    private MultiObjectiveProblemDefinitionScript(MultiObjectiveProblemDefinitionScript original, Cloner cloner)
    4444      : base(original, cloner) { }
    4545
Note: See TracChangeset for help on using the changeset viewer.