Changeset 788
- Timestamp:
- 11/20/08 11:27:51 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/SubScopesMixer.cs
r2 r788 27 27 28 28 namespace HeuristicLab.Operators { 29 /// <summary> 30 /// Mixes the sub scopes of a specified scope according to a specified number of partitions. 31 /// </summary> 29 32 public class SubScopesMixer : OperatorBase { 33 /// <inheritdoc select="summary"/> 30 34 public override string Description { 31 35 get { return @"TODO\r\nOperator description still missing ..."; } 32 36 } 33 37 /// <summary> 38 /// Initializes a new instance of <see cref="SubScopesMixer"/> with one variable infos 39 /// (<c>Partitions</c>) and the <c>Local</c> flag set to <c>true</c>. 40 /// </summary> 34 41 public SubScopesMixer() 35 42 : base() { … … 39 46 } 40 47 48 /// <summary> 49 /// Mixes the subscopes of the given <paramref name="scope"/>. 50 /// </summary> 51 /// <remarks>Calls <see cref="IScope.ReorderSubScopes"/>.<br/> 52 /// Mixing of sub scopes is based on the number of partitions. 53 /// <example>12 sub scopes and 3 partitions:<br/> 54 /// Partition 1 contains sub scopes 1-4, partition 2 sub scopes 5-8 and partition 3 sub scopes 9-12. <br/> 55 /// Mixing is realized by selecting at the beginning the first sub scope from partition one, then the 56 /// first sub scope from partition 2, afterwards first sub scope from partition 3, 57 /// then the second sub scope from the first partition and so on. <br/> 58 /// In the end the new sorting of the sub scopes is 1-5-9-2-6-10-3-7-11-4-8-12. 59 /// </example> 60 /// </remarks> 61 /// <param name="scope">The scope whose sub scopes should be mixed.</param> 62 /// <returns><c>null</c>.</returns> 41 63 public override IOperation Apply(IScope scope) { 42 64 int partitions = GetVariableValue<IntData>("Partitions", scope, true).Data; 43 65 int[] sequence = new int[scope.SubScopes.Count]; 66 if ((sequence.Length % partitions) != 0) 67 throw new ArgumentException("The number of subScopes is not divisible by the number of partitions without remainder."); 44 68 int partitionSize = sequence.Length / partitions; 45 69
Note: See TracChangeset
for help on using the changeset viewer.