Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/03/14 01:15:46 (10 years ago)
Author:
swagner
Message:

#2205: Worked on optimization networks

Location:
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj

    r11519 r11520  
    109109    <Compile Include="### obsolete\ServiceParameterCollection.cs" />
    110110    <Compile Include="IHookOperator.cs" />
     111    <Compile Include="Nodes\KSPTSPNetwork.cs" />
    111112    <Compile Include="Nodes\KSPTSPConnector.cs" />
    112113    <Compile Include="Nodes\GenericNode.cs" />
     
    163164  </ItemGroup>
    164165  <ItemGroup>
     166    <ProjectReference Include="..\..\HeuristicLab.Algorithms.GeneticAlgorithm\3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj">
     167      <Project>{a51da44f-cb35-4f6f-99f5-2a2e904ab93b}</Project>
     168      <Name>HeuristicLab.Algorithms.GeneticAlgorithm-3.3</Name>
     169    </ProjectReference>
    165170    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    166171      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
     
    198203      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
    199204      <Name>HeuristicLab.Optimization-3.3</Name>
     205    </ProjectReference>
     206    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
     207      <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project>
     208      <Name>HeuristicLab.Parameters-3.3</Name>
    200209    </ProjectReference>
    201210    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     
    207216      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    208217      <Private>False</Private>
     218    </ProjectReference>
     219    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     220      <Project>{3540e29e-4793-49e7-8ee2-fea7f61c3994}</Project>
     221      <Name>HeuristicLab.Problems.Instances-3.3</Name>
     222    </ProjectReference>
     223    <ProjectReference Include="..\..\HeuristicLab.Problems.Knapsack\3.3\HeuristicLab.Problems.Knapsack-3.3.csproj">
     224      <Project>{e10f395f-c8a6-48ad-b470-9aa7a1f43809}</Project>
     225      <Name>HeuristicLab.Problems.Knapsack-3.3</Name>
     226    </ProjectReference>
     227    <ProjectReference Include="..\..\HeuristicLab.Problems.TravelingSalesman\3.3\HeuristicLab.Problems.TravelingSalesman-3.3.csproj">
     228      <Project>{d767c38d-8014-46b0-9a32-03a3aecce34a}</Project>
     229      <Name>HeuristicLab.Problems.TravelingSalesman-3.3</Name>
    209230    </ProjectReference>
    210231  </ItemGroup>
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Nodes/KSPTSPConnector.cs

    r11519 r11520  
    2525using HeuristicLab.Encodings.BinaryVectorEncoding;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Problems.TravelingSalesman;
    2728using System.Linq;
    2829
     
    3334    [StorableConstructor]
    3435    protected KSPTSPConnector(bool deserializing) : base(deserializing) { }
    35     protected KSPTSPConnector(KSPTSPConnector original, Cloner cloner) : base(original, cloner) { }
     36    protected KSPTSPConnector(KSPTSPConnector original, Cloner cloner)
     37      : base(original, cloner) {
     38      RegisterEvents();
     39    }
    3640    public KSPTSPConnector()
    3741      : base("KSPTSPConnector") {
    3842      Initialize();
     43      RegisterEvents();
    3944    }
    4045    public KSPTSPConnector(string name)
    4146      : base(name) {
    4247      Initialize();
     48      RegisterEvents();
    4349    }
    4450    public KSPTSPConnector(string name, string description)
    4551      : base(name, description) {
    4652      Initialize();
     53      RegisterEvents();
     54    }
     55
     56    [StorableHook(HookType.AfterDeserialization)]
     57    private void AfterDeserialization() {
     58      RegisterEvents();
    4759    }
    4860
     
    6274      ksp.Parameters.Add(new PortParameter<DoubleValue>("Quality") { Type = PortParameterType.Input | PortParameterType.Output });
    6375      ksp.Parameters.Add(new PortParameter<DoubleValue>("TransportCosts") { Type = PortParameterType.Output });
    64       ksp.MessageReceived += Knapsack_MessageReceived;
     76      ksp.Parameters.Add(new PortParameter<PathTSPTour>("Route") { Type = PortParameterType.Output });
    6577
    6678      var tsp = new GenericPort("TSP Connector");
    6779      Ports.Add(tsp);
    6880      tsp.Parameters.Add(new PortParameter<DoubleMatrix>("Coordinates") { Type = PortParameterType.Output });
    69       ksp.Parameters.Add(new PortParameter<DoubleValue>("BestQuality") { Type = PortParameterType.Input });
     81      tsp.Parameters.Add(new PortParameter<PathTSPTour>("Best TSP Solution") { Type = PortParameterType.Input });
     82      tsp.Parameters.Add(new PortParameter<DoubleValue>("BestQuality") { Type = PortParameterType.Input });
     83    }
     84
     85    protected virtual void RegisterEvents() {
     86      var ksp = (IGenericPort)Ports["KSP Connector"];
     87      ksp.MessageReceived += Knapsack_MessageReceived;
    7088    }
    7189
     
    97115      tspMsg["Coordinates"] = coords;
    98116      tspConnectorPort.SendMessage(tspMsg, e.Value2);
     117      var tspSolution = (PathTSPTour)tspMsg["Best TSP Solution"];
    99118      var tspQuality = ((DoubleValue)tspMsg["BestQuality"]).Value;
    100119
     
    102121      ((DoubleValue)kspMsg["Quality"]).Value = kspQuality - factor * tspQuality;
    103122      kspMsg["TransportCosts"] = new DoubleValue(factor * tspQuality);
     123      kspMsg["Route"] = tspSolution;
    104124    }
    105125  }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Plugin.cs.frame

    r11519 r11520  
    2828  [Plugin("HeuristicLab.Optimization.Networks", "3.3.11.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Optimization.Networks-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Algorithms.GeneticAlgorithm", "3.3")]
    3031  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3132  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3738  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3839  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     40  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3941  [PluginDependency("HeuristicLab.Persistence", "3.3")]
     42  [PluginDependency("HeuristicLab.Problems.Knapsack", "3.3")]
     43  [PluginDependency("HeuristicLab.Problems.TravelingSalesman", "3.3")]
    4044  public class HeuristicLabOptimizationNetworksPlugin : PluginBase {
    4145  }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Ports/GenericPort.cs

    r11519 r11520  
    180180        message.Values.AddRange(
    181181          ConnectedPort.Parameters.
    182           Where(p => p.Type.HasFlag(PortParameterType.Output)).
     182          Where(p => p.Type.HasFlag(PortParameterType.Output) && !message.Values.ContainsKey(p.Name)).
    183183          Select(p => p.CreateMessageValue())
    184184        );
Note: See TracChangeset for help on using the changeset viewer.