Changeset 3527


Ignore:
Timestamp:
04/26/10 01:38:30 (12 years ago)
Author:
abeham
Message:

Added an exception to indicate that multi crossover doesn't contain any crossovers (also for manipulators)
fixed text in StochasticMultiOperator
#893

Location:
trunk/sources
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/MultiBinaryVectorCrossover.cs

    r3445 r3527  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Collections;
     
    7677      }
    7778    }
     79
     80    public override IOperation Apply() {
     81      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one binary vector crossover to choose from.");
     82      return base.Apply();
     83    }
    7884  }
    7985}
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/MultiIntegerVectorCrossover.cs

    r3445 r3527  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Collections;
     
    7677      }
    7778    }
     79
     80    public override IOperation Apply() {
     81      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one integer vector crossover to choose from.");
     82      return base.Apply();
     83    }
    7884  }
    7985}
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Crossovers/MultiPermutationCrossover.cs

    r3445 r3527  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Collections;
     
    7677      }
    7778    }
     79
     80    public override IOperation Apply() {
     81      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one permutation crossover to choose from.");
     82      return base.Apply();
     83    }
    7884  }
    7985}
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/MultiPermutationManipulator.cs

    r3445 r3527  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Collections;
     
    6869      }
    6970    }
     71
     72    public override IOperation Apply() {
     73      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one permutation manipulator to choose from.");
     74      return base.Apply();
     75    }
    7076  }
    7177}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/MultiRealVectorCrossover.cs

    r3445 r3527  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Collections;
     
    8182      }
    8283    }
     84
     85    public override IOperation Apply() {
     86      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one real vector crossover to choose from.");
     87      return base.Apply();
     88    }
    8389  }
    8490}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/MultiRealVectorManipulator.cs

    r3445 r3527  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Collections;
     
    7475      }
    7576    }
     77
     78    public override IOperation Apply() {
     79      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one real vector manipulator to choose from.");
     80      return base.Apply();
     81    }
    7682  }
    7783}
  • trunk/sources/HeuristicLab.Operators/3.3/StochasticMultiOperator.cs

    r3445 r3527  
    3434  /// Base class for stochastic multi operators.
    3535  /// </summary>
    36   [Item("StochasticMultiOperator", "Base class for stochastic multi operators.")]
     36  [Item("StochasticMultiOperator<T>", "Base class for stochastic multi operators.")]
    3737  [StorableClass]
    3838  public abstract class StochasticMultiOperator<T> : MultiOperator<T> where T : class, IOperator {
     
    5858    protected StochasticMultiOperator(bool deserializing) : base(deserializing) { }
    5959    /// <summary>
    60     /// Initializes a new instance of <see cref="StochasticMultiBranch"/> with two parameters
     60    /// Initializes a new instance of <see cref="StochasticMultiOperator"/> with two parameters
    6161    /// (<c>Probabilities</c> and <c>Random</c>).
    6262    /// </summary>
     
    119119      DoubleArray probabilities = ProbabilitiesParameter.ActualValue;
    120120      if(probabilities.Length != Operators.Count) {
    121         throw new InvalidOperationException("MultiCrossover: The list of probabilities has to match the number of operators");
     121        throw new InvalidOperationException(Name + ": The list of probabilities has to match the number of operators");
    122122      }
    123123      double sum = 0;
Note: See TracChangeset for help on using the changeset viewer.