Free cookie consent management tool by TermsFeed Policy Generator

Changes in / [20:30]


Ignore:
Location:
/trunk/sources
Files:
32 added
31 deleted
53 edited

Legend:

Unmodified
Added
Removed
  • /trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/HeuristicLab.AdvancedOptimizationFrontend.csproj

    r20 r30  
    9494  <ItemGroup>
    9595    <None Include="HeuristicLab.snk" />
     96    <None Include="Properties\AssemblyInfo.frame" />
    9697  </ItemGroup>
    9798  <ItemGroup>
     
    141142  </Target>
    142143  -->
     144  <PropertyGroup>
     145    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     146  </PropertyGroup>
    143147</Project>
  • /trunk/sources/HeuristicLab.BitVector/HeuristicLab.BitVector.csproj

    r20 r30  
    6868  <ItemGroup>
    6969    <None Include="HeuristicLab.snk" />
     70    <None Include="Properties\AssemblyInfo.frame" />
    7071  </ItemGroup>
    7172  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     
    7778  </Target>
    7879  -->
     80  <PropertyGroup>
     81    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     82  </PropertyGroup>
    7983</Project>
  • /trunk/sources/HeuristicLab.Charting.Data/HeuristicLab.Charting.Data.csproj

    r20 r30  
    33    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    44    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    5     <ProductVersion>8.0.50727</ProductVersion>
     5    <ProductVersion>9.0.21022</ProductVersion>
    66    <SchemaVersion>2.0</SchemaVersion>
    77    <ProjectGuid>{E0740131-AA3E-4A3F-BA03-C9FF8327F4EE}</ProjectGuid>
     
    6969  <ItemGroup>
    7070    <None Include="HeuristicLab.snk" />
     71    <None Include="Properties\AssemblyInfo.frame" />
    7172  </ItemGroup>
    7273  <ItemGroup>
     
    8485  </Target>
    8586  -->
     87  <PropertyGroup>
     88    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     89  </PropertyGroup>
    8690</Project>
  • /trunk/sources/HeuristicLab.Charting/HeuristicLab.Charting.csproj

    r20 r30  
    33    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    44    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    5     <ProductVersion>8.0.50727</ProductVersion>
     5    <ProductVersion>9.0.21022</ProductVersion>
    66    <SchemaVersion>2.0</SchemaVersion>
    77    <ProjectGuid>{B462D3CC-8866-42F0-9832-AD0967613B72}</ProjectGuid>
     
    9696    <None Include="ClassDiagram.cd" />
    9797    <None Include="HeuristicLab.snk" />
     98    <None Include="Properties\AssemblyInfo.frame" />
    9899  </ItemGroup>
    99100  <ItemGroup>
     
    111112  </Target>
    112113  -->
     114  <PropertyGroup>
     115    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     116  </PropertyGroup>
    113117</Project>
  • /trunk/sources/HeuristicLab.Constraints/HeuristicLab.Constraints.csproj

    r20 r30  
    154154  <ItemGroup>
    155155    <None Include="HeuristicLab.snk" />
     156    <None Include="Properties\AssemblyInfo.frame" />
    156157  </ItemGroup>
    157158  <ItemGroup>
     
    212213  </Target>
    213214  -->
     215  <PropertyGroup>
     216    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     217  </PropertyGroup>
    214218</Project>
  • /trunk/sources/HeuristicLab.Core/HeuristicLab.Core.csproj

    r20 r30  
    229229  <ItemGroup>
    230230    <None Include="HeuristicLab.snk" />
     231    <None Include="Properties\AssemblyInfo.frame" />
    231232  </ItemGroup>
    232233  <ItemGroup>
     
    342343  </Target>
    343344  -->
     345  <PropertyGroup>
     346    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     347  </PropertyGroup>
    344348</Project>
  • /trunk/sources/HeuristicLab.Core/PersistenceManager.cs

    r20 r30  
    6262    }
    6363    public static void Save(IStorable instance, string filename) {
    64       Save(instance, File.OpenWrite(filename));
     64      FileStream stream = File.Create(filename);
     65      Save(instance, stream);
     66      stream.Close();
    6567    }
    6668    public static void Save(IStorable instance, Stream stream) {
     
    7072    }
    7173    public static IStorable Load(string filename) {
    72       return Load(File.OpenRead(filename));
     74      FileStream stream = File.OpenRead(filename);
     75      IStorable storable = Load(stream);
     76      stream.Close();
     77      return storable;
    7378    }
    7479    public static IStorable Load(Stream stream) {
  • /trunk/sources/HeuristicLab.Data/HeuristicLab.Data.csproj

    r20 r30  
    193193  <ItemGroup>
    194194    <None Include="HeuristicLab.snk" />
     195    <None Include="Properties\AssemblyInfo.frame" />
    195196  </ItemGroup>
    196197  <ItemGroup>
     
    260261  </Target>
    261262  -->
     263  <PropertyGroup>
     264    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     265  </PropertyGroup>
    262266</Project>
  • /trunk/sources/HeuristicLab.DataAnalysis/HeuristicLab.DataAnalysis.csproj

    r20 r30  
    8080  <ItemGroup>
    8181    <None Include="HeuristicLab.snk" />
     82    <None Include="Properties\AssemblyInfo.frame" />
    8283  </ItemGroup>
    8384  <ItemGroup>
     
    9596  </Target>
    9697  -->
     98  <PropertyGroup>
     99    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     100  </PropertyGroup>
    97101</Project>
  • /trunk/sources/HeuristicLab.DistributedEngine/DistributedEngine.cs

    r20 r30  
    7171      binding.ReaderQuotas.MaxStringContentLength = 100000000; // also 100M chars
    7272      binding.ReaderQuotas.MaxArrayLength = 100000000; // also 100M elements;
     73      binding.Security.Mode = SecurityMode.None;
    7374      ChannelFactory<IGridServer> factory = new ChannelFactory<IGridServer>(binding);
    7475      server = factory.CreateChannel(new EndpointAddress(serverAddress));
  • /trunk/sources/HeuristicLab.DistributedEngine/HeuristicLab.DistributedEngine.csproj

    r20 r30  
    7272      <Name>HeuristicLab.PluginInfrastructure</Name>
    7373    </ProjectReference>
    74     <ProjectReference Include="..\HeuristicLab.ThreadParallelEngine\HeuristicLab.ThreadParallelEngine.csproj">
    75       <Project>{6E757D0E-20F9-4E89-AF06-D7DA256870DB}</Project>
    76       <Name>HeuristicLab.ThreadParallelEngine</Name>
    77     </ProjectReference>
    7874  </ItemGroup>
    7975  <ItemGroup>
     
    8278      <SubType>Designer</SubType>
    8379    </EmbeddedResource>
     80  </ItemGroup>
     81  <ItemGroup>
     82    <None Include="Properties\AssemblyInfo.frame" />
    8483  </ItemGroup>
    8584  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     
    9190  </Target>
    9291  -->
     92  <PropertyGroup>
     93    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     94  </PropertyGroup>
    9395</Project>
  • /trunk/sources/HeuristicLab.DistributedEngine/HeuristicLabDistributedEnginePlugin.cs

    r20 r30  
    3030  [Dependency(Dependency = "HeuristicLab.Core")]
    3131  [Dependency(Dependency = "HeuristicLab.Grid")]
    32   [Dependency(Dependency = "HeuristicLab.ThreadParallelEngine")]
    3332  public class HeuristicLabDistributedEnginePlugin : PluginBase {
    3433  }
  • /trunk/sources/HeuristicLab.Evolutionary/HeuristicLab.Evolutionary.csproj

    r20 r30  
    5353  <ItemGroup>
    5454    <None Include="HeuristicLab.snk" />
     55    <None Include="Properties\AssemblyInfo.frame" />
    5556  </ItemGroup>
    5657  <ItemGroup>
     
    8081  </Target>
    8182  -->
     83  <PropertyGroup>
     84    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     85  </PropertyGroup>
    8286</Project>
  • /trunk/sources/HeuristicLab.Functions/HeuristicLab.Functions.csproj

    r20 r30  
    106106  <ItemGroup>
    107107    <None Include="HeuristicLab.snk" />
     108    <None Include="Properties\AssemblyInfo.frame" />
    108109  </ItemGroup>
    109110  <ItemGroup>
     
    121122  </Target>
    122123  -->
     124  <PropertyGroup>
     125    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     126  </PropertyGroup>
    123127</Project>
  • /trunk/sources/HeuristicLab.Grid/ClientForm.cs

    r20 r30  
    5656        binding.ReaderQuotas.MaxStringContentLength = 100000000; // also 100M chars
    5757        binding.ReaderQuotas.MaxArrayLength = 100000000; // also 100M elements;
     58        binding.Security.Mode = SecurityMode.None;       
    5859        factory = new ChannelFactory<IEngineStore>(binding);
    5960        engineStore = factory.CreateChannel(new EndpointAddress(addressTextBox.Text));
  • /trunk/sources/HeuristicLab.Grid/HeuristicLab.Grid.csproj

    r20 r30  
    8383      <Name>HeuristicLab.PluginInfrastructure</Name>
    8484    </ProjectReference>
    85     <ProjectReference Include="..\HeuristicLab.ThreadParallelEngine\HeuristicLab.ThreadParallelEngine.csproj">
    86       <Project>{6E757D0E-20F9-4E89-AF06-D7DA256870DB}</Project>
    87       <Name>HeuristicLab.ThreadParallelEngine</Name>
    88     </ProjectReference>
    8985  </ItemGroup>
    9086  <ItemGroup>
     
    9894    </EmbeddedResource>
    9995  </ItemGroup>
     96  <ItemGroup>
     97    <None Include="Properties\AssemblyInfo.frame" />
     98  </ItemGroup>
    10099  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    101100  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
     
    106105  </Target>
    107106  -->
     107  <PropertyGroup>
     108    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     109  </PropertyGroup>
    108110</Project>
  • /trunk/sources/HeuristicLab.Grid/HeuristicLabGridPlugin.cs

    r20 r30  
    3030  [PluginFile(Filename = "HeuristicLab.Grid.dll", Filetype = PluginFileType.Assembly)]
    3131  [Dependency(Dependency = "HeuristicLab.Core")]
    32   [Dependency(Dependency = "HeuristicLab.ThreadParallelEngine")]
    3332  public class HeuristicLabGridPlugin : PluginBase {
    3433  }
  • /trunk/sources/HeuristicLab.Grid/ProcessingEngine.cs

    r20 r30  
    2626using HeuristicLab.Core;
    2727using System.Xml;
     28using System.Threading;
    2829
    2930namespace HeuristicLab.Grid {
    30   public class ProcessingEngine : ThreadParallelEngine.ThreadParallelEngine {
    31 
     31  public class ProcessingEngine : EngineBase {
    3232    private AtomicOperation initialOperation;
    3333    public AtomicOperation InitialOperation {
     
    5656      initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects);
    5757    }
     58
     59    protected override void ProcessNextOperation() {
     60      IOperation operation = myExecutionStack.Pop();
     61      if(operation is AtomicOperation) {
     62        AtomicOperation atomicOperation = (AtomicOperation)operation;
     63        IOperation next = null;
     64        try {
     65          next = atomicOperation.Operator.Execute(atomicOperation.Scope);
     66        } catch(Exception ex) {
     67          // push operation on stack again
     68          myExecutionStack.Push(atomicOperation);
     69          Abort();
     70          ThreadPool.QueueUserWorkItem(delegate(object state) { OnExceptionOccurred(ex); });
     71        }
     72        if(next != null)
     73          myExecutionStack.Push(next);
     74        OnOperationExecuted(atomicOperation);
     75        if(atomicOperation.Operator.Breakpoint) Abort();
     76      } else if(operation is CompositeOperation) {
     77        CompositeOperation compositeOperation = (CompositeOperation)operation;
     78        for(int i = compositeOperation.Operations.Count - 1; i >= 0; i--)
     79          myExecutionStack.Push(compositeOperation.Operations[i]);
     80      }
     81    }
    5882  }
    5983}
  • /trunk/sources/HeuristicLab.Grid/ServerForm.cs

    r20 r30  
    5858        binding.ReaderQuotas.MaxStringContentLength = 100000000; // also 100M chars
    5959        binding.ReaderQuotas.MaxArrayLength = 100000000; // also 100M elements;
     60        binding.Security.Mode = SecurityMode.None;
    6061
    6162        externalHost.AddServiceEndpoint(typeof(IGridServer), binding, externalAddressTextBox.Text);
  • /trunk/sources/HeuristicLab.Logging/HeuristicLab.Logging.csproj

    r20 r30  
    6767  <ItemGroup>
    6868    <None Include="HeuristicLab.snk" />
     69    <None Include="Properties\AssemblyInfo.frame" />
    6970  </ItemGroup>
    7071  <ItemGroup>
     
    112113  </Target>
    113114  -->
     115  <PropertyGroup>
     116    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     117  </PropertyGroup>
    114118</Project>
  • /trunk/sources/HeuristicLab.Operators.Programmable/HeuristicLab.Operators.Programmable.csproj

    r20 r30  
    6262  <ItemGroup>
    6363    <None Include="HeuristicLab.snk" />
     64    <None Include="Properties\AssemblyInfo.frame" />
    6465  </ItemGroup>
    6566  <ItemGroup>
     
    9596  </Target>
    9697  -->
     98  <PropertyGroup>
     99    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     100  </PropertyGroup>
    97101</Project>
  • /trunk/sources/HeuristicLab.Operators/HeuristicLab.Operators.csproj

    r20 r30  
    109109  <ItemGroup>
    110110    <None Include="HeuristicLab.snk" />
     111    <None Include="Properties\AssemblyInfo.frame" />
    111112  </ItemGroup>
    112113  <ItemGroup>
     
    124125  </Target>
    125126  -->
     127  <PropertyGroup>
     128    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     129  </PropertyGroup>
    126130</Project>
  • /trunk/sources/HeuristicLab.OptimizationFrontend/HeuristicLab.OptimizationFrontend.csproj

    r20 r30  
    9393  <ItemGroup>
    9494    <None Include="HeuristicLab.snk" />
     95    <None Include="Properties\AssemblyInfo.frame" />
    9596  </ItemGroup>
    9697  <ItemGroup>
     
    138139  </Target>
    139140  -->
     141  <PropertyGroup>
     142    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     143  </PropertyGroup>
    140144</Project>
  • /trunk/sources/HeuristicLab.Permutation/HeuristicLab.Permutation.csproj

    r20 r30  
    8484  <ItemGroup>
    8585    <None Include="HeuristicLab.snk" />
     86    <None Include="Properties\AssemblyInfo.frame" />
    8687  </ItemGroup>
    8788  <ItemGroup>
     
    111112  </Target>
    112113  -->
     114  <PropertyGroup>
     115    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     116  </PropertyGroup>
    113117</Project>
  • /trunk/sources/HeuristicLab.PluginInfrastructure.GUI/HeuristicLab.PluginInfrastructure.GUI.csproj

    r20 r30  
    139139  <ItemGroup>
    140140    <None Include="HeuristicLab.snk" />
     141    <None Include="Properties\AssemblyInfo.frame" />
    141142    <None Include="Resources\HeuristicLab.ico" />
    142143  </ItemGroup>
     
    153154  </Target>
    154155  -->
     156  <PropertyGroup>
     157    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     158  </PropertyGroup>
    155159</Project>
  • /trunk/sources/HeuristicLab.PluginInfrastructure.GUI/ManagerForm.cs

    r20 r30  
    3737    private TreeNode availablePlugins;
    3838    private TreeNode allPlugins;
     39    private TreeNode disabledPlugins;
    3940    private List<PluginTag> allTags = new List<PluginTag>();
    4041    private Dictionary<PluginTag, PluginAction> actions = new Dictionary<PluginTag, PluginAction>();
     
    7576      allPlugins.ImageIndex = 1;
    7677      allPlugins.SelectedImageIndex = 1;
     78      disabledPlugins = new TreeNode("Disabled plugins");
     79      disabledPlugins.ImageIndex = 1;
     80      disabledPlugins.SelectedImageIndex = 1;
    7781
    7882      pluginTreeView.Nodes.Add(installedPlugins);
    7983      pluginTreeView.Nodes.Add(availablePlugins);
     84      pluginTreeView.Nodes.Add(disabledPlugins);
    8085      pluginTreeView.Nodes.Add(allPlugins);
    8186
    82       foreach(PluginInfo pluginInfo in PluginManager.Manager.InstalledPlugins) {
     87      foreach(PluginInfo pluginInfo in PluginManager.Manager.ActivePlugins) {
    8388        // create a new PluginAction tag for the plugin
    8489        PluginTag tag = new PluginTag(allTags, pluginInfo, PluginState.Installed);
     
    9196        installedPlugins.Nodes.Add(installedPluginsNode);
    9297
     98        // add to all "plugins node"
     99        TreeNode allPluginsNode = new TreeNode(pluginInfo.Name);
     100        allPluginsNode.ContextMenuStrip = pluginContextMenuStrip;
     101        allPluginsNode.Tag = tag;
     102        allPluginsNode.ImageIndex = 0;
     103        allPlugins.Nodes.Add(allPluginsNode);
     104      }
     105      foreach(PluginInfo pluginInfo in PluginManager.Manager.DisabledPlugins) {
     106        PluginTag tag = new PluginTag(allTags, pluginInfo, PluginState.Disabled);
     107        allTags.Add(tag);
     108        TreeNode disabledPluginsNode = new TreeNode(pluginInfo.Name);
     109        disabledPluginsNode.ContextMenuStrip = pluginContextMenuStrip;
     110        disabledPluginsNode.Tag = tag;
     111        disabledPluginsNode.ImageIndex = 0;
     112        disabledPlugins.Nodes.Add(disabledPluginsNode);
    93113        // add to all "plugins node"
    94114        TreeNode allPluginsNode = new TreeNode(pluginInfo.Name);
     
    290310      allAvailablePlugins.ForEach(delegate(PluginDescription availablePlugin) {
    291311        List<PluginTag> oldPlugins = allTags.FindAll(delegate(PluginTag currentPlugin) {
    292           return currentPlugin.PluginName == availablePlugin.Name && currentPlugin.State == PluginState.Installed;
     312          return currentPlugin.PluginName == availablePlugin.Name && currentPlugin.State == (PluginState.Installed | PluginState.Disabled);
    293313        });
    294314
     
    567587      publishButton.Enabled = (tag.State & PluginState.Installed) == PluginState.Installed;
    568588      installButton.Enabled = (tag.State & PluginState.Available) == PluginState.Available;
    569       deleteButton.Enabled = (tag.State & (PluginState.Installed | PluginState.Upgradeable)) != 0;
     589      deleteButton.Enabled = (tag.State & (PluginState.Installed | PluginState.Upgradeable | PluginState.Disabled)) != 0;
    570590
    571591      installButton.Checked = GetAction(tag) == ManagerAction.Install;
     
    605625    private List<TreeNode> FindPluginNodes(PluginTag pluginTag) {
    606626      List<TreeNode> nodes = new List<TreeNode>();
    607       foreach(TreeNode rootNode in new TreeNode[] { installedPlugins, availablePlugins, allPlugins }) {
     627      foreach(TreeNode rootNode in new TreeNode[] { installedPlugins, availablePlugins, allPlugins, disabledPlugins }) {
    608628        foreach(TreeNode node in rootNode.Nodes) {
    609629          if(pluginTag.Equals(node.Tag)) {
  • /trunk/sources/HeuristicLab.PluginInfrastructure.GUI/PluginTag.cs

    r20 r30  
    3131    Available = 2,
    3232    Upgradeable = 4,
     33    Disabled = 8,
    3334  };
    3435
     
    218219
    219220    public override int GetHashCode() {
    220       return pluginName.GetHashCode() + pluginVersion.GetHashCode();
     221      if(pluginVersion != null) {
     222        return pluginName.GetHashCode() + pluginVersion.GetHashCode();
     223      } else return pluginName.GetHashCode();
    221224    }
    222225  }
  • /trunk/sources/HeuristicLab.PluginInfrastructure/DiscoveryService.cs

    r20 r30  
    3333    public PluginInfo[] Plugins {
    3434      get {
    35         return PluginManager.Manager.LoadedPlugins;
     35        PluginInfo[] plugins = new PluginInfo[PluginManager.Manager.LoadedPlugins.Count];
     36        PluginManager.Manager.LoadedPlugins.CopyTo(plugins, 0);
     37        return plugins;
    3638      }
    3739    }
  • /trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj

    r20 r30  
    7878    <None Include="app.config" />
    7979    <None Include="HeuristicLab.snk" />
     80    <None Include="Properties\AssemblyInfo.frame" />
    8081    <None Include="Properties\Settings.settings">
    8182      <Generator>SettingsSingleFileGenerator</Generator>
     
    9697  </Target>
    9798  -->
     99  <PropertyGroup>
     100    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     101  </PropertyGroup>
    98102</Project>
  • /trunk/sources/HeuristicLab.PluginInfrastructure/Loader.cs

    r20 r30  
    3333    public delegate void PluginLoadFailedEventHandler(string pluginName, string args);
    3434
    35     private Dictionary<PluginInfo, IPlugin> activePlugins = new Dictionary<PluginInfo, IPlugin>();
     35    private Dictionary<PluginInfo, List<string>> pluginDependencies = new Dictionary<PluginInfo, List<string>>();
     36    private List<PluginInfo> preloadedPluginInfos = new List<PluginInfo>();
     37    private Dictionary<IPlugin, PluginInfo> pluginInfos = new Dictionary<IPlugin, PluginInfo>();
    3638    private Dictionary<PluginInfo, IPlugin> allPlugins = new Dictionary<PluginInfo, IPlugin>();
    37     private Dictionary<IPlugin, PluginInfo> pluginInfos = new Dictionary<IPlugin, PluginInfo>();
    38 
    39     private Dictionary<string, List<string>> pluginDependencies = new Dictionary<string, List<string>>();
    40     private Dictionary<string, List<string>> pluginAssemblies = new Dictionary<string, List<string>>();
    41 
    42     private List<string> loadablePlugins = new List<string>();
     39    private List<PluginInfo> disabledPlugins = new List<PluginInfo>();
    4340    private string pluginDir = Application.StartupPath + "/" + HeuristicLab.PluginInfrastructure.Properties.Settings.Default.PluginDir;
    4441
    4542    internal event PluginLoadFailedEventHandler MissingPluginFile;
    46 
    4743    internal event PluginManagerActionEventHandler PluginAction;
    4844
    49     internal PluginInfo[] ActivePlugins {
     45    internal ICollection<PluginInfo> ActivePlugins {
    5046      get {
    51         PluginInfo[] plugins = new PluginInfo[activePlugins.Count];
    52         activePlugins.Keys.CopyTo(plugins, 0);
    53         return plugins;
    54       }
    55     }
    56 
    57     internal List<PluginInfo> InstalledPlugins {
     47        List<PluginInfo> list = new List<PluginInfo>();
     48        foreach(PluginInfo info in allPlugins.Keys) {
     49          if(!disabledPlugins.Exists(delegate(PluginInfo disabledInfo) { return info.Name == disabledInfo.Name; })) {
     50            list.Add(info);
     51          }
     52        }
     53        return list;
     54      }
     55    }
     56
     57    internal ICollection<PluginInfo> InstalledPlugins {
    5858      get {
    5959        return new List<PluginInfo>(allPlugins.Keys);
     
    6161    }
    6262
    63     private ApplicationInfo[] applications;
    64     internal ApplicationInfo[] InstalledApplications {
     63    internal ICollection<PluginInfo> DisabledPlugins {
     64      get {
     65        return disabledPlugins;
     66      }
     67    }
     68
     69    private ICollection<ApplicationInfo> applications;
     70    internal ICollection<ApplicationInfo> InstalledApplications {
    6571      get {
    6672        return applications;
     
    6975
    7076    private IPlugin FindPlugin(PluginInfo plugin) {
    71       return activePlugins[plugin];
     77      return allPlugins[plugin];
    7278    }
    7379
     
    8591    internal void Init() {
    8692      AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += delegate(object sender, ResolveEventArgs args) { return Assembly.ReflectionOnlyLoad(args.Name); };
    87       activePlugins.Clear();
    8893      allPlugins.Clear();
     94      disabledPlugins.Clear();
    8995      pluginInfos.Clear();
    9096      pluginsByName.Clear();
    91       loadablePlugins.Clear();
    9297      pluginDependencies.Clear();
    93       pluginAssemblies.Clear();
    9498
    9599      List<Assembly> assemblies = ReflectionOnlyLoadDlls();
    96100      CheckAssemblyDependencies(assemblies);
     101      CheckPluginFiles();
     102      CheckPluginDependencies();
    97103      LoadPlugins();
    98       CheckPluginFiles();
    99104
    100105      DiscoveryService service = new DiscoveryService();
    101106      IApplication[] apps = service.GetInstances<IApplication>();
    102       applications = new ApplicationInfo[apps.Length];
    103 
    104       int i = 0;
     107      applications = new List<ApplicationInfo>();
     108
    105109      foreach(IApplication application in apps) {
    106110        ApplicationInfo info = new ApplicationInfo();
     
    111115        info.PluginType = application.GetType().Namespace + "." + application.GetType().Name;
    112116
    113         applications[i++] = info;
     117        applications.Add(info);
    114118      }
    115119    }
     
    129133
    130134    private void CheckAssemblyDependencies(List<Assembly> assemblies) {
    131 
    132135      foreach(Assembly assembly in assemblies) {
    133 
    134136        // GetExportedTypes throws FileNotFoundException when a referenced assembly
    135137        // of the current assembly is missing.
     
    138140
    139141          foreach(Type t in exported) {
    140             // if the type implements IPlugin
     142            // if there is a type that implements IPlugin
    141143            if(Array.Exists<Type>(t.GetInterfaces(), delegate(Type iface) {
    142144              // use AssemblyQualifiedName to compare the types because we can't directly
     
    144146              return iface.AssemblyQualifiedName == typeof(IPlugin).AssemblyQualifiedName;
    145147            })) {
     148              // fetch the attributes of the IPlugin type
    146149              GetPluginAttributeData(t);
    147150            }
    148 
    149151          }
    150152        } catch(FileNotFoundException) {
    151153          // when a referenced assembly cannot be loaded then ignore this assembly in the plugin discovery
    152           // TASK: add the assembly to some kind of unloadable assemblies list
    153           // this list could be displayed to the user for diagnosis         
    154         }
    155       }
    156 
    157       foreach(string pluginName in this.pluginDependencies.Keys) {
    158         CheckPluginDependencies(pluginName);
     154        }
    159155      }
    160156    }
     
    169165      // get all attributes of that type
    170166      IList<CustomAttributeData> attributes = CustomAttributeData.GetCustomAttributes(t);
    171 
    172167      List<string> pluginAssemblies = new List<string>();
    173168      List<string> pluginDependencies = new List<string>();
     169      List<string> pluginFiles = new List<string>();
    174170      string pluginName = "";
    175 
    176       // extract relevant parameters
    177171      // iterate through all custom attributes and search for named arguments that we are interested in
    178172      foreach(CustomAttributeData attributeData in attributes) {
    179173        List<CustomAttributeNamedArgument> namedArguments = new List<CustomAttributeNamedArgument>(attributeData.NamedArguments);
    180 
    181174        // if the current attribute contains a named argument with the name "Name" then extract the plugin name
    182175        CustomAttributeNamedArgument pluginNameArgument = namedArguments.Find(delegate(CustomAttributeNamedArgument arg) {
     
    186179          pluginName = (string)pluginNameArgument.TypedValue.Value;
    187180        }
    188 
    189181        // if the current attribute contains a named argument with the name "Dependency" then extract the dependency
    190182        // and store it in the list of all dependencies
     
    192184          return arg.MemberInfo.Name == "Dependency";
    193185        });
    194 
    195186        if(dependencyNameArgument.MemberInfo != null) {
    196187          pluginDependencies.Add((string)dependencyNameArgument.TypedValue.Value);
    197188        }
    198 
    199189        // if the current attribute has a named argument "Filename" then find if the argument "Filetype" is also supplied
    200190        // and if the filetype is Assembly then store the name of the assembly in the list of assemblies
     
    206196        });
    207197        if(filenameArg.MemberInfo != null && filetypeArg.MemberInfo != null) {
     198          pluginFiles.Add(pluginDir + "/" + (string)filenameArg.TypedValue.Value);
    208199          if((PluginFileType)filetypeArg.TypedValue.Value == PluginFileType.Assembly) {
    209200            pluginAssemblies.Add(pluginDir + "/" + (string)filenameArg.TypedValue.Value);
     
    212203      }
    213204
    214       // make sure that we found reasonable values
     205      // minimal sanity check of the attribute values
    215206      if(pluginName != "" && pluginAssemblies.Count > 0) {
    216         this.pluginDependencies[pluginName] = pluginDependencies;
    217         this.pluginAssemblies[pluginName] = pluginAssemblies;
     207        // create a temporary PluginInfo that contains the attribute values
     208        PluginInfo info = new PluginInfo();
     209        info.Name = pluginName;
     210        info.Assemblies = pluginAssemblies;
     211        info.Files.AddRange(pluginFiles);
     212        info.Assemblies.AddRange(pluginAssemblies);
     213        this.pluginDependencies[info] = pluginDependencies;
     214        preloadedPluginInfos.Add(info);
    218215      } else {
    219216        throw new InvalidPluginException();
     
    221218    }
    222219
     220    private void CheckPluginDependencies() {
     221      foreach(PluginInfo pluginInfo in preloadedPluginInfos) {
     222        // don't need to check plugins that are already disabled
     223        if(disabledPlugins.Contains(pluginInfo)) {
     224          continue;
     225        }
     226        visitedDependencies.Clear();
     227        if(!CheckPluginDependencies(pluginInfo.Name)) {
     228          disabledPlugins.Add(pluginInfo);
     229        }
     230      }
     231    }
     232
     233    private List<string> visitedDependencies = new List<string>();
    223234    private bool CheckPluginDependencies(string pluginName) {
    224       // when we already checked the dependencies of this plugin earlier then just return true
    225       if(loadablePlugins.Contains(pluginName)) {
    226         return true;
    227       } else if(!pluginAssemblies.ContainsKey(pluginName)) {
     235      if(!preloadedPluginInfos.Exists(delegate(PluginInfo info) { return pluginName == info.Name; }) ||
     236        disabledPlugins.Exists(delegate(PluginInfo info) { return pluginName == info.Name; }) ||
     237        visitedDependencies.Contains(pluginName)) {
    228238        // when the plugin is not available return false;
    229239        return false;
     
    231241        // otherwise check if all dependencies of the plugin are OK
    232242        // if yes then this plugin is also ok and we store it in the list of loadable plugins
    233         foreach(string dependency in pluginDependencies[pluginName]) {
     243
     244        PluginInfo matchingInfo = preloadedPluginInfos.Find(delegate(PluginInfo info) { return info.Name == pluginName; });
     245        if(matchingInfo == null) throw new InvalidProgramException(); // shouldn't happen
     246        foreach(string dependency in pluginDependencies[matchingInfo]) {
     247          visitedDependencies.Add(pluginName);
    234248          if(CheckPluginDependencies(dependency) == false) {
    235249            // if only one dependency is not available that means that the current plugin also is unloadable
    236250            return false;
    237251          }
    238         }
    239         // all dependencies OK -> add to loadable list and return true
    240         loadablePlugins.Add(pluginName);
     252          visitedDependencies.Remove(pluginName);
     253        }
     254        // all dependencies OK
    241255        return true;
    242256      }
     
    245259
    246260    private Dictionary<string, IPlugin> pluginsByName = new Dictionary<string, IPlugin>();
    247 
    248261    private void LoadPlugins() {
    249262      // load all loadable plugins (all dependencies available) into the execution context
    250       foreach(string plugin in loadablePlugins) {
    251         {
    252           foreach(string assembly in pluginAssemblies[plugin]) {
     263      foreach(PluginInfo pluginInfo in preloadedPluginInfos) {
     264        if(!disabledPlugins.Contains(pluginInfo)) {
     265          foreach(string assembly in pluginInfo.Assemblies) {
    253266            Assembly.LoadFrom(assembly);
    254267          }
     
    263276          continue;
    264277        Type[] availablePluginTypes = service.GetTypes(typeof(IPlugin), assembly);
    265 
    266 
    267278        foreach(Type pluginType in availablePluginTypes) {
    268279          if(!pluginType.IsAbstract && !pluginType.IsInterface && !pluginType.HasElementType) {
    269280            IPlugin plugin = (IPlugin)Activator.CreateInstance(pluginType);
    270281            PluginAction(this, new PluginManagerActionEventArgs(plugin.Name, PluginManagerAction.InitializingPlugin));
    271 
    272282            pluginsByName.Add(plugin.Name, plugin);
    273             PluginInfo pluginInfo = GetPluginInfo(plugin);
    274 
    275 
    276             allPlugins.Add(pluginInfo, plugin);
    277             PluginAction(this, new PluginManagerActionEventArgs(plugin.Name, PluginManagerAction.InitializedPlugin));
    278           }
    279         }
    280       }
    281     }
    282 
    283 
     283          }
     284        }
     285      }
     286
     287      foreach(IPlugin plugin in pluginsByName.Values) {
     288        PluginInfo pluginInfo = GetPluginInfo(plugin);
     289        allPlugins.Add(pluginInfo, plugin);
     290        PluginAction(this, new PluginManagerActionEventArgs(plugin.Name, PluginManagerAction.InitializedPlugin));
     291      }
     292    }
    284293    private PluginInfo GetPluginInfo(IPlugin plugin) {
    285294      if(pluginInfos.ContainsKey(plugin)) {
    286295        return pluginInfos[plugin];
    287296      }
    288 
    289297      // store the data of the plugin in a description file which can be used without loading the plugin assemblies
    290298      PluginInfo pluginInfo = new PluginInfo();
     
    299307      });
    300308
    301       // each plugin can have multiple assemlies associated
    302       // for each assembly of the plugin find the dependencies
    303       // and get the pluginDescriptions for all dependencies
    304       foreach(string assembly in pluginAssemblies[plugin.Name]) {
     309      PluginInfo preloadedInfo = preloadedPluginInfos.Find(delegate(PluginInfo info) { return info.Name == plugin.Name; });
     310      foreach(string assembly in preloadedInfo.Assemblies) {
    305311        // always use \ as directory separator (this is necessary for discovery of types in
    306312        // plugins see DiscoveryService.GetTypes()
    307313        pluginInfo.Assemblies.Add(assembly.Replace('/', '\\'));
    308 
    309       }
    310       foreach(string dependency in pluginDependencies[plugin.Name]) {
     314      }
     315      foreach(string dependency in pluginDependencies[preloadedInfo]) {
    311316        // accumulate the dependencies of each assembly into the dependencies of the whole plugin
    312317        PluginInfo dependencyInfo = GetPluginInfo(pluginsByName[dependency]);
    313318        pluginInfo.Dependencies.Add(dependencyInfo);
    314319      }
    315 
    316320      pluginInfos[plugin] = pluginInfo;
    317 
    318321      return pluginInfo;
    319322    }
    320323
    321324    private void CheckPluginFiles() {
    322       foreach(PluginInfo plugin in allPlugins.Keys) {
    323         CheckPluginFiles(plugin);
     325      foreach(PluginInfo plugin in preloadedPluginInfos) {
     326        if(!CheckPluginFiles(plugin)) {
     327          disabledPlugins.Add(plugin);
     328        }
    324329      }
    325330    }
    326331
    327332    private bool CheckPluginFiles(PluginInfo pluginInfo) {
    328       if(activePlugins.ContainsKey(pluginInfo)) {
    329         return true;
    330       }
    331       foreach(PluginInfo dependency in pluginInfo.Dependencies) {
    332         if(!CheckPluginFiles(dependency)) {
    333           return false;
    334         }
    335       }
    336333      foreach(string filename in pluginInfo.Files) {
    337334        if(!File.Exists(filename)) {
    338           MissingPluginFile(pluginInfo.Name, filename);
     335          if(MissingPluginFile != null) {
     336            MissingPluginFile(pluginInfo.Name, filename);
     337          }
    339338          return false;
    340339        }
    341340      }
    342 
    343       activePlugins.Add(pluginInfo, allPlugins[pluginInfo]);
    344341      return true;
    345342    }
  • /trunk/sources/HeuristicLab.PluginInfrastructure/PluginInfo.cs

    r20 r30  
    8383
    8484    public override int GetHashCode() {
    85       return name.GetHashCode() + version.GetHashCode();
     85      if(version != null) {
     86        return name.GetHashCode() + version.GetHashCode();
     87      } else return name.GetHashCode();
    8688    }
    8789  }
  • /trunk/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs

    r20 r30  
    5353    }
    5454
    55     public List<PluginInfo> InstalledPlugins {
     55    public ICollection<PluginInfo> InstalledPlugins {
    5656      get { return remoteLoader.InstalledPlugins; }
    5757    }
    5858
    59     public ApplicationInfo[] InstalledApplications {
     59    public ICollection<PluginInfo> DisabledPlugins {
     60      get { return remoteLoader.DisabledPlugins; }
     61    }
     62
     63    public ICollection<PluginInfo> ActivePlugins {
     64      get { return remoteLoader.ActivePlugins; }
     65    }
     66
     67    public ICollection<ApplicationInfo> InstalledApplications {
    6068      get { return remoteLoader.InstalledApplications; }
    6169    }
    6270
    63     private PluginInfo[] loadedPlugins;
    64     public PluginInfo[] LoadedPlugins {
     71    private ICollection<PluginInfo> loadedPlugins;
     72    public ICollection<PluginInfo> LoadedPlugins {
    6573      get { return loadedPlugins; }
    6674      internal set { loadedPlugins = value; }
     
    7280    public void Initialize() {
    7381      NotifyListeners(PluginManagerAction.Initializing, "-");
    74 
    7582      AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
    7683      setup.PrivateBinPath = pluginDir;
    7784      pluginDomain = AppDomain.CreateDomain("plugin domain", null, setup);
    78 
    7985      remoteLoader = (Loader)pluginDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfraStructure", "HeuristicLab.PluginInfrastructure.Loader");
    80 
    8186      remoteLoader.PluginAction += delegate(object sender, PluginManagerActionEventArgs args) { if(Action != null) Action(this, args); };
    8287      remoteLoader.Init();
    83 
    8488      NotifyListeners(PluginManagerAction.Initialized, "-");
    8589    }
     
    99103      setup.PrivateBinPath = pluginDir;
    100104      AppDomain applicationDomain = AppDomain.CreateDomain(appInfo.Name + " AppDomain", null, setup);
    101      
     105
    102106      Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfrastructure", "HeuristicLab.PluginInfrastructure.Runner");
    103107      NotifyListeners(PluginManagerAction.Initializing, "All plugins");
     
    116120    public List<PluginInfo> GetDependentPlugins(PluginInfo pluginInfo) {
    117121      List<PluginInfo> mergedList = new List<PluginInfo>();
    118       InstalledPlugins.ForEach(delegate(PluginInfo plugin) {
     122      foreach(PluginInfo plugin in InstalledPlugins) {
    119123        if(plugin.Dependencies.Contains(pluginInfo)) {
    120124          if(!mergedList.Contains(plugin)) {
     
    125129          GetDependentPlugins(plugin).ForEach(delegate(PluginInfo dependentPlugin) {
    126130            if(!mergedList.Contains(dependentPlugin)) {
    127               mergedList.Add(dependentPlugin);             
     131              mergedList.Add(dependentPlugin);
    128132            }
    129133          });
    130134        }
    131       });
    132      
     135      }
    133136      return mergedList;
    134137    }
  • /trunk/sources/HeuristicLab.PluginInfrastructure/Runner.cs

    r20 r30  
    2828  internal class Runner : MarshalByRefObject {
    2929
    30     public void LoadPlugins(PluginInfo[] plugins) {
     30    public void LoadPlugins(ICollection<PluginInfo> plugins) {
    3131      foreach(PluginInfo pluginInfo in plugins) {
    3232        foreach(string assemblyName in pluginInfo.Assemblies) {
     
    3434        }
    3535      }
    36 
    3736      PluginManager.Manager.LoadedPlugins = plugins;
    3837    }
  • /trunk/sources/HeuristicLab.Random/HeuristicLab.Random.csproj

    r20 r30  
    8181  <ItemGroup>
    8282    <None Include="HeuristicLab.snk" />
     83    <None Include="Properties\AssemblyInfo.frame" />
    8384  </ItemGroup>
    8485  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
     
    9091  </Target>
    9192  -->
     93  <PropertyGroup>
     94    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     95  </PropertyGroup>
    9296</Project>
  • /trunk/sources/HeuristicLab.RealVector/HeuristicLab.RealVector.csproj

    r20 r30  
    5050  <ItemGroup>
    5151    <None Include="HeuristicLab.snk" />
     52    <None Include="Properties\AssemblyInfo.frame" />
    5253  </ItemGroup>
    5354  <ItemGroup>
     
    7778  </Target>
    7879  -->
     80  <PropertyGroup>
     81    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     82  </PropertyGroup>
    7983</Project>
  • /trunk/sources/HeuristicLab.Routing.TSP/HeuristicLab.Routing.TSP.csproj

    r20 r30  
    9999  <ItemGroup>
    100100    <None Include="HeuristicLab.snk" />
     101    <None Include="Properties\AssemblyInfo.frame" />
    101102  </ItemGroup>
    102103  <ItemGroup>
     
    118119  </Target>
    119120  -->
     121  <PropertyGroup>
     122    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     123  </PropertyGroup>
    120124</Project>
  • /trunk/sources/HeuristicLab.SGA/HeuristicLab.SGA.csproj

    r20 r30  
    9494  <ItemGroup>
    9595    <None Include="HeuristicLab.snk" />
     96    <None Include="Properties\AssemblyInfo.frame" />
    9697  </ItemGroup>
    9798  <ItemGroup>
     
    109110  </Target>
    110111  -->
     112  <PropertyGroup>
     113    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     114  </PropertyGroup>
    111115</Project>
  • /trunk/sources/HeuristicLab.Scheduling.JSSP/HeuristicLab.Scheduling.JSSP.csproj

    r20 r30  
    125125  <ItemGroup>
    126126    <None Include="HeuristicLab.snk" />
     127    <None Include="Properties\AssemblyInfo.frame" />
    127128  </ItemGroup>
    128129  <ItemGroup>
     
    161162  </Target>
    162163  -->
     164  <PropertyGroup>
     165    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     166  </PropertyGroup>
    163167</Project>
  • /trunk/sources/HeuristicLab.Selection.OffspringSelection/HeuristicLab.Selection.OffspringSelection.csproj

    r20 r30  
    5050  <ItemGroup>
    5151    <None Include="HeuristicLab.snk" />
     52    <None Include="Properties\AssemblyInfo.frame" />
    5253  </ItemGroup>
    5354  <ItemGroup>
     
    7374  </Target>
    7475  -->
     76  <PropertyGroup>
     77    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     78  </PropertyGroup>
    7579</Project>
  • /trunk/sources/HeuristicLab.Selection/HeuristicLab.Selection.csproj

    r20 r30  
    6161  <ItemGroup>
    6262    <None Include="HeuristicLab.snk" />
     63    <None Include="Properties\AssemblyInfo.frame" />
    6364  </ItemGroup>
    6465  <ItemGroup>
     
    8889  </Target>
    8990  -->
     91  <PropertyGroup>
     92    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     93  </PropertyGroup>
    9094</Project>
  • /trunk/sources/HeuristicLab.SequentialEngine/HeuristicLab.SequentialEngine.csproj

    r20 r30  
    5757  <ItemGroup>
    5858    <None Include="HeuristicLab.snk" />
     59    <None Include="Properties\AssemblyInfo.frame" />
    5960  </ItemGroup>
    6061  <ItemGroup>
     
    7677  </Target>
    7778  -->
     79  <PropertyGroup>
     80    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     81  </PropertyGroup>
    7882</Project>
  • /trunk/sources/HeuristicLab.StructureIdentification/HeuristicLab.StructureIdentification.csproj

    r20 r30  
    122122  <ItemGroup>
    123123    <None Include="HeuristicLab.snk" />
     124    <None Include="Properties\AssemblyInfo.frame" />
    124125  </ItemGroup>
    125126  <ItemGroup>
     
    141142  </Target>
    142143  -->
     144  <PropertyGroup>
     145    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     146  </PropertyGroup>
    143147</Project>
  • /trunk/sources/HeuristicLab.StructureIdentification/Manipulation/ChangeNodeTypeManipulation.cs

    r20 r30  
    3838      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
    3939      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
    40       AddVariableInfo(new VariableInfo("BalanceTrees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));
     40      AddVariableInfo(new VariableInfo("BalancedTreesRate", "Determines how many trees should be balanced", typeof(DoubleData), VariableKind.In));
    4141      AddVariableInfo(new VariableInfo("OperatorTree", "The tree to mutate", typeof(IOperator), VariableKind.In));
    4242      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
     
    4949      MersenneTwister random = GetVariableValue<MersenneTwister>("Random", scope, true);
    5050      GPOperatorLibrary library = GetVariableValue<GPOperatorLibrary>("OperatorLibrary", scope, true);
    51       bool balanceTrees = GetVariableValue<BoolData>("BalanceTrees", scope, true).Data;
     51      double balancedTreesRate = GetVariableValue<DoubleData>("BalancedTreesRate", scope, true).Data;
    5252      IntData treeSize = GetVariableValue<IntData>("TreeSize", scope, false);
    5353      IntData treeHeight = GetVariableValue<IntData>("TreeHeight", scope, false);
     
    8787      } else {
    8888        List<IOperator> uninitializedOperators;
    89         IOperator newFunction = ChangeFunctionType(parent, selectedChild, selectedChildIndex, gardener, random, balanceTrees, out uninitializedOperators);
     89        IOperator newFunction = ChangeFunctionType(parent, selectedChild, selectedChildIndex, gardener, random, balancedTreesRate, out uninitializedOperators);
    9090
    9191        if (parent == null) {
     
    139139
    140140    private IOperator ChangeFunctionType(IOperator parent, IOperator child, int childIndex, TreeGardener gardener, MersenneTwister random,
    141       bool balanceTrees, out List<IOperator> uninitializedOperators) {
     141      double balancedTreesRate, out List<IOperator> uninitializedOperators) {
    142142      // since there are suboperators, we have to check which
    143143      // and how many of the existing suboperators we can reuse
     
    197197          availableSubOperators.Remove(selectedSubOperator); // the operator shouldn't be available for the following slots
    198198        } else {
    199           IOperator freshOperatorTree = gardener.CreateRandomTree(allowedOperators, maxSubTreeSize, maxSubTreeHeight, balanceTrees);
     199          IOperator freshOperatorTree;
     200          if(random.NextDouble() <= balancedTreesRate) {
     201            freshOperatorTree = gardener.CreateRandomTree(allowedOperators, maxSubTreeSize, maxSubTreeHeight, true);
     202          } else {
     203            freshOperatorTree = gardener.CreateRandomTree(allowedOperators, maxSubTreeSize, maxSubTreeHeight, false);
     204          }
    200205          freshSubTrees.AddRange(gardener.GetAllOperators(freshOperatorTree));
    201206
  • /trunk/sources/HeuristicLab.StructureIdentification/Manipulation/CutOutNodeManipulation.cs

    r20 r30  
    5252      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
    5353      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
    54       AddVariableInfo(new VariableInfo("BalanceTrees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));
     54      AddVariableInfo(new VariableInfo("BalancedTreesRate", "Determines how many trees should be balanced", typeof(DoubleData), VariableKind.In));
    5555      AddVariableInfo(new VariableInfo("OperatorTree", "The tree to mutate", typeof(IOperator), VariableKind.In));
    5656      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
     
    6565      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
    6666      int maxTreeSize = GetVariableValue<IntData>("MaxTreeSize", scope, true).Data;
    67       bool balanceTrees = GetVariableValue<BoolData>("BalanceTrees", scope, true).Data;
     67      double balancedTreesRate = GetVariableValue<DoubleData>("BalancedTreesRate", scope, true).Data;
    6868
    6969      TreeGardener gardener = new TreeGardener(random, library);
     
    9595        } else {
    9696          // create a new random tree
    97           IOperator newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, balanceTrees);
     97          IOperator newOperator;
     98          if(random.NextDouble() <= balancedTreesRate) {
     99            newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, true);
     100          } else {
     101            newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, false);
     102          }
    98103
    99104          GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(newOperator);
  • /trunk/sources/HeuristicLab.StructureIdentification/Manipulation/DeleteSubTreeManipulation.cs

    r20 r30  
    4242      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
    4343      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
    44       AddVariableInfo(new VariableInfo("BalanceTrees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));
    4544      AddVariableInfo(new VariableInfo("OperatorTree", "The tree to mutate", typeof(IOperator), VariableKind.In | VariableKind.Out));
    4645      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In | VariableKind.Out));
  • /trunk/sources/HeuristicLab.StructureIdentification/Manipulation/SubstituteSubTreeManipulation.cs

    r20 r30  
    4141      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
    4242      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
    43       AddVariableInfo(new VariableInfo("BalanceTrees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));
     43      AddVariableInfo(new VariableInfo("BalancedTreesRate", "Determines how many trees should be balanced", typeof(DoubleData), VariableKind.In));
    4444      AddVariableInfo(new VariableInfo("OperatorTree", "The tree to manipulate", typeof(IOperator), VariableKind.In));
    4545      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
     
    5454      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
    5555      int maxTreeSize = GetVariableValue<IntData>("MaxTreeSize", scope, true).Data;
    56       bool balanceTrees = GetVariableValue<BoolData>("BalanceTrees", scope, true).Data;
     56      double balancedTreesRate = GetVariableValue<DoubleData>("BalancedTreesRate", scope, true).Data;
    5757      int treeSize = GetVariableValue<IntData>("TreeSize", scope, true).Data;
    5858      int treeHeight = GetVariableValue<IntData>("TreeHeight", scope, true).Data;
     
    6666
    6767        // create a new random operator tree
    68         IOperator newOperatorTree = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, balanceTrees);
     68
     69        IOperator newOperatorTree;
     70        if(random.NextDouble() <= balancedTreesRate) {
     71          newOperatorTree = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, true);
     72        } else {
     73          newOperatorTree = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, false);
     74        }
    6975
    7076        if(!gardener.IsValidTree(newOperatorTree)) {
     
    100106
    101107        // get a random operatorTree
    102         IOperator newOperatorTree = gardener.CreateRandomTree(allowedOperators, maxSubTreeSize, maxSubTreeHeight, balanceTrees);
     108        IOperator newOperatorTree;
     109        if(random.NextDouble() <= balancedTreesRate) {
     110          newOperatorTree = gardener.CreateRandomTree(allowedOperators, maxSubTreeSize, maxSubTreeHeight, true);
     111        } else {
     112          newOperatorTree = gardener.CreateRandomTree(allowedOperators, maxSubTreeSize, maxSubTreeHeight, false);
     113        }
    103114
    104115        IOperator oldChild = parent.SubOperators[childIndex];
  • /trunk/sources/HeuristicLab.StructureIdentification/RandomTreeCreator.cs

    r20 r30  
    3939      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
    4040      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
    41       AddVariableInfo(new VariableInfo("BalanceTrees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));
     41      AddVariableInfo(new VariableInfo("BalancedTreesRate", "Determines how many trees should be balanced", typeof(DoubleData), VariableKind.In));
    4242      AddVariableInfo(new VariableInfo("OperatorTree", "The tree to mutate", typeof(IOperator), VariableKind.In));
    4343      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
     
    5050      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
    5151      int maxTreeSize = GetVariableValue<IntData>("MaxTreeSize", scope, true).Data;
    52       bool balanceTrees = GetVariableValue<BoolData>("BalanceTrees", scope, true).Data;
     52      double balancedTreesRate = GetVariableValue<DoubleData>("BalancedTreesRate", scope, true).Data;
    5353
    5454      TreeGardener gardener = new TreeGardener(random, opLibrary);
     
    5656      int treeHeight = random.Next(1, maxTreeHeight + 1);
    5757      int treeSize = random.Next(1, maxTreeSize + 1);
    58 
    59       IOperator rootOperator = gardener.CreateRandomTree(treeSize, treeHeight, balanceTrees);
     58      IOperator rootOperator;
     59      if(random.NextDouble() <= balancedTreesRate) {
     60        rootOperator = gardener.CreateRandomTree(treeSize, treeHeight, true);
     61      } else {
     62        rootOperator = gardener.CreateRandomTree(treeSize, treeHeight, false);
     63      }
    6064
    6165      int actualTreeSize = gardener.GetTreeSize(rootOperator);
  • /trunk/sources/HeuristicLab.StructureIdentification/Recombination/SinglePointCrossOver.cs

    r20 r30  
    4444      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
    4545      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
    46       AddVariableInfo(new VariableInfo("BalanceTrees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));
    4746      AddVariableInfo(new VariableInfo("OperatorTree", "The tree to mutate", typeof(IOperator), VariableKind.In));
    4847      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
  • /trunk/sources/HeuristicLab.StructureIdentification/TreeGardener.cs

    r20 r30  
    9696    internal IOperator CreateRandomTree(int maxTreeSize, int maxTreeHeight, bool balanceTrees) {
    9797      if (balanceTrees) {
    98         if (maxTreeHeight == 1) {
     98        if (maxTreeHeight == 1 || maxTreeSize==1) {
    9999          IOperator selectedTerminal = (IOperator)terminals[random.Next(terminals.Count())].Clone();
    100100          return selectedTerminal;
  • /trunk/sources/HeuristicLab.TestFunctions/HeuristicLab.TestFunctions.csproj

    r20 r30  
    5252  <ItemGroup>
    5353    <None Include="HeuristicLab.snk" />
     54    <None Include="Properties\AssemblyInfo.frame" />
    5455  </ItemGroup>
    5556  <ItemGroup>
     
    7980  </Target>
    8081  -->
     82  <PropertyGroup>
     83    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     84  </PropertyGroup>
    8185</Project>
  • /trunk/sources/HeuristicLab.ThreadParallelEngine/HeuristicLab.ThreadParallelEngine.csproj

    r20 r30  
    5757  <ItemGroup>
    5858    <None Include="HeuristicLab.snk" />
     59    <None Include="Properties\AssemblyInfo.frame" />
    5960  </ItemGroup>
    6061  <ItemGroup>
     
    7677  </Target>
    7778  -->
     79  <PropertyGroup>
     80    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
     81  </PropertyGroup>
    7882</Project>
  • /trunk/sources/HeuristicLab.sln

    r20 r30  
    55  ProjectSection(SolutionItems) = preProject
    66    ..\documentation\License\gpl-3.0.txt = ..\documentation\License\gpl-3.0.txt
     7    PreBuildEvent.cmd = PreBuildEvent.cmd
    78  EndProjectSection
    89EndProject
  • /trunk/sources/HeuristicLab/HeuristicLab.csproj

    r20 r30  
    104104    <Content Include="Resources\HeuristicLab.ico" />
    105105    <None Include="app.config" />
     106    <None Include="Properties\AssemblyInfo.frame" />
    106107    <None Include="Resources\LargeIcons.gif" />
    107108    <None Include="Resources\Details.gif" />
     
    119120  <PropertyGroup>
    120121    <PostBuildEvent>cmd /c ..\..\UpdateAssemblies.cmd $(ConfigurationName)</PostBuildEvent>
     122    <PreBuildEvent>cmd /c ..\..\..\PreBuildEvent.cmd</PreBuildEvent>
    121123  </PropertyGroup>
    122124</Project>
Note: See TracChangeset for help on using the changeset viewer.