Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3859 for trunk


Ignore:
Timestamp:
05/26/10 15:18:42 (15 years ago)
Author:
abeham
Message:

#866

  • Updated external evaluation problem
  • Added some Drivers
  • Updated message
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  
    2323using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2424using HeuristicLab.Parameters;
     25using System.Drawing;
     26using HeuristicLab.Optimization;
     27using HeuristicLab.Data;
     28using HeuristicLab.Operators;
    2529
    2630namespace HeuristicLab.Problems.ExternalEvaluation {
    2731  [Item("External Evaluation Problem", "A problem that is evaluated in a different process.")]
    2832  [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
    3038    #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    }
    3169    #endregion
    3270
    3371    public ExternalEvaluationProblem()
    3472      : base() {
     73      ExternalEvaluator evaluator = new ExternalEvaluator();
     74      EmptyOperator solutionCreator = new EmptyOperator();
     75
    3576      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));
    3679    }
    3780  }
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLab.Problems.ExternalEvaluation-3.3.csproj

    r3852 r3859  
    6868      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    6969    </Reference>
     70    <Reference Include="System.Drawing" />
    7071    <Reference Include="System.Xml.Linq">
    7172      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     
    7879  </ItemGroup>
    7980  <ItemGroup>
     81    <Compile Include="Drivers\ExternalEvaluationDriver.cs" />
     82    <Compile Include="Drivers\ExternalEvaluationProcessDriver.cs" />
     83    <Compile Include="Drivers\ExternalEvaluationStreamDriver.cs" />
    8084    <Compile Include="ExternalEvaluationProblem.cs" />
     85    <Compile Include="ExternalEvaluator.cs" />
    8186    <Compile Include="HeuristicLabProblemsExternalEvaluationPlugin.cs" />
    8287    <Compile Include="Interfaces\IExternalEvaluationDriver.cs" />
     88    <Compile Include="Interfaces\IExternalEvaluationProblemEvaluator.cs" />
    8389    <Compile Include="Properties\AssemblyInfo.cs" />
     90    <Compile Include="Protos\ExternalEvaluationMessages.cs" />
     91    <Compile Include="SolutionMessageBuilding.cs" />
     92    <None Include="Protos\ProcessProtos.cmd" />
    8493  </ItemGroup>
    8594  <ItemGroup>
     
    8897      <Name>HeuristicLab.Collections-3.3</Name>
    8998    </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>
    90107    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    91108      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
    92109      <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>
    93130    </ProjectReference>
    94131    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
     
    116153  </Target>
    117154  -->
     155  <PropertyGroup>
     156    <PreBuildEvent>set ProjectDir=$(ProjectDir)
     157set SolutionDir=$(SolutionDir)
     158call "$(ProjectDir)"Protos\ProcessProtos.cmd</PreBuildEvent>
     159  </PropertyGroup>
    118160</Project>
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/HeuristicLabProblemsExternalEvaluationPlugin.cs

    r3857 r3859  
    2525  [Plugin("HeuristicLab.Problems.ExternalEvaluation", "3.3.0.3832")]
    2626  [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")]
    2735  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    28   [PluginDependency("HeuristicLab.Core", "3.3")]
    29   [PluginDependency("HeuristicLab.Collections", "3.3")]
    30   [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3136  [PluginDependency("HeuristicLab.ProtobufCS", "0.9.1")]
    3237  public class HeuristicLabProblemsExternalEvaluationPlugin : PluginBase {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Interfaces/IExternalEvaluationDriver.cs

    r3852 r3859  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Core;
     24using Google.ProtocolBuffers;
     25using Google.ProtocolBuffers.Descriptors;
    2326
    2427namespace HeuristicLab.Problems.ExternalEvaluation {
     
    3336    /// <remarks>
    3437    /// 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.
    3640    /// </remarks>
    3741    void Start();
    3842    /// <summary>
    39     /// Tells the driver to send a particular message.
     43    /// Evaluates a given solution in a blocking manner.
    4044    /// </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);
    4648    /// <summary>
    47     /// Tells the driver to receive the next message.
     49    /// Evaluates a given solution in a non-blocking manner.
    4850    /// </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);
    6654    /// <summary>
    6755    /// Tells the driver to stop and terminate open connections.
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Protos/ExternalEvaluationMessages.proto

    r3857 r3859  
    22option java_package = "com.heuristiclab.problems.externalevaluation";
    33
    4 message MainMessage {
     4message SolutionMessage {
     5  required int32 solutionId = 1;
     6 
    57  message IntegerVariable {
    68    required string name = 1;
    79    optional int32 data = 2;
    810  }
    9   repeated IntegerVariable integerVars = 1;
     11  repeated IntegerVariable integerVars = 2;
    1012 
    1113  message IntegerArrayVariable {
    1214    required string name = 1;
    13     repeated int32 data = 2 [packed = true];
     15    repeated int32 data = 2;
    1416  }
    15   repeated IntegerArrayVariable integerArrayVars = 2;
     17  repeated IntegerArrayVariable integerArrayVars = 3;
    1618 
    1719  message DoubleVariable {
     
    1921    optional double data = 2;
    2022  }
    21   repeated DoubleVariable doubleVars = 3;
     23  repeated DoubleVariable doubleVars = 4;
    2224 
    2325  message DoubleArrayVariable {
     
    2527    repeated double data = 2;
    2628  }
    27   repeated DoubleArrayVariable doubleArrayVars = 4;
     29  repeated DoubleArrayVariable doubleArrayVars = 5;
    2830 
    2931  message BoolVariable {
     
    3133    optional bool data = 2;
    3234  }
    33   repeated BoolVariable boolVars = 5;
     35  repeated BoolVariable boolVars = 6;
    3436 
    3537  message BoolArrayVariable {
     
    3739    repeated bool data = 2;
    3840  }
    39   repeated BoolArrayVariable boolArrayVars = 6;
     41  repeated BoolArrayVariable boolArrayVars = 7;
    4042 
    4143  message StringVariable {
     
    4345    optional string data = 2;
    4446  }
    45   repeated StringVariable stringVars = 7;
     47  repeated StringVariable stringVars = 8;
    4648 
    4749  message StringArrayVariable {
     
    4951    repeated string data = 2;
    5052  }
    51   repeated StringArrayVariable stringArrayVars = 8;
     53  repeated StringArrayVariable stringArrayVars = 9;
    5254 
    5355  message RawVariable {
     
    5557    optional bytes data = 2;
    5658  }
    57   repeated RawVariable rawVars = 9;
     59  repeated RawVariable rawVars = 10;
    5860}
    5961
     62message QualityMessage {
     63  required int32 solutionId = 1;
     64  required double quality = 2;
     65}
     66 
    6067service ExchangeService {
    61   rpc Exchange (MainMessage) returns (MainMessage);
     68  rpc EvaluateSingleObjectively (SolutionMessage) returns (QualityMessage);
    6269}
Note: See TracChangeset for help on using the changeset viewer.