Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/10 18:32:07 (14 years ago)
Author:
abeham
Message:

updated Evolution Stratgy #932
StrategyParameters moved completely out of the ES into the encoding and problem, because they are inherently problem specific
The ProblemDimension and a few other parameters of ES were removed
Fixed a few bugs also and added some documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs

    r3318 r3336  
    3939  [Creatable("Problems")]
    4040  public sealed class SingleObjectiveTestFunctionProblem : ParameterizedNamedItem, ISingleObjectiveProblem {
     41    [Storable]
     42    private StrategyVectorCreator strategyVectorCreator;
     43    [Storable]
     44    private StrategyVectorCrossover strategyVectorCrossover;
     45    [Storable]
     46    private StrategyVectorManipulator strategyVectorManipulator;
     47
    4148    public override Image ItemImage {
    4249      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
     
    144151      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this TSP instance.", new DoubleValue(evaluator.BestKnownQuality)));
    145152
     153      strategyVectorCreator = new StrategyVectorCreator();
     154      strategyVectorCreator.LengthParameter.ActualName = ProblemSizeParameter.Name;
     155      strategyVectorCrossover = new StrategyVectorCrossover();
     156      strategyVectorManipulator = new StrategyVectorManipulator();
     157
    146158      creator.RealVectorParameter.ActualName = "Point";
    147159      ParameterizeSolutionCreator();
     
    184196    }
    185197    private void ProblemSize_ValueChanged(object sender, EventArgs e) {
     198      if (ProblemSize.Value < 1) ProblemSize.Value = 1;
    186199      ParameterizeSolutionCreator();
     200      strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * ProblemSize.Value));
     201      strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * Math.Sqrt(ProblemSize.Value)));
    187202    }
    188203    private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
     
    249264        }
    250265      }
     266    }
     267    private void strategyVectorCreator_BoundsParameter_ValueChanged(object sender, EventArgs e) {
     268      strategyVectorManipulator.BoundsParameter.Value = strategyVectorCreator.BoundsParameter.Value;
     269    }
     270    private void strategyVectorCreator_StrategyParameterParameter_ActualNameChanged(object sender, EventArgs e) {
     271      string name = strategyVectorCreator.StrategyParameterParameter.ActualName;
     272      strategyVectorCrossover.ParentsParameter.ActualName = name;
     273      strategyVectorCrossover.StrategyParameterParameter.ActualName = name;
     274      strategyVectorManipulator.StrategyParameterParameter.ActualName = name;
    251275    }
    252276    #endregion
     
    266290      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    267291      VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);
     292      strategyVectorCreator.BoundsParameter.ValueChanged += new EventHandler(strategyVectorCreator_BoundsParameter_ValueChanged);
     293      strategyVectorCreator.StrategyParameterParameter.ActualNameChanged += new EventHandler(strategyVectorCreator_StrategyParameterParameter_ActualNameChanged);
    268294    }
    269295    private void InitializeOperators() {
    270296      operators = new List<IOperator>();
    271297      operators.AddRange(ApplicationManager.Manager.GetInstances<IRealVectorOperator>().Cast<IOperator>());
     298      operators.Add(strategyVectorCreator);
     299      operators.Add(strategyVectorCrossover);
     300      operators.Add(strategyVectorManipulator);
    272301      UpdateMoveEvaluators();
    273302      ParameterizeOperators();
Note: See TracChangeset for help on using the changeset viewer.