Changeset 7407 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/RandomSolutionCreator.cs
- Timestamp:
- 01/24/12 17:23:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/RandomSolutionCreator.cs
r7373 r7407 24 24 using HeuristicLab.Data; 25 25 using HeuristicLab.Encodings.IntegerVectorEncoding; 26 using HeuristicLab.Optimization;27 using HeuristicLab.Parameters;28 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 27 … … 31 29 [Item("RandomSolutionCreator", "Creates a completely random solution to the Generalized Quadratic Assignment Problem.")] 32 30 [StorableClass] 33 public class RandomSolutionCreator : GQAPSolutionCreator, IStochasticOperator { 34 35 public ILookupParameter<IRandom> RandomParameter { 36 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 37 } 31 public class RandomSolutionCreator : GQAPStochasticSolutionCreator { 38 32 39 33 [StorableConstructor] 40 34 protected RandomSolutionCreator(bool deserializing) : base(deserializing) { } 41 protected RandomSolutionCreator(RandomSolutionCreator original, Cloner cloner) 42 : base(original, cloner) { } 43 public RandomSolutionCreator() 44 : base() { 45 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 46 } 35 protected RandomSolutionCreator(RandomSolutionCreator original, Cloner cloner) : base(original, cloner) { } 36 public RandomSolutionCreator() : base() { } 47 37 48 38 public override IDeepCloneable Clone(Cloner cloner) { … … 50 40 } 51 41 52 protected override IntegerVector Create Solution(DoubleArray demands, DoubleArray capacities) {53 return UniformRandomIntegerVectorCreator.Apply( RandomParameter.ActualValue, demands.Length, 0, capacities.Length);42 protected override IntegerVector CreateRandomSolution(IRandom random, DoubleArray demands, DoubleArray capacities) { 43 return UniformRandomIntegerVectorCreator.Apply(random, demands.Length, 0, capacities.Length); 54 44 } 55 45 }
Note: See TracChangeset
for help on using the changeset viewer.