Changeset 3859 for trunk/sources/HeuristicLab.Problems.ExternalEvaluation
- Timestamp:
- 05/26/10 15:18:42 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3
- Files:
-
- 10 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs
r3852 r3859 23 23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 24 using HeuristicLab.Parameters; 25 using System.Drawing; 26 using HeuristicLab.Optimization; 27 using HeuristicLab.Data; 28 using HeuristicLab.Operators; 25 29 26 30 namespace HeuristicLab.Problems.ExternalEvaluation { 27 31 [Item("External Evaluation Problem", "A problem that is evaluated in a different process.")] 28 32 [StorableClass] 29 public class ExternalEvaluationProblem : ParameterizedNamedItem { 33 public class ExternalEvaluationProblem : ParameterizedNamedItem, ISingleObjectiveProblem { 34 public override Image ItemImage { 35 get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; } 36 } 37 30 38 #region Parameters 39 private IValueParameter<IExternalEvaluationDriver> DriverParameter { 40 get { return (IValueParameter<IExternalEvaluationDriver>)Parameters["Driver"]; } 41 } 42 private IValueParameter<IExternalEvaluationProblemEvaluator> EvaluatorParameter { 43 get { return (IValueParameter<IExternalEvaluationProblemEvaluator>)Parameters["Evaluator"]; } 44 } 45 public ValueParameter<BoolValue> MaximizationParameter { 46 get { return (ValueParameter<BoolValue>)Parameters["Maximization"]; } 47 } 48 IParameter ISingleObjectiveProblem.MaximizationParameter { 49 get { return MaximizationParameter; } 50 } 51 public ValueParameter<IOperator> SolutionCreatorParameter { 52 get { return (ValueParameter<IOperator>)Parameters["SolutionCreator"]; } 53 } 54 IParameter IProblem.SolutionCreatorParameter { 55 get { return SolutionCreatorParameter; } 56 } 57 IParameter IProblem.EvaluatorParameter { 58 get { return EvaluatorParameter; } 59 } 60 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter { 61 get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } 62 } 63 IParameter ISingleObjectiveProblem.BestKnownQualityParameter { 64 get { return BestKnownQualityParameter; } 65 } 66 public OptionalValueParameter<IScope> BestKnownSolutionParameter { 67 get { return (OptionalValueParameter<IScope>)Parameters["BestKnownSolution"]; } 68 } 31 69 #endregion 32 70 33 71 public ExternalEvaluationProblem() 34 72 : base() { 73 ExternalEvaluator evaluator = new ExternalEvaluator(); 74 EmptyOperator solutionCreator = new EmptyOperator(); 75 35 76 Parameters.Add(new ValueParameter<IExternalEvaluationDriver>("Driver", "The communication driver that is used to exchange data with the external process.")); 77 Parameters.Add(new ValueParameter<IExternalEvaluationProblemEvaluator>("Evaluator", "The evaluator that collects the values to exchange.", evaluator)); 78 Parameters.Add(new ValueParameter<IOperator>("SolutionCreator", "An operator to create the solution components.", solutionCreator)); 36 79 } 37 80 } -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj
r3852 r3859 68 68 <RequiredTargetFramework>3.5</RequiredTargetFramework> 69 69 </Reference> 70 <Reference Include="System.Drawing" /> 70 71 <Reference Include="System.Xml.Linq"> 71 72 <RequiredTargetFramework>3.5</RequiredTargetFramework> … … 78 79 </ItemGroup> 79 80 <ItemGroup> 81 <Compile Include="Drivers\ExternalEvaluationDriver.cs" /> 82 <Compile Include="Drivers\ExternalEvaluationProcessDriver.cs" /> 83 <Compile Include="Drivers\ExternalEvaluationStreamDriver.cs" /> 80 84 <Compile Include="ExternalEvaluationProblem.cs" /> 85 <Compile Include="ExternalEvaluator.cs" /> 81 86 <Compile Include="HeuristicLabProblemsExternalEvaluationPlugin.cs" /> 82 87 <Compile Include="Interfaces\IExternalEvaluationDriver.cs" /> 88 <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" /> 83 89 <Compile Include="Properties\AssemblyInfo.cs" /> 90 <Compile Include="Protos\ExternalEvaluationMessages.cs" /> 91 <Compile Include="SolutionMessageBuilding.cs" /> 92 <None Include="Protos\ProcessProtos.cmd" /> 84 93 </ItemGroup> 85 94 <ItemGroup> … … 88 97 <Name>HeuristicLab.Collections-3.3</Name> 89 98 </ProjectReference> 99 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 100 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 101 <Name>HeuristicLab.Common.Resources-3.3</Name> 102 </ProjectReference> 103 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 104 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> 105 <Name>HeuristicLab.Common-3.3</Name> 106 </ProjectReference> 90 107 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 91 108 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> 92 109 <Name>HeuristicLab.Core-3.3</Name> 110 </ProjectReference> 111 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 112 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 113 <Name>HeuristicLab.Data-3.3</Name> 114 </ProjectReference> 115 <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.ProtobufCS\0.9.1\HeuristicLab.ProtobufCS\HeuristicLab.ProtobufCS-0.9.1.csproj"> 116 <Project>{236459CE-80CF-4991-972F-DE74C826BCCC}</Project> 117 <Name>HeuristicLab.ProtobufCS-0.9.1 %28HeuristicLab.ExtLibs\HeuristicLab.ProtobufCS\HeuristicLab.ProtobufCS-0.9.1\HeuristicLab.ProtobufCS-0.9.1%29</Name> 118 </ProjectReference> 119 <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.ProtobufCS\0.9.1\ProtobufCS\src\ProtocolBuffers\ProtocolBuffers.csproj"> 120 <Project>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</Project> 121 <Name>ProtocolBuffers</Name> 122 </ProjectReference> 123 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 124 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 125 <Name>HeuristicLab.Operators-3.3</Name> 126 </ProjectReference> 127 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 128 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 129 <Name>HeuristicLab.Optimization-3.3</Name> 93 130 </ProjectReference> 94 131 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> … … 116 153 </Target> 117 154 --> 155 <PropertyGroup> 156 <PreBuildEvent>set ProjectDir=$(ProjectDir) 157 set SolutionDir=$(SolutionDir) 158 call "$(ProjectDir)"Protos\ProcessProtos.cmd</PreBuildEvent> 159 </PropertyGroup> 118 160 </Project> -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLabProblemsExternalEvaluationPlugin.cs
r3857 r3859 25 25 [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3.3.0.3832")] 26 26 [PluginFile("HeuristicLab.Problems.ExternalEvaluation-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 [PluginDependency("HeuristicLab.Common", "3.3")] 29 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 30 [PluginDependency("HeuristicLab.Core", "3.3")] 31 [PluginDependency("HeuristicLab.Data", "3.3")] 32 [PluginDependency("HeuristicLab.Operators", "3.3")] 33 [PluginDependency("HeuristicLab.Optimization", "3.3")] 34 [PluginDependency("HeuristicLab.Parameters", "3.3")] 27 35 [PluginDependency("HeuristicLab.Persistence", "3.3")] 28 [PluginDependency("HeuristicLab.Core", "3.3")]29 [PluginDependency("HeuristicLab.Collections", "3.3")]30 [PluginDependency("HeuristicLab.Parameters", "3.3")]31 36 [PluginDependency("HeuristicLab.ProtobufCS", "0.9.1")] 32 37 public class HeuristicLabProblemsExternalEvaluationPlugin : PluginBase { -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Interfaces/IExternalEvaluationDriver.cs
r3852 r3859 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Core; 24 using Google.ProtocolBuffers; 25 using Google.ProtocolBuffers.Descriptors; 23 26 24 27 namespace HeuristicLab.Problems.ExternalEvaluation { … … 33 36 /// <remarks> 34 37 /// Must be called before calling <seealso cref="Send"/> or <seealso cref="Receive"/>. 35 /// The concrete implementation of the driver may require additional information on how to start a connection. 38 /// The concrete implementation of the driver may require additional information on how to start a connection, 39 /// which should be passed into the concrete driver's constructor. 36 40 /// </remarks> 37 41 void Start(); 38 42 /// <summary> 39 /// Tells the driver to send a particular message.43 /// Evaluates a given solution in a blocking manner. 40 44 /// </summary> 41 /// <param name="msg">The message that should be transmitted.</param> 42 /// <remarks> 43 /// This call is non-blocking, the message need not be received synchronously. 44 /// </remarks> 45 void Send(MainMessage msg); 45 /// <param name="solution">The solution message that should be evaluated.</param> 46 /// <returns>The resulting quality message from the external process.</returns> 47 QualityMessage Evaluate(SolutionMessage solution); 46 48 /// <summary> 47 /// Tells the driver to receive the next message.49 /// Evaluates a given solution in a non-blocking manner. 48 50 /// </summary> 49 /// <exception cref="ConnectionTerminatedException">Thrown when the other client sent a message saying it will end the connection. In this case <see cref="Stop"/> is called automatically.</exception> 50 /// <exception cref="NotSupportedException">Thrown when there is no notion of a "next" message for a given driver.</exception> 51 /// <returns>The message that was received or null if no message is present.</returns> 52 /// <remarks> 53 /// This call is non-blocking and returns null if no message is present. 54 /// </remarks> 55 MainMessage Receive(); 56 /// <summary> 57 /// Tells the driver to receive the next message of the type given in the parameter. 58 /// </summary> 59 /// <exception cref="NotSupportedException">Some implementations may not support receiving a specific message.</exception> 60 /// <returns>The message that was received.</returns> 61 /// <remarks> 62 /// This call is non-blocking and returns null if no message is present. 63 /// </remarks> 64 /// <param name="messageDescriptor">The fullname of the descriptor for the message type to receive.</param> 65 MainMessage Receive(MainMessage message); 51 /// <param name="solution">The solution message that should be evaluated.</param> 52 /// <param name="callback">The callback method that is invoked when evaluation is finished.</param> 53 void EvaluateAsync(SolutionMessage solution, Action<QualityMessage> callback); 66 54 /// <summary> 67 55 /// Tells the driver to stop and terminate open connections. -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto
r3857 r3859 2 2 option java_package = "com.heuristiclab.problems.externalevaluation"; 3 3 4 message MainMessage { 4 message SolutionMessage { 5 required int32 solutionId = 1; 6 5 7 message IntegerVariable { 6 8 required string name = 1; 7 9 optional int32 data = 2; 8 10 } 9 repeated IntegerVariable integerVars = 1;11 repeated IntegerVariable integerVars = 2; 10 12 11 13 message IntegerArrayVariable { 12 14 required string name = 1; 13 repeated int32 data = 2 [packed = true];15 repeated int32 data = 2; 14 16 } 15 repeated IntegerArrayVariable integerArrayVars = 2;17 repeated IntegerArrayVariable integerArrayVars = 3; 16 18 17 19 message DoubleVariable { … … 19 21 optional double data = 2; 20 22 } 21 repeated DoubleVariable doubleVars = 3;23 repeated DoubleVariable doubleVars = 4; 22 24 23 25 message DoubleArrayVariable { … … 25 27 repeated double data = 2; 26 28 } 27 repeated DoubleArrayVariable doubleArrayVars = 4;29 repeated DoubleArrayVariable doubleArrayVars = 5; 28 30 29 31 message BoolVariable { … … 31 33 optional bool data = 2; 32 34 } 33 repeated BoolVariable boolVars = 5;35 repeated BoolVariable boolVars = 6; 34 36 35 37 message BoolArrayVariable { … … 37 39 repeated bool data = 2; 38 40 } 39 repeated BoolArrayVariable boolArrayVars = 6;41 repeated BoolArrayVariable boolArrayVars = 7; 40 42 41 43 message StringVariable { … … 43 45 optional string data = 2; 44 46 } 45 repeated StringVariable stringVars = 7;47 repeated StringVariable stringVars = 8; 46 48 47 49 message StringArrayVariable { … … 49 51 repeated string data = 2; 50 52 } 51 repeated StringArrayVariable stringArrayVars = 8;53 repeated StringArrayVariable stringArrayVars = 9; 52 54 53 55 message RawVariable { … … 55 57 optional bytes data = 2; 56 58 } 57 repeated RawVariable rawVars = 9;59 repeated RawVariable rawVars = 10; 58 60 } 59 61 62 message QualityMessage { 63 required int32 solutionId = 1; 64 required double quality = 2; 65 } 66 60 67 service ExchangeService { 61 rpc E xchange (MainMessage) returns (MainMessage);68 rpc EvaluateSingleObjectively (SolutionMessage) returns (QualityMessage); 62 69 }
Note: See TracChangeset
for help on using the changeset viewer.