- Timestamp:
- 02/14/10 05:31:49 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 added
- 4 deleted
- 34 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Evolutionary/3.3/HeuristicLab.Evolutionary-3.3.csproj
r2790 r2794 84 84 <Compile Include="HeuristicLabEvolutionaryPlugin.cs" /> 85 85 <Compile Include="Properties\AssemblyInfo.cs" /> 86 <Compile Include="ChildrenCreator.cs" /> 86 87 </ItemGroup> 87 88 <ItemGroup> … … 90 91 </ItemGroup> 91 92 <ItemGroup> 93 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 94 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 95 <Name>HeuristicLab.Collections-3.3</Name> 96 </ProjectReference> 92 97 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 93 98 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> … … 101 106 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 102 107 <Name>HeuristicLab.Operators-3.3</Name> 108 </ProjectReference> 109 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 110 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 111 <Name>HeuristicLab.Parameters-3.3</Name> 112 </ProjectReference> 113 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 114 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project> 115 <Name>HeuristicLab.Persistence-3.3</Name> 103 116 </ProjectReference> 104 117 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj"> -
trunk/sources/HeuristicLab.Evolutionary/3.3/HeuristicLabEvolutionaryPlugin.cs.frame
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.PluginInfrastructure; 26 23 … … 31 28 [Plugin("HeuristicLab.Evolutionary", "3.3.0.$WCREV$")] 32 29 [PluginFile("HeuristicLab.Evolutionary-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Collections", "3.3")] 33 31 [PluginDependency("HeuristicLab.Core", "3.3")] 34 32 [PluginDependency("HeuristicLab.Data", "3.3")] 35 33 [PluginDependency("HeuristicLab.Operators", "3.3")] 34 [PluginDependency("HeuristicLab.Parameters", "3.3")] 35 [PluginDependency("HeuristicLab.Persistence", "3.3")] 36 36 public class HeuristicLabEvolutionaryPlugin : PluginBase { 37 37 } -
trunk/sources/HeuristicLab.Operators/3.3/Assigner.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 using HeuristicLab.Data;27 23 using HeuristicLab.Parameters; 28 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; -
trunk/sources/HeuristicLab.Operators/3.3/CombinedOperator.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.Drawing; 25 using System.Text;26 using System.Xml;27 23 using HeuristicLab.Collections; 28 24 using HeuristicLab.Core; 29 using HeuristicLab.Data;30 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 26 -
trunk/sources/HeuristicLab.Operators/3.3/Comparator.cs
r2790 r2794 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; … … 30 28 namespace HeuristicLab.Operators { 31 29 /// <summary> 32 /// Operator which increments an integer variable.30 /// An operator which compares two items. 33 31 /// </summary> 34 32 [Item("Comparator", "An operator which compares two items.")] -
trunk/sources/HeuristicLab.Operators/3.3/ConditionalBranch.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Data; -
trunk/sources/HeuristicLab.Operators/3.3/DoubleCounter.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Data; -
trunk/sources/HeuristicLab.Operators/3.3/EmptyOperator.cs
r2790 r2794 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 25 using System.Xml; 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Core;28 24 29 25 namespace HeuristicLab.Operators { -
trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj
r2773 r2794 98 98 <Compile Include="SequentialSubScopesProcessor.cs" /> 99 99 <Compile Include="StochasticBranch.cs" /> 100 <Compile Include="SubScopesCreator.cs" /> 100 101 <Compile Include="SubScopesRemover.cs" /> 101 102 <Compile Include="SubScopesSorter.cs" /> … … 110 111 <Compile Include="Properties\AssemblyInfo.cs" /> 111 112 <Compile Include="SingleSuccessorOperator.cs" /> 112 <Compile Include="SubScopesCreater.cs" />113 113 <Compile Include="ValuesCollector.cs" /> 114 <Compile Include="VariableInjector.cs"> 115 <SubType>Code</SubType> 116 </Compile> 114 <Compile Include="VariableCreator.cs" /> 117 115 </ItemGroup> 118 116 <ItemGroup> -
trunk/sources/HeuristicLab.Operators/3.3/HeuristicLabOperatorsPlugin.cs.frame
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.PluginInfrastructure; 26 23 -
trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Data; -
trunk/sources/HeuristicLab.Operators/3.3/MultipleCallsOperator.cs
r2790 r2794 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 using System.Text;26 using System.Xml;27 24 using HeuristicLab.Collections; 28 25 using HeuristicLab.Core; -
trunk/sources/HeuristicLab.Operators/3.3/Operator.cs
r2793 r2794 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 23 using System.Drawing; 24 using HeuristicLab.Collections; 25 using HeuristicLab.Core; 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Core;29 using HeuristicLab.Collections;30 27 31 28 namespace HeuristicLab.Operators { -
trunk/sources/HeuristicLab.Operators/3.3/ParallelSubScopesProcessor.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using System.Xml;27 using HeuristicLab.Collections;28 22 using HeuristicLab.Core; 29 using HeuristicLab.Parameters;30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;31 23 32 24 namespace HeuristicLab.Operators { -
trunk/sources/HeuristicLab.Operators/3.3/Placeholder.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Parameters; -
trunk/sources/HeuristicLab.Operators/3.3/ScopeCleaner.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Parameters; -
trunk/sources/HeuristicLab.Operators/3.3/SequentialSubScopesProcessor.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using System.Xml;27 using HeuristicLab.Collections;28 22 using HeuristicLab.Core; 29 using HeuristicLab.Parameters;30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;31 23 32 24 namespace HeuristicLab.Operators { -
trunk/sources/HeuristicLab.Operators/3.3/SingleCallOperator.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Parameters; -
trunk/sources/HeuristicLab.Operators/3.3/SingleSuccessorOperator.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Parameters; -
trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Data; -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesCreator.cs
r2792 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Data; … … 32 29 /// An operator which adds new and empty sub-scopes to the current scope. 33 30 /// </summary> 34 [Item("SubScopesCreat er", "An operator which adds new and empty sub-scopes to the current scope.")]31 [Item("SubScopesCreator", "An operator which adds new and empty sub-scopes to the current scope.")] 35 32 [EmptyStorableClass] 36 33 [Creatable("Test")] 37 public class SubScopesCreat er : SingleSuccessorOperator {34 public class SubScopesCreator : SingleSuccessorOperator { 38 35 public ValueLookupParameter<IntData> NumberOfSubScopesParameter { 39 36 get { return (ValueLookupParameter<IntData>)Parameters["NumberOfSubScopes"]; } … … 46 43 } 47 44 48 public SubScopesCreat er()45 public SubScopesCreator() 49 46 : base() { 50 47 Parameters.Add(new ValueLookupParameter<IntData>("NumberOfSubScopes", "The number of new and empty sub-scopes which should be added to the current scope.")); -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesRemover.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Data; -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesSorter.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Data; -
trunk/sources/HeuristicLab.Operators/3.3/UniformParallelSubScopesProcessor.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Parameters; -
trunk/sources/HeuristicLab.Operators/3.3/UniformSequentialSubScopesProcessor.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Parameters; -
trunk/sources/HeuristicLab.Operators/3.3/ValuesCollector.cs
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 22 using HeuristicLab.Collections; 27 23 using HeuristicLab.Core; 28 using HeuristicLab.Parameters;29 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 25 -
trunk/sources/HeuristicLab.Operators/3.3/VariableCreator.cs
r2792 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using System.Xml;27 using HeuristicLab.Collections;28 22 using HeuristicLab.Core; 29 23 using HeuristicLab.Parameters; … … 34 28 /// An operator which collects the actual values of parameters and clones them into the current scope. 35 29 /// </summary> 36 [Item("Variable Injector", "An operator which collects the actual values of parameters and clones them into the current scope.")]30 [Item("VariableCreator", "An operator which collects the actual values of parameters and clones them into the current scope.")] 37 31 [Creatable("Test")] 38 32 [EmptyStorableClass] 39 public class Variable Injector : ValuesCollector {33 public class VariableCreator : ValuesCollector { 40 34 protected ScopeParameter CurrentScopeParameter { 41 35 get { return (ScopeParameter)Parameters["CurrentScope"]; } … … 45 39 } 46 40 47 public Variable Injector()41 public VariableCreator() 48 42 : base() { 49 43 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope into which the parameter values are cloned.")); -
trunk/sources/HeuristicLab.Permutation/3.3/HeuristicLab.Permutation-3.3.csproj
r2790 r2794 82 82 <ItemGroup> 83 83 <None Include="HeuristicLabPermutationPlugin.cs.frame" /> 84 <Compile Include="InversionManipulator.cs"> 85 <SubType>Code</SubType> 86 </Compile> 87 <Compile Include="PermutationManipulator.cs" /> 84 88 <Compile Include="HeuristicLabPermutationPlugin.cs" /> 89 <Compile Include="OrderCrossover.cs" /> 90 <Compile Include="PermutationCrossover.cs" /> 91 <Compile Include="Permutation.cs" /> 85 92 <Compile Include="Properties\AssemblyInfo.cs" /> 93 <Compile Include="RandomPermutationCreator.cs" /> 86 94 </ItemGroup> 87 95 <ItemGroup> … … 90 98 </ItemGroup> 91 99 <ItemGroup> 100 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 101 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 102 <Name>HeuristicLab.Collections-3.3</Name> 103 </ProjectReference> 104 <ProjectReference Include="..\..\HeuristicLab.Common\3.2\HeuristicLab.Common-3.2.csproj"> 105 <Project>{1FC004FC-59AF-4249-B1B6-FF25873A20E4}</Project> 106 <Name>HeuristicLab.Common-3.2</Name> 107 </ProjectReference> 92 108 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 93 109 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> … … 98 114 <Name>HeuristicLab.Data-3.3</Name> 99 115 </ProjectReference> 100 <ProjectReference Include="..\..\HeuristicLab.Evolutionary\3.3\HeuristicLab.Evolutionary-3.3.csproj"> 101 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 102 <Name>HeuristicLab.Evolutionary-3.3</Name> 116 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 117 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 118 <Name>HeuristicLab.Operators-3.3</Name> 119 </ProjectReference> 120 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 121 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 122 <Name>HeuristicLab.Parameters-3.3</Name> 123 </ProjectReference> 124 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 125 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project> 126 <Name>HeuristicLab.Persistence-3.3</Name> 103 127 </ProjectReference> 104 128 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj"> 105 129 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> 106 130 <Name>HeuristicLab.PluginInfrastructure</Name> 107 </ProjectReference>108 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">109 <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>110 <Name>HeuristicLab.Random-3.3</Name>111 131 </ProjectReference> 112 132 </ItemGroup> -
trunk/sources/HeuristicLab.Permutation/3.3/HeuristicLabPermutationPlugin.cs.frame
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.PluginInfrastructure; 26 23 … … 31 28 [Plugin("HeuristicLab.Permutation", "3.3.0.$WCREV$")] 32 29 [PluginFile("HeuristicLab.Permutation-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 [PluginDependency("HeuristicLab.Common", "3.2")] 33 32 [PluginDependency("HeuristicLab.Core", "3.3")] 34 33 [PluginDependency("HeuristicLab.Data", "3.3")] 35 [PluginDependency("HeuristicLab.Evolutionary", "3.3")] 36 [PluginDependency("HeuristicLab.Random", "3.3")] 34 [PluginDependency("HeuristicLab.Operators", "3.3")] 35 [PluginDependency("HeuristicLab.Parameters", "3.3")] 36 [PluginDependency("HeuristicLab.Persistence", "3.3")] 37 37 public class HeuristicLabPermutationPlugin : PluginBase { 38 38 } -
trunk/sources/HeuristicLab.Permutation/3.3/InversionManipulator.cs
r1530 r2794 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 24 27 25 namespace HeuristicLab.Permutation { 28 26 /// <summary> 29 /// Manipulates a permutation array by reversing a randomly chosen interval.27 /// An operator which inverts a randomly chosen part of a permutation. 30 28 /// </summary> 31 public class InversionManipulator : PermutationManipulatorBase { 32 /// <inheritdoc select="summary"/> 33 public override string Description { 34 get { return @"TODO\r\nOperator description still missing ..."; } 35 } 29 [Item("InversionManipulator", "An operator which inverts a randomly chosen part of a permutation.")] 30 [EmptyStorableClass] 31 [Creatable("Test")] 32 public class InversionManipulator : PermutationManipulator { 36 33 37 34 /// <summary> 38 /// Reverses the specified <paramref name="permutation"/> between two randomly generated positions.35 /// Inverts a randomly chosen part of a permutation. 39 36 /// </summary> 40 /// <param name="random"> Therandom number generator.</param>41 /// <param name="permutation">The permutation arrayto manipulate.</param>42 /// <returns>The new permuation array with the manipulated data.</returns>43 public static int[] Apply(IRandom random, int[]permutation) {44 int[] result = (int[])permutation.Clone();37 /// <param name="random">A random number generator.</param> 38 /// <param name="permutation">The permutation to manipulate.</param> 39 /// <returns>The new manipulated permutation.</returns> 40 public static Permutation Apply(IRandom random, Permutation permutation) { 41 Permutation result = (Permutation)permutation.Clone(); 45 42 int breakPoint1, breakPoint2; 46 43 … … 51 48 if (breakPoint2 < breakPoint1) { int h = breakPoint1; breakPoint1 = breakPoint2; breakPoint2 = h; } 52 49 53 for (int i = 0; i <= (breakPoint2 - breakPoint1); i++) { // reversepermutation between breakpoints50 for (int i = 0; i <= (breakPoint2 - breakPoint1); i++) { // invert permutation between breakpoints 54 51 result[breakPoint1 + i] = permutation[breakPoint2 - i]; 55 52 } … … 58 55 59 56 /// <summary> 60 /// Reverses the specified <paramref name="permutation"/> between two randomly generated positions.57 /// Inverts a randomly chosen part of a permutation. 61 58 /// </summary> 62 /// <remarks>Calls <see cref="Apply"/>.</remarks> 63 /// <param name="scope">The current scope.</param> 64 /// <param name="random">The random number generator.</param> 65 /// <param name="permutation">The permutation array to manipulate.</param> 66 /// <returns>The new permuation array with the manipulated data.</returns> 67 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 59 /// <param name="random">A random number generator.</param> 60 /// <param name="permutation">The permutation to manipulate.</param> 61 /// <returns>The new manipulated permuation.</returns> 62 protected override Permutation Manipulate(IRandom random, Permutation permutation) { 68 63 return Apply(random, permutation); 69 64 } -
trunk/sources/HeuristicLab.Permutation/3.3/OrderCrossover.cs
r1530 r2794 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 using HeuristicLab. Data;24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 25 28 26 namespace HeuristicLab.Permutation { 29 27 /// <summary> 30 /// Performs a cross over permutation between two permuation arrays 31 /// by taking a randomly chosen interval from the frist, preserving the positions, 32 /// then the missing values from the second array in the order they occur in the second array. 28 /// An operator which performs an order crossover of two permutations. 33 29 /// </summary> 34 public class OrderCrossover : PermutationCrossoverBase { 35 /// <inheritdoc select="summary"/> 36 public override string Description { 37 get { return @"TODO\r\nOperator description still missing ..."; } 38 } 39 30 /// <remarks> 31 /// Crosses two permutations by taking a randomly chosen interval from the frist permutation, preserving 32 /// the positions, and then the missing values from the second permutation in the order they occur in the 33 /// second permutation. 34 /// </remarks> 35 [Item("OrderCrossover", "An operator which performs an order crossover of two permutations.")] 36 [EmptyStorableClass] 37 [Creatable("Test")] 38 public class OrderCrossover : PermutationCrossover { 40 39 /// <summary> 41 /// Performs a cross over permutation of <paramref name="parent1"/> and 42 /// <paramref name="parent2"/> by taking a randomly chosen interval from <paramref name="parent1"/>, 43 /// preserving the positions and then the missing values from <paramref name="parent2"/> in the 44 /// order they occur in <paramref name="parent2"/>. 40 /// Performs an order crossover of two permutations. 45 41 /// </summary> 46 /// <param name="random"> Therandom number generator.</param>47 /// <param name="parent1">The parent scope 1 to cross over.</param>48 /// <param name="parent2">The parent scope 2 to cross over.</param>49 /// <returns>The created cross over permutation as int array.</returns>50 public static int[] Apply(IRandom random, int[] parent1, int[]parent2) {51 int[] result = new int[parent1.Length];42 /// <param name="random">A random number generator.</param> 43 /// <param name="parent1">The first parent permutation to cross.</param> 44 /// <param name="parent2">The second parent permutation to cross.</param> 45 /// <returns>The new permutation resulting from the crossover.</returns> 46 public static Permutation Apply(IRandom random, Permutation parent1, Permutation parent2) { 47 Permutation result = new Permutation(parent1.Length); 52 48 bool[] copied = new bool[result.Length]; 53 49 … … 74 70 75 71 /// <summary> 76 /// Performs an order crossover o peration for two given parentpermutations.72 /// Performs an order crossover of two permutations. 77 73 /// </summary> 78 74 /// <exception cref="InvalidOperationException">Thrown if there are not exactly two parents.</exception> 79 /// <param name="scope">The current scope.</param>80 75 /// <param name="random">A random number generator.</param> 81 76 /// <param name="parents">An array containing the two permutations that should be crossed.</param> 82 /// <returns>The new ly created permutation, resulting from the crossover operation.</returns>83 protected override int[] Cross(IScope scope, IRandom random, int[][]parents) {84 if (parents.Length != 2) throw new InvalidOperationException(" ERROR in OrderCrossover: The number of parents is not equal to 2");77 /// <returns>The new permutation resulting from the crossover.</returns> 78 protected override Permutation Cross(IRandom random, ItemArray<Permutation> parents) { 79 if (parents.Length != 2) throw new InvalidOperationException("Number of parents is not equal to 2."); 85 80 return Apply(random, parents[0], parents[1]); 86 81 } -
trunk/sources/HeuristicLab.Permutation/3.3/Permutation.cs
r2526 r2794 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Text; 25 using System.Xml;24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; 27 26 using HeuristicLab.Data; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 29 namespace HeuristicLab.Permutation { 30 /// <summary>31 /// The base class for a permutation, which is an ordered combination.32 /// </summary>33 public class Permutation : IntArrayData {34 /// <summary>35 /// Initializes a new instance of <see cref="Permutation"/>.36 /// </summary>37 public Permutation()38 : base() {30 [EmptyStorableClass] 31 [Item("Permutation", "Represents a permutation of integer values.")] 32 [Creatable("Test")] 33 public sealed class Permutation : ValueTypeArrayData<int>, IStringConvertibleMatrixData { 34 public Permutation() : base() { } 35 public Permutation(int length) 36 : base(length) { 37 for (int i = 0; i < length; i++) 38 this[i] = i; 39 39 } 40 /// <summary> 41 /// Initializes a new instance of <see cref="Permutation"/> with the given 42 /// <paramref name="permutation"/> array. 43 /// </summary> 44 /// <param name="permutation">The permutation array to assign.</param> 45 public Permutation(int[] permutation) 46 : base(permutation) { 40 public Permutation(int length, IRandom random) 41 : this(length) { 42 Randomize(random); 47 43 } 44 public Permutation(int[] elements) 45 : base(elements) { 46 if (!Validate()) throw new ArgumentException("Elements do not represent a valid permutation."); 47 } 48 private Permutation(Permutation elements) : base(elements) { } 48 49 49 /// <summary> 50 /// Clones the current instance. 51 /// </summary> 52 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed to 53 /// avoid cycles.)</param> 54 /// <returns>The cloned object as <see cref="Permutation"/>.</returns> 55 public override IItem Clone(ICloner cloner) { 56 Permutation clone = new Permutation((int[])Data.Clone()); 50 public override IDeepCloneable Clone(Cloner cloner) { 51 Permutation clone = new Permutation(this); 57 52 cloner.RegisterClonedObject(this, clone); 58 53 return clone; 59 54 } 55 56 public bool Validate() { 57 bool[] values = new bool[Length]; 58 int value; 59 60 for (int i = 0; i < values.Length; i++) 61 values[i] = false; 62 for (int i = 0; i < Length; i++) { 63 value = this[i]; 64 if ((value < 0) || (value >= values.Length)) return false; 65 if (values[value]) return false; 66 values[value] = true; 67 } 68 return true; 69 } 70 71 public void Randomize(IRandom random, int startIndex, int length) { // Knuth shuffle 72 int index1, index2; 73 int val; 74 for (int i = length - 1; i > 0; i--) { 75 index1 = startIndex + i; 76 index2 = startIndex + random.Next(i + 1); 77 if (index1 != index2) { 78 val = this[index1]; 79 this[index1] = this[index2]; 80 this[index2] = val; 81 } 82 } 83 } 84 public void Randomize(IRandom random) { 85 Randomize(random, 0, Length); 86 } 87 88 #region IStringConvertibleMatrixData Members 89 StringConvertibleArrayDataDimensions IStringConvertibleMatrixData.Dimensions { 90 get { return StringConvertibleArrayDataDimensions.Rows; } 91 } 92 int IStringConvertibleMatrixData.Rows { 93 get { return Length; } 94 set { Length = value; } 95 } 96 int IStringConvertibleMatrixData.Columns { 97 get { return 1; } 98 set { throw new NotSupportedException("Columns cannot be changed."); } 99 } 100 101 bool IStringConvertibleMatrixData.Validate(string value, out string errorMessage) { 102 int val; 103 bool valid = int.TryParse(value, out val); 104 errorMessage = string.Empty; 105 if (!valid) { 106 StringBuilder sb = new StringBuilder(); 107 sb.Append("Invalid Value (Valid Value Format: \""); 108 sb.Append(FormatPatterns.GetIntFormatPattern()); 109 sb.Append("\")"); 110 errorMessage = sb.ToString(); 111 } 112 return valid; 113 } 114 string IStringConvertibleMatrixData.GetValue(int rowIndex, int columIndex) { 115 return this[rowIndex].ToString(); 116 } 117 bool IStringConvertibleMatrixData.SetValue(string value, int rowIndex, int columnIndex) { 118 int val; 119 if (int.TryParse(value, out val)) { 120 this[rowIndex] = val; 121 return true; 122 } else { 123 return false; 124 } 125 } 126 event EventHandler<EventArgs<int, int>> IStringConvertibleMatrixData.ItemChanged { 127 add { base.ItemChanged += value; } 128 remove { base.ItemChanged -= value; } 129 } 130 event EventHandler IStringConvertibleMatrixData.Reset { 131 add { base.Reset += value; } 132 remove { base.Reset -= value; } 133 } 134 #endregion 60 135 } 61 136 } -
trunk/sources/HeuristicLab.Permutation/3.3/RandomPermutationCreator.cs
r2792 r2794 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Data; 24 using HeuristicLab.Operators; 25 using HeuristicLab.Parameters; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 28 namespace HeuristicLab.Permutation { 29 29 /// <summary> 30 /// Generates a randomly shuffled permuation.30 /// An operator which creates a new random permutation of integer values. 31 31 /// </summary> 32 public class RandomPermutationGenerator : OperatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return @"TODO\r\nOperator description still missing ..."; } 32 [Item("RandomPermutationCreator", "An operator which creates a new random permutation of integer values.")] 33 [EmptyStorableClass] 34 [Creatable("Test")] 35 public sealed class RandomPermutationCreator : SingleSuccessorOperator { 36 public LookupParameter<IRandom> RandomParameter { 37 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 38 } 39 public ValueLookupParameter<IntData> LengthParameter { 40 get { return (ValueLookupParameter<IntData>)Parameters["Length"]; } 41 } 42 public LookupParameter<Permutation> PermutationParameter { 43 get { return (LookupParameter<Permutation>)Parameters["Permutation"]; } 36 44 } 37 45 38 /// <summary> 39 /// Initializes a new instance of <see cref="RandomPermutationGenerator"/> with three variable infos 40 /// (<c>Length</c>, <c>Random</c> and <c>Permutation</c>). 41 /// </summary> 42 public RandomPermutationGenerator() 46 public RandomPermutationCreator() 43 47 : base() { 44 AddVariableInfo(new VariableInfo("Length", "Permutation length", typeof(IntData), VariableKind.In));45 AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.In));46 AddVariableInfo(new VariableInfo("Permutation", "Created random permutation", typeof(Permutation), VariableKind.New));48 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used to initialize the new random permutation.")); 49 Parameters.Add(new ValueLookupParameter<IntData>("Length", "The length of the new random permutation.")); 50 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The new random permutation.")); 47 51 } 48 52 49 /// <summary> 50 /// Generates a randomly shuffled permutation. 51 /// </summary> 52 /// <param name="random">The random number generator.</param> 53 /// <param name="length">The length of the permutation to create.</param> 54 /// <returns>The generated permuation as int array.</returns> 55 public static int[] Apply(IRandom random, int length) { 56 int[] perm = new int[length]; 57 58 for (int i = 0; i < length; i++) 59 perm[i] = i; 60 61 // Knuth shuffle 62 int index, tmp; 63 for (int i = 0; i < length - 1; i++) { 64 index = random.Next(i, length); 65 tmp = perm[i]; 66 perm[i] = perm[index]; 67 perm[index] = tmp; 68 } 69 return perm; 70 } 71 72 /// <summary> 73 /// Generates a randomly shuffled permutation. 74 /// </summary> 75 /// <remarks>Calls <see cref="Apply(HeuristicLab.Core.IRandom, int)"/>.</remarks> 76 /// <param name="scope">The current scope with the variables.</param> 77 /// <returns><c>null</c>.</returns> 78 public override IOperation Apply(IScope scope) { 79 IRandom random = GetVariableValue<IRandom>("Random", scope, true); 80 IntData length = GetVariableValue<IntData>("Length", scope, true); 81 82 int[] perm = Apply(random, length.Data); 83 scope.AddVariable(new Variable(scope.TranslateName("Permutation"), new Permutation(perm))); 84 85 return null; 53 public override IExecutionSequence Apply() { 54 PermutationParameter.ActualValue = new Permutation(LengthParameter.ActualValue.Value, RandomParameter.ActualValue); 55 return base.Apply(); 86 56 } 87 57 } -
trunk/sources/HeuristicLab.Random/3.3/HeuristicLab.Random-3.3.csproj
r2773 r2794 86 86 <ItemGroup> 87 87 <None Include="HeuristicLabRandomPlugin.cs.frame" /> 88 <Compile Include="RandomInitializer.cs" />89 88 <Compile Include="HeuristicLabRandomPlugin.cs" /> 90 89 <Compile Include="MersenneTwister.cs"> … … 95 94 </Compile> 96 95 <Compile Include="Properties\AssemblyInfo.cs" /> 96 <Compile Include="RandomCreator.cs" /> 97 97 </ItemGroup> 98 98 <ItemGroup> -
trunk/sources/HeuristicLab.Random/3.3/HeuristicLabRandomPlugin.cs.frame
r2790 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.PluginInfrastructure; 26 23 -
trunk/sources/HeuristicLab.Random/3.3/MersenneTwister.cs
r2790 r2794 33 33 34 34 using System; 35 using System.Collections.Generic;36 using System.Text;37 using System.Xml;38 35 using HeuristicLab.Core; 39 36 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; -
trunk/sources/HeuristicLab.Random/3.3/NormalDistributedRandom.cs
r2790 r2794 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 using System.Globalization;27 23 using HeuristicLab.Core; 28 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; -
trunk/sources/HeuristicLab.Random/3.3/RandomCreator.cs
r2792 r2794 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using HeuristicLab.Core; 26 23 using HeuristicLab.Data; … … 31 28 namespace HeuristicLab.Operators { 32 29 /// <summary> 33 /// An operator which initializes apseudo random number generator.30 /// An operator which creates a new pseudo random number generator. 34 31 /// </summary> 35 [Item("Random Initializer", "An operator which initializes apseudo random number generator.")]32 [Item("RandomCreator", "An operator which creates a new pseudo random number generator.")] 36 33 [EmptyStorableClass] 37 34 [Creatable("Test")] 38 public sealed class Random Initializer : SingleSuccessorOperator {35 public sealed class RandomCreator : SingleSuccessorOperator { 39 36 public ValueLookupParameter<BoolData> SetSeedRandomlyParameter { 40 37 get { return (ValueLookupParameter<BoolData>)Parameters["SetSeedRandomly"]; } … … 55 52 } 56 53 57 public Random Initializer()54 public RandomCreator() 58 55 : base() { 59 56 Parameters.Add(new ValueLookupParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true))); 60 Parameters.Add(new ValueLookupParameter<IntData>("Seed", "The random seed used to initialize the pseudo random number generator.", new IntData(0)));61 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should beinitialized with the given seed."));57 Parameters.Add(new ValueLookupParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0))); 58 Parameters.Add(new LookupParameter<IRandom>("Random", "The new pseudo random number generator which is initialized with the given seed.")); 62 59 } 63 60
Note: See TracChangeset
for help on using the changeset viewer.