Changeset 3872
- Timestamp:
- 05/30/10 22:31:40 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 13 added
- 11 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
r3832 r3872 87 87 <Compile Include="BestAverageWorstQualityAnalyzer.cs" /> 88 88 <Compile Include="BestAverageWorstQualityCalculator.cs" /> 89 <Compile Include="BestScopeSolutionAnalyzer.cs" /> 89 90 <Compile Include="BestQualityMemorizer.cs" /> 90 91 <Compile Include="QualityAnalyzer.cs" /> -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/HeuristicLab.Problems.ExternalEvaluation.Views-3.3.csproj
r3865 r3872 83 83 </ItemGroup> 84 84 <ItemGroup> 85 <Compile Include="E xternalEvaluationProcessDriverView.cs">85 <Compile Include="EvaluationServiceClientView.cs"> 86 86 <SubType>UserControl</SubType> 87 87 </Compile> 88 <Compile Include="ExternalEvaluationProcessDriverView.Designer.cs"> 89 <DependentUpon>ExternalEvaluationProcessDriverView.cs</DependentUpon> 88 <Compile Include="EvaluationServiceClientView.Designer.cs"> 89 <DependentUpon>EvaluationServiceClientView.cs</DependentUpon> 90 </Compile> 91 <Compile Include="EvaluationProcessChannelView.cs"> 92 <SubType>UserControl</SubType> 93 </Compile> 94 <Compile Include="EvaluationProcessChannelView.Designer.cs"> 95 <DependentUpon>EvaluationProcessChannelView.cs</DependentUpon> 90 96 </Compile> 91 97 <Compile Include="HeuristicLabProblemsExternalEvaluationViewsPlugin.cs" /> … … 126 132 </ItemGroup> 127 133 <ItemGroup> 128 <EmbeddedResource Include="ExternalEvaluationProcessDriverView.resx"> 129 <DependentUpon>ExternalEvaluationProcessDriverView.cs</DependentUpon> 134 <EmbeddedResource Include="EvaluationProcessChannelView.resx"> 135 <DependentUpon>EvaluationProcessChannelView.cs</DependentUpon> 136 </EmbeddedResource> 137 <EmbeddedResource Include="EvaluationServiceClientView.resx"> 138 <DependentUpon>EvaluationServiceClientView.cs</DependentUpon> 130 139 </EmbeddedResource> 131 140 </ItemGroup> -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs
r3864 r3872 31 31 using HeuristicLab.Parameters; 32 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.Optimization.Operators; 34 using HeuristicLab.Analysis; 33 35 34 36 namespace HeuristicLab.Problems.ExternalEvaluation { … … 48 50 49 51 #region Parameters 50 p rivate IValueParameter<IExternalEvaluationDriver> DriverParameter {51 get { return (IValueParameter<IE xternalEvaluationDriver>)Parameters["Driver"]; }52 } 53 p rivateIValueParameter<IExternalEvaluationProblemEvaluator> EvaluatorParameter {52 public IValueParameter<IEvaluationServiceClient> ClientParameter { 53 get { return (IValueParameter<IEvaluationServiceClient>)Parameters["Client"]; } 54 } 55 public IValueParameter<IExternalEvaluationProblemEvaluator> EvaluatorParameter { 54 56 get { return (IValueParameter<IExternalEvaluationProblemEvaluator>)Parameters["Evaluator"]; } 55 57 } … … 112 114 get { return OperatorsParameter.Value; } 113 115 } 114 private Best ExternalEvaluationSolutionAnalyzer BestExternalEvaluationSolutionAnalyzer {115 get { return OperatorsParameter.Value.OfType<Best ExternalEvaluationSolutionAnalyzer>().FirstOrDefault(); }116 private BestScopeSolutionAnalyzer BestScopeSolutionAnalyzer { 117 get { return OperatorsParameter.Value.OfType<BestScopeSolutionAnalyzer>().FirstOrDefault(); } 116 118 } 117 119 #endregion … … 122 124 : base() { 123 125 ExternalEvaluator evaluator = new ExternalEvaluator(); 124 ExternalEvaluationSolutionCreator solutionCreator = new ExternalEvaluationSolutionCreator();125 126 Parameters.Add(new ValueParameter<IE xternalEvaluationDriver>("Driver", "The communication driver that is used to exchange data with the external process."));126 UserDefinedSolutionCreator solutionCreator = new UserDefinedSolutionCreator(); 127 128 Parameters.Add(new ValueParameter<IEvaluationServiceClient>("Client", "The client that is used to communicate with the external application.")); 127 129 Parameters.Add(new ValueParameter<IExternalEvaluationProblemEvaluator>("Evaluator", "The evaluator that collects the values to exchange.", evaluator)); 128 130 Parameters.Add(new ValueParameter<ISolutionCreator>("SolutionCreator", "An operator to create the solution components.", solutionCreator)); … … 168 170 } 169 171 private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) { 172 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 173 ParameterizeOperators(); 170 174 OnEvaluatorChanged(); 171 175 } 172 176 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) { 173 // TODO: Following code is not yet approved behavior, but it's the best effort I can make here regarding wiring 177 ParameterizeOperators(); 178 } 179 private void OperatorsParameter_ValueChanged(object sender, EventArgs e) { 180 OnOperatorsChanged(); 181 } 182 private void OperatorsParameter_Value_ItemsAdded(object sender, EventArgs e) { 183 OnOperatorsChanged(); 184 } 185 private void OperatorsParameter_Value_ItemsRemoved(object sender, EventArgs e) { 186 OnOperatorsChanged(); 187 } 188 private void OperatorsParameter_Value_CollectionReset(object sender, EventArgs e) { 189 OnOperatorsChanged(); 190 } 191 #endregion 192 193 #region Helpers 194 private void InitializeOperators() { 195 ItemList<IOperator> operators = OperatorsParameter.Value; 196 operators.Add(new BestScopeSolutionAnalyzer()); 197 ParameterizeAnalyzers(); 198 } 199 [StorableHook(HookType.AfterDeserialization)] 200 private void AttachEventHandlers() { 201 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 202 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 203 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 204 OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged); 205 OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsAdded); 206 OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsRemoved); 207 OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_CollectionReset); 208 } 209 private void ParameterizeAnalyzers() { 210 BestScopeSolutionAnalyzer.ResultsParameter.ActualName = "Results"; 211 BestScopeSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 212 BestScopeSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 213 BestScopeSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 214 BestScopeSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 215 } 216 private void ParameterizeEvaluator() { 217 Evaluator.ClientParameter.ActualName = ClientParameter.Name; 218 } 219 private void ParameterizeOperators() { 220 // This is a best effort approach to wiring 174 221 string qualityName = Evaluator.QualityParameter.ActualName; 175 222 foreach (IOperator op in OperatorsParameter.Value) { … … 182 229 } 183 230 } 184 private void OperatorsParameter_ValueChanged(object sender, EventArgs e) {185 OnOperatorsChanged();186 }187 private void OperatorsParameter_Value_ItemsAdded(object sender, EventArgs e) {188 OnOperatorsChanged();189 }190 private void OperatorsParameter_Value_ItemsRemoved(object sender, EventArgs e) {191 OnOperatorsChanged();192 }193 private void OperatorsParameter_Value_CollectionReset(object sender, EventArgs e) {194 OnOperatorsChanged();195 }196 #endregion197 198 #region Helpers199 private void InitializeOperators() {200 ItemList<IOperator> operators = OperatorsParameter.Value;201 operators.Add(new BestExternalEvaluationSolutionAnalyzer());202 ParameterizeAnalyzers();203 }204 [StorableHook(HookType.AfterDeserialization)]205 private void AttachEventHandlers() {206 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);207 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);208 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);209 OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged);210 OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsAdded);211 OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsRemoved);212 OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_CollectionReset);213 }214 private void ParameterizeAnalyzers() {215 BestExternalEvaluationSolutionAnalyzer.ResultsParameter.ActualName = "Results";216 BestExternalEvaluationSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;217 BestExternalEvaluationSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;218 BestExternalEvaluationSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;219 BestExternalEvaluationSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;220 }221 private void ParameterizeEvaluator() {222 Evaluator.DriverParameter.ActualName = DriverParameter.Name;223 }224 231 #endregion 225 232 } -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs
r3862 r3872 34 34 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } 35 35 } 36 public IValueLookupParameter<IE xternalEvaluationDriver> DriverParameter {37 get { return (IValueLookupParameter<IE xternalEvaluationDriver>)Parameters["Driver"]; }36 public IValueLookupParameter<IEvaluationServiceClient> ClientParameter { 37 get { return (IValueLookupParameter<IEvaluationServiceClient>)Parameters["Client"]; } 38 38 } 39 39 … … 41 41 : base() { 42 42 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the current solution.")); 43 Parameters.Add(new ValueLookupParameter<IE xternalEvaluationDriver>("Driver", "The driver to communicatewith the external process."));43 Parameters.Add(new ValueLookupParameter<IEvaluationServiceClient>("Client", "The client that communicates with the external process.")); 44 44 } 45 45 46 46 public override IOperation Apply() { 47 IE xternalEvaluationDriver driver = DriverParameter.ActualValue;47 IEvaluationServiceClient client = ClientParameter.ActualValue; 48 48 SolutionMessage.Builder messageBuilder = SolutionMessage.CreateBuilder(); 49 49 messageBuilder.SolutionId = 0; … … 60 60 } 61 61 } 62 QualityMessage answer = driver.Evaluate(messageBuilder.Build());62 QualityMessage answer = client.Evaluate(messageBuilder.Build()); 63 63 if (QualityParameter.ActualValue == null) 64 64 QualityParameter.ActualValue = new DoubleValue(answer.Quality); -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj
r3870 r3872 82 82 </ItemGroup> 83 83 <ItemGroup> 84 <Compile Include="Analyzers\BestExternalEvaluationSolutionAnalyzer.cs" />85 84 <None Include="HeuristicLabProblemsExternalEvaluationPlugin.cs.frame" /> 86 <Compile Include="ExternalEvaluationManipulator.cs" /> 87 <Compile Include="Drivers\ExternalEvaluationDriver.cs" /> 88 <Compile Include="Drivers\ExternalEvaluationProcessDriver.cs" /> 89 <Compile Include="Drivers\ExternalEvaluationStreamDriver.cs" /> 90 <Compile Include="ExternalEvaluationCrossover.cs" /> 85 <Compile Include="Drivers\EvaluationServiceClient.cs" /> 86 <Compile Include="Drivers\EvaluationChannel.cs" /> 87 <Compile Include="Drivers\EvaluationProcessChannel.cs" /> 88 <Compile Include="Drivers\EvaluationStreamChannel.cs" /> 91 89 <Compile Include="ExternalEvaluationProblem.cs" /> 92 <Compile Include="ExternalEvaluationSolutionCreator.cs" />93 90 <Compile Include="ExternalEvaluator.cs" /> 94 91 <Compile Include="HeuristicLabProblemsExternalEvaluationPlugin.cs" /> 95 <Compile Include="Interfaces\IExternalEvaluationDriver.cs" /> 92 <Compile Include="Interfaces\IEvaluationServiceClient.cs" /> 93 <Compile Include="Interfaces\IEvaluationChannel.cs" /> 96 94 <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" /> 97 95 <Compile Include="Properties\AssemblyInfo.cs" /> … … 102 100 </ItemGroup> 103 101 <ItemGroup> 102 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 103 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 104 <Name>HeuristicLab.Analysis-3.3</Name> 105 </ProjectReference> 104 106 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 105 107 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> … … 133 135 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 134 136 <Name>HeuristicLab.Operators-3.3</Name> 137 </ProjectReference> 138 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 139 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 140 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 135 141 </ProjectReference> 136 142 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLabProblemsExternalEvaluationPlugin.cs.frame
r3862 r3872 25 25 [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3.3.0.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Problems.ExternalEvaluation-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] 27 28 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 29 [PluginDependency("HeuristicLab.Common", "3.3")] … … 32 33 [PluginDependency("HeuristicLab.Operators", "3.3")] 33 34 [PluginDependency("HeuristicLab.Optimization", "3.3")] 35 [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")] 34 36 [PluginDependency("HeuristicLab.Parameters", "3.3")] 35 37 [PluginDependency("HeuristicLab.Persistence", "3.3")] -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Interfaces/IExternalEvaluationProblemEvaluator.cs
r3862 r3872 25 25 namespace HeuristicLab.Problems.ExternalEvaluation { 26 26 public interface IExternalEvaluationProblemEvaluator : ISingleObjectiveEvaluator { 27 IValueLookupParameter<IE xternalEvaluationDriver> DriverParameter { get; }27 IValueLookupParameter<IEvaluationServiceClient> ClientParameter { get; } 28 28 } 29 29 } -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto
r3859 r3872 65 65 } 66 66 67 service E xchangeService {68 rpc Evaluate SingleObjectively(SolutionMessage) returns (QualityMessage);67 service EvaluationService { 68 rpc Evaluate (SolutionMessage) returns (QualityMessage); 69 69 }
Note: See TracChangeset
for help on using the changeset viewer.