- Timestamp:
- 02/04/15 18:14:48 (10 years ago)
- Location:
- branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation
- Files:
-
- 1 added
- 4 deleted
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/ExternalEvaluationProblem.cs
r11616 r11892 24 24 using System.Drawing; 25 25 using System.Linq; 26 using HeuristicLab.Analysis;27 using HeuristicLab.Collections;26 using System.Threading; 27 using Google.ProtocolBuffers; 28 28 using HeuristicLab.Common; 29 29 using HeuristicLab.Core; 30 30 using HeuristicLab.Data; 31 using HeuristicLab.Optimization;32 using HeuristicLab.Optimization.Operators;33 31 using HeuristicLab.Parameters; 34 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.Problems.Programmable; 35 34 36 35 namespace HeuristicLab.Problems.ExternalEvaluation { … … 38 37 [Creatable("Problems")] 39 38 [StorableClass] 40 public sealed class ExternalEvaluationProblem : ParameterizedNamedItem, ISingleObjectiveHeuristicOptimizationProblem, IStorableContent { 41 public string Filename { get; set; } 39 public sealed class ExternalEvaluationProblem : SingleObjectiveBasicProblem<IEncoding> { 40 private HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>(); 41 private object clientLock = new object(); 42 42 43 43 public static new Image StaticItemImage { … … 45 45 } 46 46 47 public new ParameterCollection Parameters{48 get { return base.Parameters; }47 public OptionalValueParameter<EvaluationCache> CacheParameter { 48 get { return (OptionalValueParameter<EvaluationCache>)Parameters["Cache"]; } 49 49 } 50 IKeyedItemCollection<string, IParameter> IParameterizedItem.Parameters {51 get { return Parameters; }52 }53 54 #region Parameters55 50 public IValueParameter<CheckedItemCollection<IEvaluationServiceClient>> ClientsParameter { 56 51 get { return (IValueParameter<CheckedItemCollection<IEvaluationServiceClient>>)Parameters["Clients"]; } 57 52 } 58 public IValueParameter< IExternalEvaluationProblemEvaluator> EvaluatorParameter {59 get { return (IValueParameter< IExternalEvaluationProblemEvaluator>)Parameters["Evaluator"]; }53 public IValueParameter<SolutionMessageBuilder> MessageBuilderParameter { 54 get { return (IValueParameter<SolutionMessageBuilder>)Parameters["MessageBuilder"]; } 60 55 } 61 public ValueParameter<BoolValue> MaximizationParameter { 62 get { return (ValueParameter<BoolValue>)Parameters["Maximization"]; } 56 57 public EvaluationCache Cache { 58 get { return CacheParameter.Value; } 63 59 } 64 IParameter ISingleObjectiveHeuristicOptimizationProblem.MaximizationParameter{65 get { return MaximizationParameter; }60 public CheckedItemCollection<IEvaluationServiceClient> Clients { 61 get { return ClientsParameter.Value; } 66 62 } 67 public ValueParameter<ISolutionCreator> SolutionCreatorParameter {68 get { return (ValueParameter<ISolutionCreator>)Parameters["SolutionCreator"]; }63 public SolutionMessageBuilder MessageBuilder { 64 get { return MessageBuilderParameter.Value; } 69 65 } 70 IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter {71 get { return SolutionCreatorParameter; }72 }73 IParameter IHeuristicOptimizationProblem.EvaluatorParameter {74 get { return EvaluatorParameter; }75 }76 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter {77 get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; }78 }79 IParameter ISingleObjectiveHeuristicOptimizationProblem.BestKnownQualityParameter {80 get { return BestKnownQualityParameter; }81 }82 public OptionalValueParameter<IScope> BestKnownSolutionParameter {83 get { return (OptionalValueParameter<IScope>)Parameters["BestKnownSolution"]; }84 }85 public ValueParameter<ItemList<IItem>> OperatorsParameter {86 get { return (ValueParameter<ItemList<IItem>>)Parameters["Operators"]; }87 }88 public OptionalValueParameter<EvaluationCache> CacheParameter {89 get { return (OptionalValueParameter<EvaluationCache>)Parameters["Cache"]; }90 }91 #endregion92 93 #region Properties94 public BoolValue Maximization {95 get { return MaximizationParameter.Value; }96 set { MaximizationParameter.Value = value; }97 }98 public ISolutionCreator SolutionCreator {99 get { return SolutionCreatorParameter.Value; }100 set { SolutionCreatorParameter.Value = value; }101 }102 ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator {103 get { return SolutionCreatorParameter.Value; }104 }105 public IExternalEvaluationProblemEvaluator Evaluator {106 get { return EvaluatorParameter.Value; }107 set { EvaluatorParameter.Value = value; }108 }109 ISingleObjectiveEvaluator ISingleObjectiveHeuristicOptimizationProblem.Evaluator {110 get { return EvaluatorParameter.Value; }111 }112 IEvaluator IHeuristicOptimizationProblem.Evaluator {113 get { return EvaluatorParameter.Value; }114 }115 public DoubleValue BestKnownQuality {116 get { return BestKnownQualityParameter.Value; }117 set { BestKnownQualityParameter.Value = value; }118 }119 public IEnumerable<IItem> Operators {120 get { return OperatorsParameter.Value; }121 }122 private BestScopeSolutionAnalyzer BestScopeSolutionAnalyzer {123 get { return OperatorsParameter.Value.OfType<BestScopeSolutionAnalyzer>().FirstOrDefault(); }124 }125 #endregion126 66 127 67 [StorableConstructor] 128 68 private ExternalEvaluationProblem(bool deserializing) : base(deserializing) { } 129 private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner) 130 : base(original, cloner) { 131 RegisterEventHandlers(); 132 } 69 private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner) : base(original, cloner) { } 133 70 public override IDeepCloneable Clone(Cloner cloner) { 134 71 return new ExternalEvaluationProblem(this, cloner); … … 136 73 public ExternalEvaluationProblem() 137 74 : base() { 138 ExternalEvaluator evaluator = new ExternalEvaluator(); 139 UserDefinedSolutionCreator solutionCreator = new UserDefinedSolutionCreator(); 140 75 Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions.")); 141 76 Parameters.Add(new ValueParameter<CheckedItemCollection<IEvaluationServiceClient>>("Clients", "The clients that are used to communicate with the external application.", new CheckedItemCollection<IEvaluationServiceClient>() { new EvaluationServiceClient() })); 142 Parameters.Add(new ValueParameter<IExternalEvaluationProblemEvaluator>("Evaluator", "The evaluator that collects the values to exchange.", evaluator)); 143 Parameters.Add(new ValueParameter<ISolutionCreator>("SolutionCreator", "An operator to create the solution components.", solutionCreator)); 144 Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as most test functions are minimization problems.", new BoolValue(false))); 145 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem.")); 146 Parameters.Add(new OptionalValueParameter<IScope>("BestKnownSolution", "The best known solution for this external evaluation problem.")); 147 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>())); 148 Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions.")); 149 150 InitializeOperators(); 151 RegisterEventHandlers(); 152 } 153 [StorableHook(HookType.AfterDeserialization)] 154 private void AfterDeserialization() { 155 // BackwardsCompatibility3.3 156 #region Backwards compatible code, remove with 3.4 157 if (!Parameters.ContainsKey("Clients")) { 158 Parameters.Add(new ValueParameter<CheckedItemCollection<IEvaluationServiceClient>>("Clients", "The clients that are used to communicate with the external application.", new CheckedItemCollection<IEvaluationServiceClient>() { new EvaluationServiceClient() })); 159 if (Parameters.ContainsKey("Client")) { 160 var client = ((IValueParameter<IEvaluationServiceClient>)Parameters["Client"]).Value; 161 if (client != null) 162 ClientsParameter.Value = new CheckedItemCollection<IEvaluationServiceClient>() { client }; 163 Parameters.Remove("Client"); 164 } 165 } 166 167 if (Parameters.ContainsKey("Operators") && Parameters["Operators"] is ValueParameter<ItemList<IOperator>>) { 168 ItemList<IOperator> tmp = ((ValueParameter<ItemList<IOperator>>)Parameters["Operators"]).Value; 169 Parameters.Remove("Operators"); 170 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp), false)); 171 } 172 #endregion 173 RegisterEventHandlers(); 77 Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder())); 174 78 } 175 79 176 #region Events 177 public event EventHandler SolutionCreatorChanged; 178 private void OnSolutionCreatorChanged() { 179 EventHandler handler = SolutionCreatorChanged; 180 if (handler != null) handler(this, EventArgs.Empty); 181 } 182 public event EventHandler EvaluatorChanged; 183 private void OnEvaluatorChanged() { 184 EventHandler handler = EvaluatorChanged; 185 if (handler != null) handler(this, EventArgs.Empty); 186 } 187 public event EventHandler OperatorsChanged; 188 private void OnOperatorsChanged() { 189 EventHandler handler = OperatorsChanged; 190 if (handler != null) handler(this, EventArgs.Empty); 191 } 192 public event EventHandler Reset; 193 private void OnReset() { 194 EventHandler handler = Reset; 195 if (handler != null) handler(this, EventArgs.Empty); 80 public override bool Maximization { 81 get { return Parameters.ContainsKey("Maximization") && ((IValueParameter<BoolValue>)Parameters["Maximization"]).Value.Value; } 196 82 } 197 83 198 private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) { 199 OnSolutionCreatorChanged(); 84 public override double Evaluate(Individual individual, IRandom random) { 85 return Cache == null ? EvaluateOnNextAvailableClient(BuildSolutionMessage(individual)).Quality 86 : Cache.GetValue(BuildSolutionMessage(individual), m => EvaluateOnNextAvailableClient(m).Quality); 200 87 } 201 private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {202 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);203 ParameterizeOperators();204 OnEvaluatorChanged();205 }206 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {207 ParameterizeOperators();208 }209 private void OperatorsParameter_ValueChanged(object sender, EventArgs e) {210 OnOperatorsChanged();211 }212 private void OperatorsParameter_Value_ItemsAdded(object sender, EventArgs e) {213 OnOperatorsChanged();214 }215 private void OperatorsParameter_Value_ItemsRemoved(object sender, EventArgs e) {216 OnOperatorsChanged();217 }218 private void OperatorsParameter_Value_CollectionReset(object sender, EventArgs e) {219 OnOperatorsChanged();220 }221 #endregion222 88 223 #region Helper 224 private void RegisterEventHandlers() { 225 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 226 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 227 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 228 OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged); 229 OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsAdded); 230 OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsRemoved); 231 OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_CollectionReset); 232 } 233 private void InitializeOperators() { 234 ItemList<IItem> operators = OperatorsParameter.Value; 235 operators.Add(new BestScopeSolutionAnalyzer()); 236 ParameterizeAnalyzers(); 237 } 238 private void ParameterizeAnalyzers() { 239 BestScopeSolutionAnalyzer.ResultsParameter.ActualName = "Results"; 240 BestScopeSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 241 BestScopeSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 242 BestScopeSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 243 } 244 private void ParameterizeEvaluator() { 245 Evaluator.ClientsParameter.ActualName = ClientsParameter.Name; 246 } 247 private void ParameterizeOperators() { 248 // This is a best effort approach to wiring 249 string qualityName = Evaluator.QualityParameter.ActualName; 250 foreach (IOperator op in OperatorsParameter.Value) { 251 foreach (ILookupParameter<DoubleValue> param in op.Parameters.OfType<ILookupParameter<DoubleValue>>()) { 252 if (param.Name.Equals("Quality")) param.ActualName = qualityName; 89 private QualityMessage EvaluateOnNextAvailableClient(SolutionMessage message) { 90 IEvaluationServiceClient client = null; 91 lock (clientLock) { 92 client = Clients.CheckedItems.FirstOrDefault(c => !activeClients.Contains(c)); 93 while (client == null && Clients.CheckedItems.Any()) { 94 Monitor.Wait(clientLock); 95 client = Clients.CheckedItems.FirstOrDefault(c => !activeClients.Contains(c)); 253 96 } 254 foreach (IScopeTreeLookupParameter<DoubleValue> param in op.Parameters.OfType<IScopeTreeLookupParameter<DoubleValue>>()) { 255 if (param.Name.Equals("Quality")) param.ActualName = qualityName; 97 if (client != null) 98 activeClients.Add(client); 99 } 100 try { 101 return client.Evaluate(message, GetQualityMessageExtensions()); 102 } finally { 103 lock (clientLock) { 104 activeClients.Remove(client); 105 Monitor.PulseAll(clientLock); 256 106 } 257 107 } 258 108 } 259 #endregion 109 110 private ExtensionRegistry GetQualityMessageExtensions() { 111 return ExtensionRegistry.CreateInstance(); 112 } 113 114 private SolutionMessage BuildSolutionMessage(Individual individual) { 115 lock (clientLock) { 116 SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder(); 117 protobufBuilder.SolutionId = 0; 118 var scope = new Scope(); 119 individual.CopyToScope(scope); 120 foreach (var variable in scope.Variables) { 121 try { 122 MessageBuilder.AddToMessage(variable.Value, variable.Name, protobufBuilder); 123 } catch (ArgumentException ex) { 124 throw new InvalidOperationException(string.Format("ERROR while building solution message: Parameter {0} cannot be added to the message", name), ex); 125 } 126 } 127 return protobufBuilder.Build(); 128 } 129 } 260 130 } 261 131 } -
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/HeuristicLab.Problems.ExternalEvaluation-3.4.csproj
r11879 r11892 10 10 <AppDesignerFolder>Properties</AppDesignerFolder> 11 11 <RootNamespace>HeuristicLab.Problems.ExternalEvaluation</RootNamespace> 12 <AssemblyName>HeuristicLab.Problems.ExternalEvaluation-3. 3</AssemblyName>12 <AssemblyName>HeuristicLab.Problems.ExternalEvaluation-3.4</AssemblyName> 13 13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> 14 14 <TargetFrameworkProfile> … … 41 41 <DebugType>full</DebugType> 42 42 <Optimize>false</Optimize> 43 <OutputPath> $(SolutionDir)\bin\</OutputPath>43 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 44 44 <DefineConstants>DEBUG;TRACE</DefineConstants> 45 45 <ErrorReport>prompt</ErrorReport> … … 51 51 <DebugType>pdbonly</DebugType> 52 52 <Optimize>true</Optimize> 53 <OutputPath> $(SolutionDir)\bin\</OutputPath>53 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 54 54 <DefineConstants>TRACE</DefineConstants> 55 55 <ErrorReport>prompt</ErrorReport> … … 60 60 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 61 61 <DebugSymbols>true</DebugSymbols> 62 <OutputPath> $(SolutionDir)\bin\</OutputPath>62 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 63 63 <DefineConstants>DEBUG;TRACE</DefineConstants> 64 64 <DebugType>full</DebugType> … … 69 69 </PropertyGroup> 70 70 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 71 <OutputPath> $(SolutionDir)\bin\</OutputPath>71 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 72 72 <DefineConstants>TRACE</DefineConstants> 73 73 <Optimize>true</Optimize> … … 82 82 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> 83 83 <DebugSymbols>true</DebugSymbols> 84 <OutputPath> $(SolutionDir)\bin\</OutputPath>84 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 85 85 <DefineConstants>DEBUG;TRACE</DefineConstants> 86 86 <DebugType>full</DebugType> … … 91 91 </PropertyGroup> 92 92 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> 93 <OutputPath> $(SolutionDir)\bin\</OutputPath>93 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 94 94 <DefineConstants>TRACE</DefineConstants> 95 95 <Optimize>true</Optimize> … … 102 102 <ItemGroup> 103 103 <Reference Include="Google.ProtocolBuffers-2.4.1.473, Version=2.4.1.473"> 104 <HintPath>..\..\ bin\Google.ProtocolBuffers-2.4.1.473.dll</HintPath>104 <HintPath>..\..\..\..\trunk\sources\bin\Google.ProtocolBuffers-2.4.1.473.dll</HintPath> 105 105 <Private>False</Private> 106 106 </Reference> … … 128 128 <Compile Include="Converters\IntegerConverter.cs" /> 129 129 <Compile Include="Converters\StringConverter.cs" /> 130 <Compile Include="CachedExternalEvaluator.cs" />131 130 <Compile Include="EvaluationCache.cs" /> 132 131 <Compile Include="Drivers\EvaluationServiceClient.cs" /> … … 136 135 <Compile Include="Drivers\EvaluationTCPChannel.cs" /> 137 136 <Compile Include="ExternalEvaluationProblem.cs" /> 138 <Compile Include="ExternalEvaluator.cs" />139 137 <Compile Include="Interfaces\IEvaluationServiceClient.cs" /> 140 138 <Compile Include="Interfaces\IEvaluationChannel.cs" /> 141 <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" />142 139 <Compile Include="Interfaces\IItemToSolutionMessageConverter.cs" /> 143 140 <Compile Include="Plugin.cs" /> … … 149 146 </ItemGroup> 150 147 <ItemGroup> 151 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 152 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 153 <Name>HeuristicLab.Analysis-3.3</Name> 154 <Private>False</Private> 155 </ProjectReference> 156 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 157 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 158 <Name>HeuristicLab.Collections-3.3</Name> 159 <Private>False</Private> 160 </ProjectReference> 161 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 162 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 163 <Name>HeuristicLab.Common.Resources-3.3</Name> 164 <Private>False</Private> 165 </ProjectReference> 166 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 167 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> 168 <Name>HeuristicLab.Common-3.3</Name> 169 <Private>False</Private> 170 </ProjectReference> 171 <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj"> 172 <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project> 173 <Name>HeuristicLab.Core.Views-3.3</Name> 174 <Private>False</Private> 175 </ProjectReference> 176 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 177 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> 178 <Name>HeuristicLab.Core-3.3</Name> 179 <Private>False</Private> 180 </ProjectReference> 181 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 182 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 183 <Name>HeuristicLab.Data-3.3</Name> 184 <Private>False</Private> 185 </ProjectReference> 186 <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj"> 187 <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project> 188 <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name> 189 <Private>False</Private> 190 </ProjectReference> 191 <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj"> 192 <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project> 193 <Name>HeuristicLab.MainForm-3.3</Name> 194 <Private>False</Private> 195 </ProjectReference> 196 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 197 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 198 <Name>HeuristicLab.Operators-3.3</Name> 199 <Private>False</Private> 200 </ProjectReference> 201 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 202 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 203 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 204 <Private>False</Private> 205 </ProjectReference> 148 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 149 <SpecificVersion>False</SpecificVersion> 150 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath> 151 <Private>False</Private> 152 </Reference> 153 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 154 <SpecificVersion>False</SpecificVersion> 155 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath> 156 <Private>False</Private> 157 </Reference> 158 <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 159 <SpecificVersion>False</SpecificVersion> 160 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 161 <Private>False</Private> 162 </Reference> 163 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 164 <SpecificVersion>False</SpecificVersion> 165 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath> 166 <Private>False</Private> 167 </Reference> 168 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 169 <SpecificVersion>False</SpecificVersion> 170 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 171 <Private>False</Private> 172 </Reference> 173 <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 174 <SpecificVersion>False</SpecificVersion> 175 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath> 176 <Private>False</Private> 177 </Reference> 178 <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 179 <SpecificVersion>False</SpecificVersion> 180 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath> 181 <Private>False</Private> 182 </Reference> 183 <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 184 <SpecificVersion>False</SpecificVersion> 185 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath> 186 <Private>False</Private> 187 </Reference> 188 <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 189 <SpecificVersion>False</SpecificVersion> 190 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> 191 <Private>False</Private> 192 </Reference> 193 <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 194 <SpecificVersion>False</SpecificVersion> 195 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath> 196 <Private>False</Private> 197 </Reference> 198 <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 199 <SpecificVersion>False</SpecificVersion> 200 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 201 <Private>False</Private> 202 </Reference> 203 </ItemGroup> 204 <ItemGroup> 206 205 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 207 206 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> … … 209 208 <Private>False</Private> 210 209 </ProjectReference> 211 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 212 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 213 <Name>HeuristicLab.Parameters-3.3</Name> 214 <Private>False</Private> 215 </ProjectReference> 216 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 217 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project> 218 <Name>HeuristicLab.Persistence-3.3</Name> 219 <Private>False</Private> 220 </ProjectReference> 221 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 222 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> 223 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 224 <Private>False</Private> 210 <ProjectReference Include="..\..\HeuristicLab.Problems.Programmable\3.3\HeuristicLab.Problems.Programmable-3.3.csproj"> 211 <Project>{ee07bff8-b23d-41f5-8ad7-ac9598d7a2c9}</Project> 212 <Name>HeuristicLab.Problems.Programmable-3.3</Name> 225 213 </ProjectReference> 226 214 </ItemGroup> -
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/Plugin.cs.frame
r11174 r11892 23 23 24 24 namespace HeuristicLab.Problems.ExternalEvaluation { 25 [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3. 3.10.$WCREV$")]26 [PluginFile("HeuristicLab.Problems.ExternalEvaluation-3. 3.dll", PluginFileType.Assembly)]25 [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3.4.10.$WCREV$")] 26 [PluginFile("HeuristicLab.Problems.ExternalEvaluation-3.4.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] 28 28 [PluginDependency("HeuristicLab.Collections", "3.3")] -
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/Properties/AssemblyInfo.cs.frame
r11174 r11892 33 33 // by using the '*' as shown below: 34 34 // [assembly: AssemblyVersion("1.0.*")] 35 [assembly: AssemblyVersion("3. 3.0.0")]36 [assembly: AssemblyFileVersion("3. 3.10.$WCREV$")]35 [assembly: AssemblyVersion("3.4.0.0")] 36 [assembly: AssemblyFileVersion("3.4.10.$WCREV$")] -
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/SolutionMessageBuilder.cs
r11171 r11892 36 36 private Dictionary<Type, Action<IItem, string, SolutionMessage.Builder>> dispatcher; 37 37 38 // BackwardsCompatibility3.339 #region Backwards compatible code, remove with 3.440 [Storable]41 [Obsolete]42 private CheckedItemCollection<IItemToSolutionMessageConverter> converters;43 #endregion44 38 [Storable] 45 39 private CheckedItemList<IItemToSolutionMessageConverter> convertersList; … … 52 46 [StorableHook(HookType.AfterDeserialization)] 53 47 private void AfterDeserialization() { 54 // BackwardsCompatibility3.355 #region Backwards compatible code, remove with 3.456 #pragma warning disable 061257 if (converters != null) {58 if (convertersList == null) convertersList = new CheckedItemList<IItemToSolutionMessageConverter>();59 foreach (IItemToSolutionMessageConverter c in converters)60 convertersList.Add(c);61 converters.Clear();62 converters = null;63 }64 #pragma warning restore 061265 #endregion66 48 RegisterEventHandlers(); 67 49 } … … 106 88 107 89 private void RegisterEventHandlers() { 108 convertersList.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed);109 convertersList.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed);110 convertersList.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed);111 convertersList.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed);112 convertersList.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed);90 convertersList.ItemsAdded += convertersList_Changed; 91 convertersList.ItemsRemoved += convertersList_Changed; 92 convertersList.CheckedItemsChanged += convertersList_Changed; 93 convertersList.ItemsMoved += convertersList_Changed; 94 convertersList.ItemsReplaced += convertersList_Changed; 113 95 } 114 96 … … 119 101 private void BuildDispatcher() { 120 102 dispatcher = new Dictionary<Type, Action<IItem, string, SolutionMessage.Builder>>(); 121 foreach ( IItemToSolutionMessageConverter c in convertersList.CheckedItems.OrderBy(x => x.Index).Select(x => x.Value)) {122 Type[]types = c.ItemTypes;123 foreach ( Typet in types) {103 foreach (var c in convertersList.CheckedItems.OrderBy(x => x.Index).Select(x => x.Value)) { 104 var types = c.ItemTypes; 105 foreach (var t in types) { 124 106 if (!dispatcher.ContainsKey(t)) 125 dispatcher.Add(t, new Action<IItem, string, SolutionMessage.Builder>(c.AddItemToBuilder));107 dispatcher.Add(t, c.AddItemToBuilder); 126 108 } 127 109 }
Note: See TracChangeset
for help on using the changeset viewer.