Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13583


Ignore:
Timestamp:
02/02/16 14:10:53 (8 years ago)
Author:
abeham
Message:

#2457:

  • Added stripped-down version of FLA branch
  • Added appropriate calculators
  • Fixed detecting maximization in RLD view
Location:
branches/PerformanceComparison
Files:
8 added
36 deleted
20 edited
12 copied

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Algorithms/LocalAnalysis.cs

    r8172 r13583  
    2020#endregion
    2121
    22 using System;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Data;
     25using HeuristicLab.Operators;
    2726using HeuristicLab.Optimization;
    2827using HeuristicLab.Optimization.Operators;
    2928using HeuristicLab.Parameters;
    3029using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.PluginInfrastructure;
    3230using HeuristicLab.Random;
     31using System;
     32using System.Linq;
    3333
    3434namespace HeuristicLab.Analysis.FitnessLandscape {
    3535  [Item("Local Analysis", "A local analysis algorithm.")]
    36   [Creatable("Algorithms")]
    3736  [StorableClass]
    38   public sealed class LocalAnalysis : HeuristicOptimizationEngineAlgorithm, IStorableContent {
     37  public abstract class LocalAnalysis<T> : HeuristicOptimizationEngineAlgorithm, IStorableContent where T : class, IOperator, new() {
    3938    public string Filename { get; set; }
    4039
     
    5049
    5150    #region Parameter Properties
    52     private ValueParameter<IntValue> SeedParameter {
    53       get { return (ValueParameter<IntValue>)Parameters["Seed"]; }
    54     }
    55     private ValueParameter<BoolValue> SetSeedRandomlyParameter {
    56       get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
     51    public IFixedValueParameter<IntValue> SeedParameter {
     52      get { return (IFixedValueParameter<IntValue>)Parameters["Seed"]; }
     53    }
     54    public IFixedValueParameter<BoolValue> SetSeedRandomlyParameter {
     55      get { return (IFixedValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
    5756    }
    5857    public IConstrainedValueParameter<IManipulator> MutatorParameter {
    5958      get { return (IConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
    6059    }
    61     public IConstrainedValueParameter<ISelector> SelectorParameter {
    62       get { return (IConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
    63     }
    64     private ValueParameter<IntValue> MaximumIterationsParameter {
    65       get { return (ValueParameter<IntValue>)Parameters["MaximumIterations"]; }
    66     }
    67     private ValueParameter<IntValue> SampleSizeParameter {
    68       get { return (ValueParameter<IntValue>)Parameters["SampleSize"]; }
    69     }
    70     private ValueParameter<MultiAnalyzer> AnalyzerParameter {
    71       get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     60    public IFixedValueParameter<IntValue> MaximumIterationsParameter {
     61      get { return (IFixedValueParameter<IntValue>)Parameters["MaximumIterations"]; }
     62    }
     63    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
     64      get { return (IValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     65    }
     66    public IFixedValueParameter<T> SelectorParameter {
     67      get { return (IFixedValueParameter<T>)Parameters["Selector"]; }
    7268    }
    7369    #endregion
    7470
    7571    #region Properties
    76     private RandomCreator RandomCreator {
     72    protected RandomCreator RandomCreator {
    7773      get { return (RandomCreator)OperatorGraph.InitialOperator; }
    7874    }
    79     private SolutionsCreator SolutionsCreator {
    80       get { return (SolutionsCreator)RandomCreator.Successor; }
    81     }
    82     private LocalAnalysisMainLoop MainLoop {
     75    protected VariableCreator VariableCreator {
     76      get { return (VariableCreator)RandomCreator.Successor; }
     77    }
     78    protected SolutionsCreator SolutionsCreator {
     79      get { return (SolutionsCreator)VariableCreator.Successor; }
     80    }
     81    protected LocalAnalysisMainLoop MainLoop {
    8382      get { return (LocalAnalysisMainLoop)SolutionsCreator.Successor; }
    8483    }
    85     [Storable]
    86     private BestAverageWorstQualityAnalyzer qualityAnalyzer;
     84
    8785    [Storable]
    8886    private QualityTrailMultiAnalyzer qualityTrailAnalyzer;
     
    9088
    9189    [StorableConstructor]
    92     private LocalAnalysis(bool deserializing) : base(deserializing) { }
    93     private LocalAnalysis(LocalAnalysis original, Cloner cloner)
     90    protected LocalAnalysis(bool deserializing) : base(deserializing) { }
     91    protected LocalAnalysis(LocalAnalysis<T> original, Cloner cloner)
    9492      : base(original, cloner) {
    95       qualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(original.qualityAnalyzer);
    96       qualityTrailAnalyzer = (QualityTrailMultiAnalyzer)cloner.Clone(original.qualityTrailAnalyzer);
    97       Initialize();
    98     }
    99     public LocalAnalysis()
     93      qualityTrailAnalyzer = cloner.Clone(original.qualityTrailAnalyzer);
     94      RegisterEventHandlers();
     95    }
     96    protected LocalAnalysis(T selector)
    10097      : base() {
    101       Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
    102       Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
     98      Parameters.Add(new FixedValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
     99      Parameters.Add(new FixedValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    103100      Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "Mutation operator."));
    104       Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "Selection operator."));
    105       Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(10000)));
    106       Parameters.Add(new ValueParameter<IntValue>("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(1)));
     101      Parameters.Add(new FixedValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(10000)));
    107102      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution and moves.", new MultiAnalyzer()));
     103      Parameters.Add(new FixedValueParameter<T>("Selector", "Selection operator.", selector));
    108104
    109105      RandomCreator randomCreator = new RandomCreator();
     106      VariableCreator variableCreator = new VariableCreator();
    110107      SolutionsCreator solutionsCreator = new SolutionsCreator();
    111108      LocalAnalysisMainLoop laMainLoop = new LocalAnalysisMainLoop();
     
    117114      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
    118115      randomCreator.SetSeedRandomlyParameter.Value = null;
    119       randomCreator.Successor = solutionsCreator;
     116      randomCreator.Successor = variableCreator;
     117
     118      variableCreator.Successor = solutionsCreator;
    120119
    121120      solutionsCreator.NumberOfSolutions = new IntValue(1);
     
    129128      laMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
    130129
    131       qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
    132130      qualityTrailAnalyzer = new QualityTrailMultiAnalyzer();
    133       ParameterizeAnalyzers();
    134       UpdateAnalyzers();
    135 
    136       Initialize();
    137     }
    138 
    139     public override IDeepCloneable Clone(Cloner cloner) {
    140       return new LocalAnalysis(this, cloner);
     131      qualityTrailAnalyzer.UpdateIntervalParameter.Value = null;
     132      qualityTrailAnalyzer.UpdateIntervalParameter.ActualName = "MaximumIterations";
     133      AnalyzerParameter.Value.Operators.Add(qualityTrailAnalyzer, true);
     134
     135      RegisterEventHandlers();
    141136    }
    142137
    143138    public override void Prepare() {
    144       if (Problem != null)
    145         base.Prepare();
     139      if (Problem != null) base.Prepare();
    146140    }
    147141
    148142    #region Events
    149143    protected override void OnProblemChanged() {
    150       ParameterizeStochasticOperator(Problem.SolutionCreator);
    151       ParameterizeStochasticOperator(Problem.Evaluator);
    152       foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    153       ParameterizeSolutionsCreator();
    154       ParameterizeMainLoop();
     144      base.OnProblemChanged();
    155145      UpdateMutators();
    156       UpdateSelectors();
    157       UpdateAnalyzers();
    158       ParameterizeSelector();
    159       ParameterizeAnalyzers();
    160       ParameterizeIterationBasedOperators();
    161       Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    162       base.OnProblemChanged();
     146      Parameterize();
     147      Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
    163148    }
    164149    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
    165       ParameterizeStochasticOperator(Problem.SolutionCreator);
    166       ParameterizeSolutionsCreator();
    167150      base.Problem_SolutionCreatorChanged(sender, e);
     151      Parameterize();
    168152    }
    169153    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
    170       ParameterizeStochasticOperator(Problem.Evaluator);
    171       ParameterizeSolutionsCreator();
    172       ParameterizeMainLoop();
    173       ParameterizeSelector();
    174       ParameterizeAnalyzers();
    175       Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    176154      base.Problem_EvaluatorChanged(sender, e);
     155      Parameterize();
     156      Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
    177157    }
    178158    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    179       foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    180159      UpdateMutators();
    181       UpdateSelectors();
    182       UpdateAnalyzers();
    183       ParameterizeMainLoop();
    184       ParameterizeSelector();
    185       ParameterizeAnalyzers();
    186       ParameterizeIterationBasedOperators();
     160      Parameterize();
    187161      base.Problem_OperatorsChanged(sender, e);
    188162    }
    189163    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    190       ParameterizeMainLoop();
    191       ParameterizeSelector();
    192     }
    193     private void MutatorParameter_ValueChanged(object sender, EventArgs e) {
    194       ParameterizeMainLoop();
    195       ParameterizeSelector();
    196       ParameterizeAnalyzers();
     164      Parameterize();
    197165    }
    198166    #endregion
    199167
    200168    #region Helpers
    201     [StorableHook(HookType.AfterDeserialization)]
    202     private void Initialize() {
     169    private void RegisterEventHandlers() {
    203170      if (Problem != null) {
    204         Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    205       }
    206       MutatorParameter.ValueChanged += MutatorParameter_ValueChanged;
    207     }
    208     private void UpdateSelectors() {
    209       SelectorParameter.ValidValues.Clear();
    210       foreach (var s in ApplicationManager.Manager.GetInstances<ISelector>())
    211         SelectorParameter.ValidValues.Add(s);
    212     }
     171        Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
     172      }
     173    }
     174
    213175    private void UpdateMutators() {
     176      var selected = MutatorParameter.Value;
    214177      MutatorParameter.ValidValues.Clear();
    215178      foreach (var m in Problem.Operators.OfType<IManipulator>()) {
    216179        MutatorParameter.ValidValues.Add(m);
    217       }
    218     }
    219     private void UpdateAnalyzers() {
    220       AnalyzerParameter.Value.Operators.Clear();
    221       if (Problem != null) {
    222         foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) {
    223           foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
    224             param.Depth = 0;
    225           AnalyzerParameter.Value.Operators.Add(analyzer);
    226         }
    227       }
    228       AnalyzerParameter.Value.Operators.Add(qualityAnalyzer);
    229       AnalyzerParameter.Value.Operators.Add(qualityTrailAnalyzer);
    230     }
    231     private void ParameterizeSolutionsCreator() {
    232       SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
    233       SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
    234     }
    235     private void ParameterizeMainLoop() {
     180        if (selected != null && selected.GetType() == m.GetType()) MutatorParameter.Value = m;
     181      }
     182    }
     183
     184    protected virtual void Parameterize() {
     185      if (Problem == null) return;
     186
    236187      MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
    237188      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    238189      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    239     }
    240     private void ParameterizeStochasticOperator(IOperator op) {
    241       if (op is IStochasticOperator)
    242         ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
    243     }
    244     private void ParameterizeSelector() {
    245       if (Problem != null) {
    246         foreach (var op in SelectorParameter.ValidValues) {
    247           op.NumberOfSelectedSubScopesParameter.Value = new IntValue(1);
    248           op.CopySelected = new BoolValue(false);
    249           ISingleObjectiveSelector sos = op as ISingleObjectiveSelector;
    250           if (sos != null) {
    251             sos.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    252             sos.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    253           }
    254           IStochasticOperator so = op as IStochasticOperator;
    255           if (so != null) {
    256             so.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
    257           }
    258         }
    259       }
    260     }
    261     private void ParameterizeAnalyzers() {
    262       qualityAnalyzer.ResultsParameter.ActualName = "Results";
    263       if (Problem != null) {
    264         qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    265         qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
    266       }
    267     }
    268     private void ParameterizeIterationBasedOperators() {
    269       if (Problem != null) {
    270         foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
    271           op.IterationsParameter.ActualName = "Iterations";
    272           op.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
     190      foreach (var sOp in Problem.Operators.OfType<IStochasticOperator>()) {
     191        sOp.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
     192      }
     193      foreach (var iOp in Problem.Operators.OfType<IIterationBasedOperator>()) {
     194        iOp.IterationsParameter.ActualName = "Iterations";
     195        iOp.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
     196      }
     197      var sEval = Problem.Evaluator as IStochasticOperator;
     198      if (sEval != null) sEval.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
     199      var sCrea = Problem.SolutionCreator as IStochasticOperator;
     200      if (sCrea != null) sCrea.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
     201      var sSel = SelectorParameter.Value as IStochasticOperator;
     202      if (sSel != null) sSel.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
     203      var sel = SelectorParameter.Value as ISelector;
     204      if (sel != null) {
     205        sel.NumberOfSelectedSubScopesParameter.Value = new IntValue(1);
     206        sel.CopySelected = new BoolValue(false);
     207        var sos = sel as ISingleObjectiveSelector;
     208        if (sos != null) {
     209          sos.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
     210          sos.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    273211        }
    274212      }
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Algorithms/LocalAnalysisMainLoop.cs

    r7128 r13583  
    101101      #region Create operators
    102102      VariableCreator variableCreator = new VariableCreator();
    103       SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor();
    104       Assigner bestQualityInitializer = new Assigner();
    105103      Placeholder analyzer1 = new Placeholder();
    106       ResultsCollector resultsCollector1 = new ResultsCollector();
     104      SubScopesCounter evaluatedSolutionsCounter1 = new SubScopesCounter();
    107105      LeftSelector leftSelector = new LeftSelector();
    108106      SubScopesProcessor mainProcessor = new SubScopesProcessor();
     
    110108      Placeholder mutator = new Placeholder();
    111109      Placeholder evaluator = new Placeholder();
    112       IntCounter evaluatedMovesCounter = new IntCounter();
     110      SubScopesCounter evaluatedSolutionsCounter2 = new SubScopesCounter();
    113111      Placeholder selector = new Placeholder();
    114       SubScopesProcessor moveMakingProcessor = new SubScopesProcessor();
    115       UniformSubScopesProcessor selectedMoveMakingProcessor = new UniformSubScopesProcessor();
    116       QualityComparator qualityComparator = new QualityComparator();
    117       ConditionalBranch improvesQualityBranch = new ConditionalBranch();
    118       Assigner bestQualityUpdater = new Assigner();
     112      RightReducer rightReducer1 = new RightReducer();
     113      RightReducer rightReducer2 = new RightReducer();
    119114      Placeholder analyzer2 = new Placeholder();
    120       RightReducer rightReducer = new RightReducer();
    121       RightReducer rightReducer2 = new RightReducer();
    122115      IntCounter iterationsCounter = new IntCounter();
    123116      Comparator iterationsComparator = new Comparator();
     
    126119
    127120      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    128       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
    129       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue(0)));
    130 
    131       bestQualityInitializer.Name = "Initialize BestQuality";
    132       bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality";
    133       bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.ActualName;
     121      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
    134122
    135123      analyzer1.Name = "Analyzer (placeholder)";
    136124      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
    137125
    138       resultsCollector1.CopyValue = new BoolValue(false);
    139       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    140       resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
    141       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
    142       resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
     126      evaluatedSolutionsCounter1.Name = "EvaluatedSolutions++";
     127      evaluatedSolutionsCounter1.AccumulateParameter.Value = new BoolValue(true);
     128      evaluatedSolutionsCounter1.ValueParameter.ActualName = "EvaluatedSolutions";
    143129
    144130      leftSelector.CopySelected = new BoolValue(true);
    145131      leftSelector.NumberOfSelectedSubScopesParameter.ActualName = SampleSizeParameter.Name;
    146132
    147       mutationProcessor.Parallel = new BoolValue(true);
     133      mainProcessor.Name = "Main Processsor";
     134
     135      mutationProcessor.Parallel = new BoolValue(false);
    148136
    149137      mutator.Name = "(Mutator)";
     
    153141      evaluator.OperatorParameter.ActualName = "Evaluator";
    154142
    155       evaluatedMovesCounter.Name = "EvaluatedMoves++";
    156       evaluatedMovesCounter.ValueParameter.ActualName = "EvaluatedMoves";
    157       evaluatedMovesCounter.Increment = new IntValue(1);
     143      evaluatedSolutionsCounter2.Name = "EvaluatedSolutions++";
     144      evaluatedSolutionsCounter2.AccumulateParameter.Value = new BoolValue(true);
     145      evaluatedSolutionsCounter2.ValueParameter.ActualName = "EvaluatedSolutions";
    158146
    159       selector.Name = "Selector (placeholder)";
     147      selector.Name = "(Selector)";
    160148      selector.OperatorParameter.ActualName = SelectorParameter.Name;
    161149
    162       qualityComparator.LeftSideParameter.ActualName = QualityParameter.Name;
    163       qualityComparator.RightSideParameter.ActualName = "BestQuality";
    164       qualityComparator.ResultParameter.ActualName = "IsBetter";
    165 
    166       improvesQualityBranch.ConditionParameter.ActualName = "IsBetter";
    167 
    168       bestQualityUpdater.Name = "Update BestQuality";
    169       bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality";
    170       bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name;
    171 
    172       analyzer2.Name = "Analyzer (placeholder)";
     150      analyzer2.Name = "(Analyzer)";
    173151      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
    174152
     
    183161      iterationsComparator.ResultParameter.ActualName = "Terminate";
    184162
    185       resultsCollector2.CopyValue = new BoolValue(false);
    186       resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     163      resultsCollector2.CopyValue = new BoolValue(true);
     164      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     165      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions"));
    187166      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    188167
     
    193172      #region Create operator graph
    194173      OperatorGraph.InitialOperator = variableCreator;
    195       variableCreator.Successor = subScopesProcessor0;
    196       subScopesProcessor0.Operators.Add(bestQualityInitializer);
    197       subScopesProcessor0.Successor = resultsCollector1;
    198       bestQualityInitializer.Successor = analyzer1;
    199       analyzer1.Successor = null;
    200       resultsCollector1.Successor = leftSelector;
     174      variableCreator.Successor = evaluatedSolutionsCounter1;
     175      evaluatedSolutionsCounter1.Successor = analyzer1;
     176      analyzer1.Successor = leftSelector;
    201177      leftSelector.Successor = mainProcessor;
    202178      mainProcessor.Operators.Add(new EmptyOperator());
     
    204180      mainProcessor.Successor = rightReducer2;
    205181      mutationProcessor.Operator = mutator;
    206       mutationProcessor.Successor = selector;
     182      mutationProcessor.Successor = evaluatedSolutionsCounter2;
    207183      mutator.Successor = evaluator;
    208       evaluator.Successor = evaluatedMovesCounter;
    209       evaluatedMovesCounter.Successor = null;
    210       selector.Successor = moveMakingProcessor;
    211       moveMakingProcessor.Operators.Add(new EmptyOperator());
    212       moveMakingProcessor.Operators.Add(selectedMoveMakingProcessor);
    213       moveMakingProcessor.Successor = rightReducer;
    214       selectedMoveMakingProcessor.Operator = qualityComparator;
    215       selectedMoveMakingProcessor.Successor = null;
    216       qualityComparator.Successor = improvesQualityBranch;
    217       improvesQualityBranch.TrueBranch = bestQualityUpdater;
    218       improvesQualityBranch.FalseBranch = null;
    219       improvesQualityBranch.Successor = analyzer2;
    220       bestQualityUpdater.Successor = null;
    221       analyzer2.Successor = null;
    222       rightReducer.Successor = null;
     184      evaluator.Successor = null;
     185      evaluatedSolutionsCounter2.Successor = selector;
     186      selector.Successor = rightReducer1;
     187      rightReducer1.Successor = null;
    223188      rightReducer2.Successor = iterationsCounter;
    224       iterationsCounter.Successor = iterationsComparator;
    225       iterationsComparator.Successor = resultsCollector2;
    226       resultsCollector2.Successor = iterationsTermination;
    227       iterationsTermination.TrueBranch = null;
     189      iterationsCounter.Successor = analyzer2;
     190      analyzer2.Successor = iterationsComparator;
     191      iterationsComparator.Successor = iterationsTermination;
     192      iterationsTermination.TrueBranch = resultsCollector2;
    228193      iterationsTermination.FalseBranch = leftSelector;
    229194      #endregion
    230195    }
    231 
    232     public override IOperation Apply() {
    233       return base.Apply();
    234     }
    235196  }
    236197}
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/EnumerableExtensions.cs

    r7128 r13583  
    1919 */
    2020#endregion
     21
    2122using System;
    2223using System.Collections.Generic;
     24
    2325namespace HeuristicLab.Analysis.FitnessLandscape {
    2426
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/FitnessCloudAnalyzer.cs

    r7176 r13583  
    1919 */
    2020#endregion
     21
    2122using System.Drawing;
    2223using System.Linq;
     
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    30 namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
     31namespace HeuristicLab.Analysis.FitnessLandscape {
    3132
    3233  [StorableClass]
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/IQualityTrailAnalyzer.cs

    r7128 r13583  
    1919 */
    2020#endregion
     21
    2122using HeuristicLab.Optimization;
     23
    2224namespace HeuristicLab.Analysis.FitnessLandscape {
    2325  public interface IQualityTrailAnalyzer : IAnalyzer { }
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/InformationAnalysis.cs

    r9142 r13583  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
    425
    5 namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
     26namespace HeuristicLab.Analysis.FitnessLandscape {
    627
    728  public class InformationAnalysis {
     
    1940    public List<double> PartialInformationContent { get; private set; }
    2041    public List<double> DensityBasinInformation { get; private set; }
    21     public List<double> TotalEntropy { get; private set; } 
     42    public List<double> TotalEntropy { get; private set; }
    2243    public List<double> QualityDelta { get; private set; }
    2344    public double InformationStability { get; private set; }
     
    89110
    90111      #region types, fields and properties
    91       public enum Form {Uni, NonUni, Any}
     112      public enum Form { Uni, NonUni, Any }
    92113
    93114      private readonly Slope[] slopes;
    94115
    95116      private static readonly Dictionary<Tuple<Form, int>, IList<Shape>> SHAPES =
    96         new Dictionary<Tuple<Form,int>,IList<Shape>>();
     117        new Dictionary<Tuple<Form, int>, IList<Shape>>();
    97118      #endregion
    98119
     
    130151
    131152      private Shape Extend(Slope s) {
    132         return new Shape(slopes.Concat(new[] {s}));
     153        return new Shape(slopes.Concat(new[] { s }));
    133154      }
    134155
     
    157178      #region IEnumerable Members
    158179      public IEnumerator<Slope> GetEnumerator() {
    159         return (IEnumerator<Slope>) slopes.GetEnumerator();
     180        return (IEnumerator<Slope>)slopes.GetEnumerator();
    160181      }
    161182      System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
     
    171192        if (other.Length > Length)
    172193          return 1;
    173         for (var i = 0; i<Length; i++) {
     194        for (var i = 0; i < Length; i++) {
    174195          var d = slopes[i].CompareTo(other.slopes[i]);
    175196          if (d != 0)
     
    184205      }
    185206      public override int GetHashCode() {
    186         return slopes.Aggregate(0, (a, s) => a*3 + ((int) s + 1)).GetHashCode();
     207        return slopes.Aggregate(0, (a, s) => a * 3 + ((int)s + 1)).GetHashCode();
    187208      }
    188209
     
    197218    private static IEnumerable<Slope> Slopes(double eps, IEnumerable<double> differences) {
    198219      return differences.Select(d => (d > eps ? Slope.Up : (d < -eps ? Slope.Down : 0)));
    199     } 
     220    }
    200221
    201222    private static IEnumerable<Shape> Shapes(int size, IEnumerable<Slope> slopes) {
     
    243264
    244265    private static IEnumerable<double> Differences(IEnumerable<double> values) {
    245       return Utils.Delta(values, (x, y) => y - x);
     266      return values.Delta((x, y) => y - x);
    246267    }
    247268
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/InformationAnalyzer.cs

    r9142 r13583  
    2020#endregion
    2121
    22 using System;
    23 using System.Linq;
    24 using HeuristicLab.Analysis.FitnessLandscape.DataTables;
    2522using HeuristicLab.Common;
    2623using HeuristicLab.Core;
    2724using HeuristicLab.Data;
    2825using HeuristicLab.Operators;
    29 using HeuristicLab.Optimization.Operators;
     26using HeuristicLab.Optimization;
    3027using HeuristicLab.Parameters;
    3128using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using System.Linq;
    3230
    33 namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
     31namespace HeuristicLab.Analysis.FitnessLandscape {
    3432
    3533  [StorableClass]
    36   public class InformationAnalyzer : AlgorithmOperator, IQualityTrailAnalyzer {
     34  public class InformationAnalyzer : SingleSuccessorOperator, IQualityTrailAnalyzer {
    3735    public bool EnabledByDefault {
    3836      get { return false; }
     
    4341      get { return (LookupParameter<DataTable>)Parameters["Quality Trail"]; }
    4442    }
    45     public LookupParameter<InformationStabilityTable> InformationStabilityParameter {
    46       get { return (LookupParameter<InformationStabilityTable>)Parameters["Information Stability"]; }
    47     }
    48     public LookupParameter<InformationAnalysisTable> InformationParameter {
    49       get { return (LookupParameter<InformationAnalysisTable>)Parameters["Information"]; }
    50     }
    51     public LookupParameter<VariableCollection> ResultsParameter {
    52       get { return (LookupParameter<VariableCollection>)Parameters["Results"]; }
     43    public LookupParameter<ResultCollection> ResultsParameter {
     44      get { return (LookupParameter<ResultCollection>)Parameters["Results"]; }
    5345    }
    5446    public ValueLookupParameter<IntValue> NQuantilesParameter {
     
    5850      get { return (ValueLookupParameter<IntValue>)Parameters["ShapeSize"]; }
    5951    }
    60     public LookupParameter<DoubleValue> InformationContentValueParameter {
    61       get { return (LookupParameter<DoubleValue>)Parameters["InformationContentValue"]; }
     52    public LookupParameter<DoubleValue> InformationContentParameter {
     53      get { return (LookupParameter<DoubleValue>)Parameters["InformationContent"]; }
    6254    }
    63     public LookupParameter<DoubleValue> PartialInformationContentValueParameter {
    64       get { return (LookupParameter<DoubleValue>)Parameters["PartialInformationContentValue"]; }
     55    public LookupParameter<DoubleValue> PartialInformationContentParameter {
     56      get { return (LookupParameter<DoubleValue>)Parameters["PartialInformationContent"]; }
    6557    }
    66     public LookupParameter<DoubleValue> DensityBasinInformationValueParameter {
    67       get { return (LookupParameter<DoubleValue>)Parameters["DensityBasinInformationValue"]; }
     58    public LookupParameter<DoubleValue> DensityBasinInformationParameter {
     59      get { return (LookupParameter<DoubleValue>)Parameters["DensityBasinInformation"]; }
    6860    }
    69     public LookupParameter<DoubleValue> TotalEntropyValueParameter {
    70       get { return (LookupParameter<DoubleValue>)Parameters["TotalEntropyValue"]; }
     61    public LookupParameter<DoubleValue> TotalEntropyParameter {
     62      get { return (LookupParameter<DoubleValue>)Parameters["TotalEntropy"]; }
    7163    }
    72     public LookupParameter<DoubleValue> InformationStabilityValueParameter {
    73       get { return (LookupParameter<DoubleValue>)Parameters["InformationStabilityValue"]; }
     64    public LookupParameter<DoubleValue> InformationStabilityParameter {
     65      get { return (LookupParameter<DoubleValue>)Parameters["InformationStability"]; }
    7466    }
    75     public LookupParameter<IntValue> RegularityValueParameter {
    76       get { return (LookupParameter<IntValue>)Parameters["RegularityValue"]; }
     67    public LookupParameter<DoubleValue> RegularityParameter {
     68      get { return (LookupParameter<DoubleValue>)Parameters["Regularity"]; }
    7769    }
    78     public LookupParameter<IntValue> DiversityValueParameter {
    79       get { return (LookupParameter<IntValue>)Parameters["DiversityValue"]; }
     70    public LookupParameter<DoubleValue> DiversityParameter {
     71      get { return (LookupParameter<DoubleValue>)Parameters["Diversity"]; }
    8072    }
    81 
    82     #region Peaks
    8373    public LookupParameter<DoubleValue> PeakInformationContentParameter {
    84       get { return (LookupParameter<DoubleValue>) Parameters["PeakInformationContent"]; }
    85     }
    86     public LookupParameter<DoubleValue> PeakInformationContentQualityDeltaParameter {
    87       get { return (LookupParameter<DoubleValue>) Parameters["PeakInformationContentQualityDelta"]; }
     74      get { return (LookupParameter<DoubleValue>)Parameters["PeakInformationContent"]; }
    8875    }
    8976    public LookupParameter<DoubleValue> PeakDensityBasinInformationParameter {
    90       get { return (LookupParameter<DoubleValue>) Parameters["PeakDensityBasinInformation"]; }
     77      get { return (LookupParameter<DoubleValue>)Parameters["PeakDensityBasinInformation"]; }
    9178    }
    92     public LookupParameter<DoubleValue> PeakDensityBasinInformationQualityDeltaParameter {
    93       get { return (LookupParameter<DoubleValue>) Parameters["PeakDensityBasinInformationQualityDelta"]; }
    94     }
    95 
    96 
    9779    #endregion
    98 
    99     #endregion
    100 
    101     private InformationStabilityTable InformationStability {
    102       get { return InformationStabilityParameter.ActualValue; }
    103     }
    104     private double InformationContentValue {
    105       set { InformationContentValueParameter.ActualValue = new DoubleValue(value); }
    106     }
    107     private double PartialInformationContentValue {
    108       set { PartialInformationContentValueParameter.ActualValue = new DoubleValue(value); }
    109     }
    110     private double DensityBasinInformationValue {
    111       set { DensityBasinInformationValueParameter.ActualValue = new DoubleValue(value); }
    112     }
    113     private double TotalEntropyValue {
    114       set { TotalEntropyValueParameter.ActualValue = new DoubleValue(value); }
    115     }
    116     private double InformationStabilityValue {
    117       set { InformationStabilityValueParameter.ActualValue = new DoubleValue(value); }
    118     }
    11980
    12081    [StorableConstructor]
     
    12485    public InformationAnalyzer() {
    12586      Parameters.Add(new LookupParameter<DataTable>("Quality Trail", "The qualities of the solutions"));
    126       Parameters.Add(new LookupParameter<InformationStabilityTable>("Information Stability", "Information stability development over time"));
    127       Parameters.Add(new LookupParameter<InformationAnalysisTable>("Information", "A data table that information theoretic fitness landscape characteristics"));
    128       Parameters.Add(new LookupParameter<VariableCollection>("Results", "The collection of all results of this algorithm"));
     87      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection of all results of this algorithm"));
    12988
    13089      Parameters.Add(new ValueLookupParameter<IntValue>("NQuantiles", "The number of delta quantiles to display", new IntValue(20)));
    13190      Parameters.Add(new ValueLookupParameter<IntValue>("ShapeSize", "The number of slopes to consider as shapes.", new IntValue(2)));
    13291
    133       Parameters.Add(new LookupParameter<DoubleValue>("InformationContentValue", "The information content H(0) at eps = 0"));
    134       Parameters.Add(new LookupParameter<DoubleValue>("PartialInformationContentValue", "Partial information content M(0) at eps = 0"));
    135       Parameters.Add(new LookupParameter<DoubleValue>("DensityBasinInformationValue", "Density Basin Information h(0) at eps = 0"));
    136       Parameters.Add(new LookupParameter<DoubleValue>("TotalEntropyValue", "The overall disorder in the trajectory"));
    137       Parameters.Add(new LookupParameter<DoubleValue>("InformationStabilityValue", "Information Stability Value"));
    138       Parameters.Add(new LookupParameter<IntValue>("RegularityValue", "The number of different quality differences"));
    139       Parameters.Add(new LookupParameter<IntValue>("DiversityValue", "The number of different quality values"));
     92      Parameters.Add(new LookupParameter<DoubleValue>("InformationContent", "The information content H(0) at eps = 0"));
     93      Parameters.Add(new LookupParameter<DoubleValue>("PartialInformationContent", "Partial information content M(0) at eps = 0"));
     94      Parameters.Add(new LookupParameter<DoubleValue>("DensityBasinInformation", "Density Basin Information h(0) at eps = 0"));
     95      Parameters.Add(new LookupParameter<DoubleValue>("TotalEntropy", "The overall disorder in the trajectory"));
     96      Parameters.Add(new LookupParameter<DoubleValue>("InformationStability", "Information Stability Value"));
     97      Parameters.Add(new LookupParameter<DoubleValue>("Regularity", "The number of different quality differences"));
     98      Parameters.Add(new LookupParameter<DoubleValue>("Diversity", "The number of different quality values"));
    14099      Parameters.Add(new LookupParameter<DoubleValue>("PeakInformationContent", "Maximum information content at any quality delta."));
    141       Parameters.Add(new LookupParameter<DoubleValue>("PeakInformationContentQualityDelta", "Quality delta with maximum information content."));
    142100      Parameters.Add(new LookupParameter<DoubleValue>("PeakDensityBasinInformation", "Maximum density basin information at any quality delta."));
    143       Parameters.Add(new LookupParameter<DoubleValue>("PeakDensityBasinInformationQualityDelta", "Quality delta with maximum density basin information."));
    144 
    145       var resultsCollector = new ResultsCollector();
    146       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(InformationParameter.Name));
    147       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(InformationStabilityParameter.Name));
    148       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(InformationContentValueParameter.Name));
    149       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(PartialInformationContentValueParameter.Name));
    150       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(DensityBasinInformationValueParameter.Name));
    151       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(TotalEntropyValueParameter.Name));
    152       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(InformationStabilityValueParameter.Name));
    153       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>(RegularityValueParameter.Name));
    154       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>(DiversityValueParameter.Name));
    155       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(PeakInformationContentParameter.Name));
    156       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(PeakInformationContentQualityDeltaParameter.Name));
    157       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(PeakDensityBasinInformationParameter.Name));
    158       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(PeakDensityBasinInformationQualityDeltaParameter.Name));
    159 
    160       OperatorGraph.InitialOperator = resultsCollector;
    161       resultsCollector.Successor = null;
    162101    }
    163102
     
    167106
    168107    public override IOperation Apply() {
    169       DataTable qualityTrail = QualityTrailParameter.ActualValue;
    170       if (qualityTrail != null && qualityTrail.Rows.Count > 0) {
    171         EnsureExistsInformationStabilityTable();
    172         EnsureExistsInformationTable();
    173         AnalyseInformation();
    174       }
     108      var qualityTrail = QualityTrailParameter.ActualValue;
     109      if (qualityTrail == null || qualityTrail.Rows.Count == 0) return base.Apply();
     110
     111      var qualities = QualityTrailParameter.ActualValue.Rows.First().Values.ToList();
     112      if (qualities.Count <= 2) return base.Apply();
     113
     114      var nQuantiles = NQuantilesParameter.ActualValue.Value;
     115      var shapeSize = ShapeSizeParameter.ActualValue.Value;
     116      var results = ResultsParameter.ActualValue;
     117
     118      var analysis = new InformationAnalysis(qualities, nQuantiles, shapeSize);
     119      var ic = new DoubleValue(analysis.InformationContent.FirstOrDefault());
     120      InformationContentParameter.ActualValue = ic;
     121      AddOrUpdateResult(results, InformationContentParameter.Name, ic);
     122      var pic = new DoubleValue(analysis.PartialInformationContent.FirstOrDefault());
     123      PartialInformationContentParameter.ActualValue = pic;
     124      AddOrUpdateResult(results, PartialInformationContentParameter.Name, pic);
     125      var dbi = new DoubleValue(analysis.DensityBasinInformation.FirstOrDefault());
     126      DensityBasinInformationParameter.ActualValue = dbi;
     127      AddOrUpdateResult(results, DensityBasinInformationParameter.Name, dbi);
     128      var @is = new DoubleValue(analysis.InformationStability);
     129      InformationStabilityParameter.ActualValue = @is;
     130      AddOrUpdateResult(results, InformationStabilityParameter.Name, @is);
     131      var regularity = new DoubleValue(1.0 * analysis.Regularity / qualities.Count);
     132      RegularityParameter.ActualValue = regularity;
     133      AddOrUpdateResult(results, RegularityParameter.Name, regularity);
     134      var diversity = new DoubleValue(1.0 * analysis.Diversity / qualities.Count);
     135      DiversityParameter.ActualValue = diversity;
     136      AddOrUpdateResult(results, DiversityParameter.Name, diversity);
     137      var totalEntropy = new DoubleValue(analysis.TotalEntropy.FirstOrDefault());
     138      TotalEntropyParameter.ActualValue = totalEntropy;
     139      AddOrUpdateResult(results, TotalEntropyParameter.Name, totalEntropy);
     140      var peakIc = new DoubleValue(analysis.PeakInformationContent.Value);
     141      PeakInformationContentParameter.ActualValue = peakIc;
     142      AddOrUpdateResult(results, PeakInformationContentParameter.Name, peakIc);
     143      var peakDbi = new DoubleValue(analysis.PeakDensityBasinInformation.Value);
     144      PeakDensityBasinInformationParameter.ActualValue = peakDbi;
     145      AddOrUpdateResult(results, PeakDensityBasinInformationParameter.Name, peakDbi);
     146
    175147      return base.Apply();
    176148    }
    177149
    178     private void AnalyseInformation() {
    179       int nQuantiles = NQuantilesParameter.ActualValue.Value;
    180       int shapeSize = ShapeSizeParameter.ActualValue.Value;
    181       var qualities = QualityTrailParameter.ActualValue.Rows.First().Values.ToList();
    182       if (qualities.Count > 2) {
    183         InformationAnalysisTable informationTable = InformationParameter.ActualValue;
    184         var informationContent = informationTable.Rows["Information Content"].Values;
    185         var partialInformationContent = informationTable.Rows["Partial Information Content"].Values;
    186         var densityBasinInformation = informationTable.Rows["Density Basin Information"].Values;
    187         var totalEntropy = informationTable.Rows["Total Entropy"].Values;
    188         var qualityDelta = informationTable.Rows["Quality Delta"].Values;
    189         var analysis = new InformationAnalysis(qualities, nQuantiles, shapeSize);
    190         InformationStability.Rows["Regularity"].Values.Add(analysis.Regularity);
    191         InformationStability.Rows["Diversity"].Values.Add(analysis.Diversity);
    192         InformationStability.Rows["Relative Regularity"].Values.Add(1.0*analysis.Regularity/qualities.Count);
    193         InformationStability.Rows["Relative Diversity"].Values.Add(1.0*analysis.Diversity/qualities.Count);
    194         InformationStability.Rows["Information Stability"].Values.Add(analysis.InformationStability);
    195         informationContent.Clear();
    196         informationContent.AddRange(analysis.InformationContent);
    197         partialInformationContent.Clear();
    198         partialInformationContent.AddRange(analysis.PartialInformationContent);
    199         densityBasinInformation.Clear();
    200         densityBasinInformation.AddRange(analysis.DensityBasinInformation);
    201         totalEntropy.Clear();
    202         totalEntropy.AddRange(analysis.TotalEntropy);
    203         qualityDelta.Clear();
    204         qualityDelta.AddRange(analysis.QualityDelta);
    205         InformationContentValue = analysis.InformationContent.FirstOrDefault();
    206         PartialInformationContentValue = analysis.PartialInformationContent.FirstOrDefault();
    207         DensityBasinInformationValue = analysis.DensityBasinInformation.FirstOrDefault();
    208         InformationStabilityValue = analysis.InformationStability;
    209         RegularityValueParameter.ActualValue = new IntValue(analysis.Regularity);
    210         DiversityValueParameter.ActualValue = new IntValue(analysis.Diversity);
    211         if (analysis.PeakInformationContent != null) {
    212           PeakInformationContentParameter.ActualValue = new DoubleValue(analysis.PeakInformationContent.Value);
    213           PeakInformationContentQualityDeltaParameter.ActualValue = new DoubleValue(analysis.PeakInformationContent.QualityDelta);
    214         }
    215         if (analysis.PeakDensityBasinInformation != null) {
    216           PeakDensityBasinInformationParameter.ActualValue = new DoubleValue(analysis.PeakDensityBasinInformation.Value);
    217           PeakDensityBasinInformationQualityDeltaParameter.ActualValue = new DoubleValue(analysis.PeakDensityBasinInformation.QualityDelta);
    218         }
    219       }
    220     }
    221 
    222     private void EnsureExistsInformationTable() {
    223       InformationAnalysisTable information = InformationParameter.ActualValue;
    224       if (information == null) {
    225         information = new InformationAnalysisTable("Information");
    226         information.Rows.Add(new DataRow("Information Content"));
    227         information.Rows.Add(new DataRow("Partial Information Content"));
    228         information.Rows.Add(new DataRow("Density Basin Information"));
    229         information.Rows.Add(new DataRow("Total Entropy"));
    230         information.Rows.Add(new DataRow("Quality Delta") {VisualProperties = {SecondYAxis = true}});
    231         InformationParameter.ActualValue = information;
    232       }
    233     }
    234 
    235     private void EnsureExistsInformationStabilityTable() {
    236       InformationStabilityTable informationStability = InformationStabilityParameter.ActualValue;
    237       if (informationStability == null) {
    238         informationStability = new InformationStabilityTable("Information Stability");
    239         informationStability.Rows.Add(new DataRow("Information Stability"));
    240         informationStability.Rows.Add(new DataRow("Relative Regularity"));
    241         informationStability.Rows.Add(new DataRow("Relative Diversity"));
    242         informationStability.Rows.Add(new DataRow("Regularity") {VisualProperties = {SecondYAxis = true}});
    243         informationStability.Rows.Add(new DataRow("Diversity") {VisualProperties = {SecondYAxis = true}});
    244         InformationStabilityParameter.ActualValue = informationStability;
    245       }
     150    private static void AddOrUpdateResult(ResultCollection results, string name, IItem item, bool clone = false) {
     151      IResult r;
     152      if (!results.TryGetValue(name, out r)) {
     153        results.Add(new Result(name, clone ? (IItem)item.Clone() : item));
     154      } else r.Value = clone ? (IItem)item.Clone() : item;
    246155    }
    247156  }
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/QualityTrailMultiAnalyzer.cs

    r10299 r13583  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
    22 using System.Linq;
    23 using HeuristicLab.Collections;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
     
    2725using HeuristicLab.Operators;
    2826using HeuristicLab.Optimization;
    29 using HeuristicLab.Optimization.Operators;
    3027using HeuristicLab.Parameters;
    3128using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3229using HeuristicLab.PluginInfrastructure;
     30using System.Linq;
     31
    3332namespace HeuristicLab.Analysis.FitnessLandscape {
    34 
    3533  [Item("QualityTrailAnalyzer", "An analyzer that creates a quality trail which can be further analyzed by several analyzers.")]
    3634  [StorableClass]
     
    4442    }
    4543
    46     public ValueLookupParameter<IntValue> UpdateIntervalParameter {
    47       get { return (ValueLookupParameter<IntValue>)Parameters["QualityTrailUpdateInterval"]; }
     44    public IValueLookupParameter<IntValue> UpdateIntervalParameter {
     45      get { return (IValueLookupParameter<IntValue>)Parameters["QualityTrailUpdateInterval"]; }
    4846    }
    49     public LookupParameter<IntValue> UpdateCounterParameter {
    50       get { return (LookupParameter<IntValue>)Parameters["QualityTrailUpdateCounter"]; }
     47    public ILookupParameter<IntValue> UpdateCounterParameter {
     48      get { return (ILookupParameter<IntValue>)Parameters["QualityTrailUpdateCounter"]; }
    5149    }
    52     public ValueLookupParameter<DataTable> QualityTrailParameter {
    53       get { return (ValueLookupParameter<DataTable>)Parameters["Quality Trail"]; }
     50    public ILookupParameter<DataTable> QualityTrailParameter {
     51      get { return (ILookupParameter<DataTable>)Parameters["Quality Trail"]; }
    5452    }
    55     public LookupParameter<VariableCollection> ResultsParameter {
    56       get { return (LookupParameter<VariableCollection>)Parameters["Results"]; }
     53    public ILookupParameter<ResultCollection> ResultsParameter {
     54      get { return (ILookupParameter<ResultCollection>)Parameters["Results"]; }
    5755    }
    58     public LookupParameter<DoubleValue> QualityParameter {
    59       get { return (LookupParameter<DoubleValue>)Parameters["Quality"]; }
     56    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
     57      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
    6058    }
    61     public ScopeTreeLookupParameter<DoubleValue> QualitiesParameter {
    62       get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Qualities"]; }
    63     }
    64     public OperatorParameter ResultsCollector {
    65       get { return (OperatorParameter)Parameters["ResultsCollector"]; }
    66     }
    67     public LookupParameter<BoolValue> MaximizationParameter {
    68       get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; }
     59    public ILookupParameter<BoolValue> MaximizationParameter {
     60      get { return (ILookupParameter<BoolValue>)Parameters["Maximization"]; }
    6961    }
    7062
     
    7769    protected QualityTrailMultiAnalyzer(bool deserializing) : base(deserializing) { }
    7870    protected QualityTrailMultiAnalyzer(QualityTrailMultiAnalyzer original, Cloner cloner) : base(original, cloner) { }
    79 
    8071    public QualityTrailMultiAnalyzer()
    8172      : base() {
    8273      Parameters.Add(new ValueLookupParameter<IntValue>("QualityTrailUpdateInterval", "The interval at which the contained analyzers should be applied.", new IntValue(1)));
    8374      Parameters.Add(new LookupParameter<IntValue>("QualityTrailUpdateCounter", "The number of times the Analyzer was called since the last update."));
    84       Parameters.Add(new ValueLookupParameter<DataTable>("Quality Trail", "All historical quality values throughout the algorithm run"));
    85       Parameters.Add(new LookupParameter<DoubleValue>("Quality", "Single quality value from the current iteration/generation"));
    86       Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Qualities", "Quality values of the whole population", "Quality", 1));
    87       Parameters.Add(new LookupParameter<VariableCollection>("Results", "The collected results"));
    88       Parameters.Add(new OperatorParameter("ResultsCollector"));
     75      Parameters.Add(new LookupParameter<DataTable>("Quality Trail", "All historical quality values throughout the algorithm run"));
     76      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "Quality values of the whole population", 1));
     77      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collected results"));
    8978      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "Whether the problem is a maximization problem"));
    9079
    91       foreach (var analyzer in ApplicationManager.Manager.GetInstances<IQualityTrailAnalyzer>())
    92         Operators.Add(analyzer);
    93 
    94       var resultsCollector = new ResultsCollector();
    95       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(QualityTrailParameter.Name));
    96       ResultsCollector.Value = resultsCollector;
     80      foreach (var analyzer in ApplicationManager.Manager.GetInstances<IQualityTrailAnalyzer>()) {
     81        Operators.Add(analyzer, !(analyzer is FitnessCloudAnalyzer));
     82      }
    9783    }
    9884
     
    10288
    10389    public override IOperation InstrumentedApply() {
    104       UpdateQualityTrail();
    105 
    106       IntValue interval = UpdateIntervalParameter.ActualValue;
    107       if (interval == null) interval = new IntValue(1);
    108 
    109       IntValue counter = UpdateCounterParameter.ActualValue;
    110       if (counter == null) {
    111         counter = new IntValue(interval.Value);
    112         UpdateCounterParameter.ActualValue = counter;
    113       } else counter.Value++;
    114 
    115       OperationCollection next = new OperationCollection();
    116       next.Add(ExecutionContext.CreateOperation(ResultsCollector.Value));
    117       if (counter.Value == interval.Value) {
    118         counter.Value = 0;
    119         foreach (IndexedItem<IQualityTrailAnalyzer> item in Operators.CheckedItems)
    120           next.Add(ExecutionContext.CreateOperation(item.Value));
    121 
    122       }
    123       next.Add(base.InstrumentedApply());
    124       return next;
    125     }
    126 
    127     private void UpdateQualityTrail() {
    128       DataTable qualityTrail = QualityTrailParameter.ActualValue;
     90      var maximization = MaximizationParameter.ActualValue.Value;
     91      var qualityTrail = QualityTrailParameter.ActualValue;
    12992      if (qualityTrail == null) {
    13093        qualityTrail = new DataTable("Quality Trail");
     
    13295        QualityTrailParameter.ActualValue = qualityTrail;
    13396      }
    134       if (QualityParameter.ActualValue != null)
    135         qualityTrail.Rows["Qualities"].Values.Add(QualityParameter.ActualValue.Value);
    136       if (QualitiesParameter.ActualName != null &&
    137         QualitiesParameter.ActualValue.Count() > 0 &&
    138         MaximizationParameter != null)
    139         if (MaximizationParameter.ActualValue.Value)
    140           qualityTrail.Rows["Qualities"].Values.Add(QualitiesParameter.ActualValue.Select(dv => dv.Value).Max());
    141         else
    142           qualityTrail.Rows["Qualities"].Values.Add(QualitiesParameter.ActualValue.Select(dv => dv.Value).Min());
     97      var qualities = QualityParameter.ActualValue.Select(x => x.Value);
     98      qualityTrail.Rows["Qualities"].Values.Add(maximization ? qualities.Max() : qualities.Min());
    14399
     100      var interval = UpdateIntervalParameter.ActualValue.Value;
     101      var counter = UpdateCounterParameter.ActualValue;
     102      if (counter == null) {
     103        counter = new IntValue(0);
     104        UpdateCounterParameter.ActualValue = counter;
     105      }
     106      counter.Value++;
     107
     108      var next = new OperationCollection();
     109      if (counter.Value % interval == 0) {
     110        counter.Value = 0;
     111        foreach (var item in Operators.CheckedItems) next.Add(ExecutionContext.CreateOperation(item.Value));
     112      }
     113      next.Add(base.InstrumentedApply());
     114      return next;
    144115    }
    145116  }
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/RuggednessAnalyzer.cs

    r7176 r13583  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
    22 using System.Linq;
    23 using HeuristicLab.Analysis.FitnessLandscape.DataTables;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Data;
    2725using HeuristicLab.Operators;
    28 using HeuristicLab.Optimization.Operators;
     26using HeuristicLab.Optimization;
    2927using HeuristicLab.Parameters;
    3028using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using System.Linq;
    3130
    32 namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
    33 
     31namespace HeuristicLab.Analysis.FitnessLandscape {
     32  [Item("Ruggedness Analyzer", "Analyzes autocorrelation for one mutation step and correlation length.")]
    3433  [StorableClass]
    35   public class RuggednessAnalyzer : AlgorithmOperator, IQualityTrailAnalyzer {
     34  public class RuggednessAnalyzer : SingleSuccessorOperator, IQualityTrailAnalyzer {
    3635    public bool EnabledByDefault {
    3736      get { return false; }
     
    4241      get { return (LookupParameter<DataTable>)Parameters["Quality Trail"]; }
    4342    }
    44     public LookupParameter<DataTable> CorrelationLengthTableParameter {
    45       get { return (LookupParameter<DataTable>)Parameters["CorrelationLengthTable"]; }
    46     }
    47     public LookupParameter<AutoCorrelationTable> AutocorrelationParameter {
    48       get { return (LookupParameter<AutoCorrelationTable>)Parameters["Autocorrelation"]; }
    49     }
    50     public LookupParameter<VariableCollection> ResultsParameter {
    51       get { return (LookupParameter<VariableCollection>)Parameters["Results"]; }
     43    public LookupParameter<ResultCollection> ResultsParameter {
     44      get { return (LookupParameter<ResultCollection>)Parameters["Results"]; }
    5245    }
    5346    public LookupParameter<DoubleValue> AutoCorrelation1Parameter {
     
    6255    protected RuggednessAnalyzer(bool deserializing) : base(deserializing) { }
    6356    protected RuggednessAnalyzer(RuggednessAnalyzer original, Cloner cloner) : base(original, cloner) { }
    64 
    6557    public RuggednessAnalyzer() {
    6658      Parameters.Add(new LookupParameter<DataTable>("Quality Trail", "The quality of the solution"));
    67       Parameters.Add(new LookupParameter<DataTable>("CorrelationLengthTable", "Maximum nr of steps between statistically significantly correlated quality values"));
    68       Parameters.Add(new LookupParameter<AutoCorrelationTable>("Autocorrelation", "Autocorrelation function of successive quality values"));
    69       Parameters.Add(new LookupParameter<VariableCollection>("Results", "The collection of all results of this algorithm"));
     59      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection of all results of this algorithm"));
    7060      Parameters.Add(new LookupParameter<DoubleValue>("AutoCorrelation1", "Autocorrelation for one mutation step."));
    7161      Parameters.Add(new LookupParameter<IntValue>("CorrelationLength", "The correlation length."));
    72 
    73       var resultsCollector = new ResultsCollector();
    74       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(CorrelationLengthTableParameter.Name));
    75       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(AutocorrelationParameter.Name));
    76       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(AutoCorrelation1Parameter.Name));
    77       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>(CorrelationLengthParameter.Name));
    78 
    79       OperatorGraph.InitialOperator = resultsCollector;
    80       resultsCollector.Successor = null;
    8162    }
    8263
     
    8667
    8768    public override IOperation Apply() {
    88       DataTable correlationLengthTable = GetOrCreateCorrelationLengthTable();
    89       AutoCorrelationTable autocorrelationTable = GetOrCreateAutoCorrelationTable();
    90       DataTable qualityTrail = QualityTrailParameter.ActualValue;
    91       if (qualityTrail != null && qualityTrail.Rows.Count > 0) {
    92         double[] autocorrelationValues;
    93         int correlationLength = RuggednessCalculator.CalculateCorrelationLength(qualityTrail.Rows.First().Values.ToArray(), out autocorrelationValues);
    94         correlationLengthTable.Rows["Correlation Length"].Values.Add(correlationLength);
    95         autocorrelationTable.Rows["Auto Correlation"].Values.Clear();
    96         autocorrelationTable.Rows["Auto Correlation"].Values.AddRange(autocorrelationValues);
    97         CorrelationLengthParameter.ActualValue = new IntValue(correlationLength);
    98         AutoCorrelation1Parameter.ActualValue = new DoubleValue(autocorrelationValues.Length > 1 ? autocorrelationValues[1] : 0.0);
    99       }
     69      var qualityTrail = QualityTrailParameter.ActualValue;
     70      if (qualityTrail == null || qualityTrail.Rows.Count <= 0) return base.Apply();
     71      var results = ResultsParameter.ActualValue;
     72      double[] autocorrelationValues;
     73      var correlationLength = RuggednessCalculator.CalculateCorrelationLength(qualityTrail.Rows.First().Values.ToArray(), out autocorrelationValues);
     74      var cl = new IntValue(correlationLength);
     75      CorrelationLengthParameter.ActualValue = cl;
     76      AddOrUpdateResult(results, CorrelationLengthParameter.Name, cl);
     77      var ac1 = new DoubleValue(autocorrelationValues.Length > 1 ? autocorrelationValues[1] : 0.0);
     78      AutoCorrelation1Parameter.ActualValue = ac1;
     79      AddOrUpdateResult(results, AutoCorrelation1Parameter.Name, ac1);
    10080      return base.Apply();
    10181    }
    10282
    103     private AutoCorrelationTable GetOrCreateAutoCorrelationTable() {
    104       AutoCorrelationTable autocorrelationTable = AutocorrelationParameter.ActualValue;
    105       if (autocorrelationTable == null) {
    106         autocorrelationTable = new AutoCorrelationTable("Auto Correlation");
    107         AutocorrelationParameter.ActualValue = autocorrelationTable;
    108         var row = new DataRow("Auto Correlation");
    109         row.VisualProperties.StartIndexZero = true;
    110         autocorrelationTable.Rows.Add(row);
    111       }
    112       return autocorrelationTable;
    113     }
    114 
    115     private DataTable GetOrCreateCorrelationLengthTable() {
    116       DataTable correlationLengthTable = CorrelationLengthTableParameter.ActualValue;
    117       if (correlationLengthTable == null) {
    118         correlationLengthTable = new DataTable("Correlation Length");
    119         CorrelationLengthTableParameter.ActualValue = correlationLengthTable;
    120         correlationLengthTable.Rows.Add(new DataRow("Correlation Length"));
    121       }
    122       return correlationLengthTable;
     83    private static void AddOrUpdateResult(ResultCollection results, string name, IItem item, bool clone = false) {
     84      IResult r;
     85      if (!results.TryGetValue(name, out r)) {
     86        results.Add(new Result(name, clone ? (IItem)item.Clone() : item));
     87      } else r.Value = clone ? (IItem)item.Clone() : item;
    12388    }
    12489  }
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/RuggednessCalculator.cs

    r13484 r13583  
    1 using System;
    2 using System.Linq;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    322using HeuristicLab.Common;
    423using HeuristicLab.Core;
     
    726using HeuristicLab.Parameters;
    827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using System;
    929using System.Collections.Generic;
     30using System.Linq;
    1031
    11 namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
     32namespace HeuristicLab.Analysis.FitnessLandscape {
    1233  [Item("Ruggedness Calculator", "Calculates ruggedness descriptors froma given quality trail.")]
    1334  [StorableClass]
     
    2546    }
    2647    #endregion
    27 
    2848
    2949    #region Constructors & Cloning
     
    5878      alglib.basestat.samplemoments(qualities, qualities.Length, ref mean, ref variance, ref skewness, ref kurtosis);
    5979      List<double> autocorrelation = new List<double>() { 1.0 };
    60       double bound = Math.Min(2 / Math.Sqrt(qualities.Length), 1.0);
    61       int correlationLength = 1;
    62       for (; correlationLength < qualities.Length; correlationLength++) {
    63         double value = correlations[correlationLength]/qualities.Length - mean * mean;
     80      int correlationLength = -1, counter = 1;
     81      for (; counter < qualities.Length / 2; counter++) {
     82        double value = correlations[counter] / qualities.Length - mean * mean;
    6483        if (variance > 0)
    65           value = Math.Max(Math.Min(value/variance, 1.0), -1.0);
     84          value = Math.Max(Math.Min(value / variance, 1.0), -1.0);
    6685        else
    6786          value = 1;
    6887        autocorrelation.Add(value);
    69         if (Math.Abs(value) < bound) break;
     88        if (value < 0 && correlationLength < 0) correlationLength = counter;
    7089      }
    7190      acf = autocorrelation.ToArray();
    72       return correlationLength-1;
     91      return correlationLength - 1;
    7392    }
    7493
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/UniqueThresholdCalculator.cs

    r7128 r13583  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
     23using System.Collections.Generic;
     24using System.Diagnostics;
    225using System.Linq;
    3 using System.Collections.Generic;
    4 using System.Text;
    5 using System.Diagnostics;
    626
    7 namespace HeuristicLab.Analysis {
     27namespace HeuristicLab.Analysis.FitnessLandscape {
    828
    929  public static class UniqueThresholdCalculator {
     
    6181      } else {
    6282        double min = thresholds[0];
    63         double max = thresholds[thresholds.Count-1];
     83        double max = thresholds[thresholds.Count - 1];
    6484        if (min == max) {
    6585          yield return min;
    6686        } else {
    6787          yield return min;
    68           foreach (var t in DetermineInnerThresholds(thresholds, n-2))
     88          foreach (var t in DetermineInnerThresholds(thresholds, n - 2))
    6989            yield return t;
    7090          yield return max;
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/UpDownWalkAnalyzer.cs

    r7176 r13583  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Drawing;
    24 using System.Linq;
    25 using HeuristicLab.Collections;
    2622using HeuristicLab.Common;
    2723using HeuristicLab.Core;
    2824using HeuristicLab.Data;
    2925using HeuristicLab.Operators;
    30 using HeuristicLab.Optimization.Operators;
     26using HeuristicLab.Optimization;
    3127using HeuristicLab.Parameters;
    3228using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using System.Linq;
    3330
    34 namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
    35 
     31namespace HeuristicLab.Analysis.FitnessLandscape {
     32  [Item("Up/Down Walk Analyzer", "Analyzes the quality trail produced from an up/down walk.")]
    3633  [StorableClass]
    37   public class UpDownWalkAnalyzer : AlgorithmOperator, IQualityTrailAnalyzer {
     34  public class UpDownWalkAnalyzer : SingleSuccessorOperator, IQualityTrailAnalyzer {
    3835    public bool EnabledByDefault {
    3936      get { return false; }
     
    4441      get { return (LookupParameter<DataTable>)Parameters["Quality Trail"]; }
    4542    }
    46     public LookupParameter<VariableCollection> ResultsParameter {
    47       get { return (LookupParameter<VariableCollection>)Parameters["Results"]; }
    48     }
    49     public LookupParameter<DataTable> UpDownStepsParameter {
    50       get { return (LookupParameter<DataTable>)Parameters["UpDownSteps"]; }
    51     }
    52     public LookupParameter<DataTable> UpDownLevelsParameter {
    53       get { return (LookupParameter<DataTable>)Parameters["UpDownLevels"]; }
     43    public LookupParameter<ResultCollection> ResultsParameter {
     44      get { return (LookupParameter<ResultCollection>)Parameters["Results"]; }
    5445    }
    5546    public LookupParameter<DoubleValue> UpWalkLengthParameter {
     
    6556      get { return (LookupParameter<DoubleValue>)Parameters["DownWalkLenVar"]; }
    6657    }
    67     public LookupParameter<DoubleValue> UpperLevelParameter {
    68       get { return (LookupParameter<DoubleValue>)Parameters["UpperLevel"]; }
    69     }
    70     public LookupParameter<DoubleValue> LowerLevelParameter {
    71       get { return (LookupParameter<DoubleValue>)Parameters["LowerLevel"]; }
    72     }
    7358    public LookupParameter<DoubleValue> UpperVarianceParameter {
    7459      get { return (LookupParameter<DoubleValue>)Parameters["UpperVariance"]; }
     
    8267    protected UpDownWalkAnalyzer(bool deserializing) : base(deserializing) { }
    8368    protected UpDownWalkAnalyzer(UpDownWalkAnalyzer original, Cloner cloner) : base(original, cloner) { }
    84 
    8569    public UpDownWalkAnalyzer() {
    8670      Parameters.Add(new LookupParameter<DataTable>("Quality Trail", "The qualities of the solutions"));
    87       Parameters.Add(new LookupParameter<VariableCollection>("Results", "The collection of all results of this algorithm"));
    88       Parameters.Add(new LookupParameter<DataTable>("UpDownSteps", "Distribution of upward and downward steps between extremes."));
    89       Parameters.Add(new LookupParameter<DataTable>("UpDownLevels", "Distribution of upper and lower levels in up-down walks."));
     71      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection of all results of this algorithm"));
    9072      Parameters.Add(new LookupParameter<DoubleValue>("DownWalkLength", "Average downward walk length."));
    9173      Parameters.Add(new LookupParameter<DoubleValue>("UpWalkLength", "Average updward walk length."));
    9274      Parameters.Add(new LookupParameter<DoubleValue>("UpWalkLenVar", "Upward walk length variance."));
    9375      Parameters.Add(new LookupParameter<DoubleValue>("DownWalkLenVar", "Downward walk length variance."));
    94       Parameters.Add(new LookupParameter<DoubleValue>("UpperLevel", "Average maximum fitness value."));
    95       Parameters.Add(new LookupParameter<DoubleValue>("LowerLevel", "Average minimum fitness value."));
    9676      Parameters.Add(new LookupParameter<DoubleValue>("LowerVariance", "Lower level variance."));
    9777      Parameters.Add(new LookupParameter<DoubleValue>("UpperVariance", "Upper level variance."));
    98    
    99 
    100       var resultsCollector = new ResultsCollector();
    101       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(UpDownStepsParameter.Name));
    102       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(UpDownLevelsParameter.Name));
    103       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(DownWalkLengthParameter.Name));
    104       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(UpWalkLengthParameter.Name));
    105       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(UpWalkLenVarParameter.Name));
    106       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(DownWalkLenVarParameter.Name));
    107       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(UpperLevelParameter.Name));
    108       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(LowerLevelParameter.Name));
    109       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(UpperVarianceParameter.Name));
    110       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(LowerVarianceParameter.Name));
    111 
    112       OperatorGraph.InitialOperator = resultsCollector;
    113       resultsCollector.Successor = null;
    11478    }
    11579
     
    11983
    12084    public override IOperation Apply() {
    121       var stepsTable = GetOrCreateTable(UpDownStepsParameter, "Up", "Down");
    122       var levelsTable = GetOrCreateTable(UpDownLevelsParameter, "Top", "Bottom");
    123       DataTable qualityTrail = QualityTrailParameter.ActualValue;
     85      var qualityTrail = QualityTrailParameter.ActualValue;
    12486      if (qualityTrail != null && qualityTrail.Rows.Count > 0) {
    12587        var qualities = qualityTrail.Rows.First().Values.ToList();
    12688        if (qualities.Count > 2) {
     89          var results = ResultsParameter.ActualValue;
    12790          var extremes = qualities
    128             .Delta((a, b) => new {a, b, diff = b - a})
    129             .Select((p, i) => new {p.a, p.b, p.diff, i = i+1})
     91            .Delta((a, b) => new { a, b, diff = b - a })
     92            .Select((p, i) => new { p.a, p.b, p.diff, i = i + 1 })
    13093            .Delta((s1, s2) => new {
    13194              s1.i,
     
    143106          var maxima = extremes.Where(x => x.top).ToList();
    144107          var minima = extremes.Where(x => x.bottom).ToList();
    145           var tops = Enumerable.Repeat(new {length = 0, value = 0.0}, 0).ToList();
     108          var tops = Enumerable.Repeat(new { length = 0, value = 0.0 }, 0).ToList();
    146109          var bottoms = tops;
    147110          if (maxima.Count > 0 && minima.Count > 0) {
    148111            if (maxima.First().i < minima.First().i) {
    149               bottoms = maxima.Zip(minima, (t, b) => new {length = b.i - t.i, b.value}).ToList();
    150               minima.Insert(0, new {i = -1, value = 0.0, top = false, bottom = false});
    151               tops = maxima.Zip(minima, (t, b) => new {length = t.i - b.i, t.value}).ToList();
     112              bottoms = maxima.Zip(minima, (t, b) => new { length = b.i - t.i, b.value }).ToList();
     113              minima.Insert(0, new { i = -1, value = 0.0, top = false, bottom = false });
     114              tops = maxima.Zip(minima, (t, b) => new { length = t.i - b.i, t.value }).ToList();
    152115            } else {
    153               tops = maxima.Zip(minima, (t, b) => new {length = t.i - b.i, t.value}).ToList();
    154               maxima.Insert(0, new {i = -1, value = 0.0, top = false, bottom = false});
    155               bottoms = maxima.Zip(minima, (t, b) => new {length = b.i - t.i, b.value}).ToList();
     116              tops = maxima.Zip(minima, (t, b) => new { length = t.i - b.i, t.value }).ToList();
     117              maxima.Insert(0, new { i = -1, value = 0.0, top = false, bottom = false });
     118              bottoms = maxima.Zip(minima, (t, b) => new { length = b.i - t.i, b.value }).ToList();
    156119            }
    157120            if (tops.Count > 0) {
    158               var topLengths = tops.Select(t => (double) t.length).ToList();
     121              var topLengths = tops.Select(t => (double)t.length).ToList();
    159122              var topVals = tops.Select(t => t.value).ToList();
    160               ReplaceHistogram(stepsTable.Rows["Up"], topLengths);
    161               ReplaceHistogram(levelsTable.Rows["Top"], topVals);
    162               UpperLevelParameter.ActualValue = new DoubleValue(topVals.Average());
    163               UpperVarianceParameter.ActualValue = new DoubleValue(topVals.Variance());
    164               UpWalkLengthParameter.ActualValue = new DoubleValue(topLengths.Average());
    165               UpWalkLenVarParameter.ActualValue = new DoubleValue(topLengths.Variance());
     123              var uv = new DoubleValue(topVals.Variance());
     124              UpperVarianceParameter.ActualValue = uv;
     125              AddOrUpdateResult(results, UpperVarianceParameter.Name, uv);
     126              var ul = new DoubleValue(topLengths.Average());
     127              UpWalkLengthParameter.ActualValue = ul;
     128              AddOrUpdateResult(results, UpWalkLengthParameter.Name, ul);
     129              var ulv = new DoubleValue(topLengths.Variance());
     130              UpWalkLenVarParameter.ActualValue = ulv;
     131              AddOrUpdateResult(results, UpWalkLenVarParameter.Name, ulv);
    166132            }
    167133            if (bottoms.Count > 0) {
    168               var bottomLengths = bottoms.Select(b => (double) b.length).ToList();
     134              var bottomLengths = bottoms.Select(b => (double)b.length).ToList();
    169135              var bottomVals = bottoms.Select(b => b.value).ToList();
    170               ReplaceHistogram(stepsTable.Rows["Down"], bottomLengths);
    171               ReplaceHistogram(levelsTable.Rows["Bottom"], bottomVals);
    172               LowerLevelParameter.ActualValue = new DoubleValue(bottomVals.Average());
    173               LowerVarianceParameter.ActualValue = new DoubleValue(bottomVals.Variance());
    174               DownWalkLengthParameter.ActualValue = new DoubleValue(bottomLengths.Average());
    175               DownWalkLenVarParameter.ActualValue = new DoubleValue(bottomLengths.Variance());
     136              var lv = new DoubleValue(bottomVals.Variance());
     137              LowerVarianceParameter.ActualValue = lv;
     138              AddOrUpdateResult(results, LowerVarianceParameter.Name, lv);
     139              var dl = new DoubleValue(bottomLengths.Average());
     140              DownWalkLengthParameter.ActualValue = dl;
     141              AddOrUpdateResult(results, DownWalkLengthParameter.Name, dl);
     142              var dlv = new DoubleValue(bottomLengths.Variance());
     143              DownWalkLenVarParameter.ActualValue = dlv;
     144              AddOrUpdateResult(results, DownWalkLenVarParameter.Name, dlv);
    176145            }
    177146          }
     
    181150    }
    182151
    183     private void ReplaceHistogram(DataRow row, IEnumerable<double> values) {
    184       row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
    185       row.VisualProperties.Bins = 25;
    186       row.Values.Clear();
    187       row.Values.AddRange(values);
    188     }
    189 
    190     private DataTable GetOrCreateTable(LookupParameter<DataTable> tableParameter, params string[] rowNames) {
    191       DataTable table = tableParameter.ActualValue;
    192       if (table == null) {
    193         table = new DataTable(tableParameter.Name, tableParameter.Description);
    194         tableParameter.ActualValue = table;
    195         foreach (var name in rowNames) {
    196           table.Rows.Add(new DataRow(name));
    197         }
    198       }
    199       return table;
     152    private static void AddOrUpdateResult(ResultCollection results, string name, IItem item, bool clone = false) {
     153      IResult r;
     154      if (!results.TryGetValue(name, out r)) {
     155        results.Add(new Result(name, clone ? (IItem)item.Clone() : item));
     156      } else r.Value = clone ? (IItem)item.Clone() : item;
    200157    }
    201158  }
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/DistanceCalculators/BinaryVectorDistanceCalculator.cs

    r7202 r13583  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
     23using System.Drawing;
     24using HeuristicLab.Common;
     25using HeuristicLab.Common.Resources;
    526using HeuristicLab.Core;
    6 using HeuristicLab.Common.Resources;
     27using HeuristicLab.Encodings.BinaryVectorEncoding;
    728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    8 using HeuristicLab.Common;
    9 using HeuristicLab.Encodings.BinaryVectorEncoding;
    10 using System.Drawing;
    1129
    1230namespace HeuristicLab.Analysis.FitnessLandscape.DistanceCalculators {
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/DistanceCalculators/IItemDistanceCalculator.cs

    r7128 r13583  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    523using HeuristicLab.Core;
    624
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/DistanceCalculators/PermutationDistanceCalculator.cs

    r7202 r13583  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     24using System.Drawing;
     25using HeuristicLab.Common;
     26using HeuristicLab.Common.Resources;
    527using HeuristicLab.Core;
    6 using HeuristicLab.Common.Resources;
     28using HeuristicLab.Encodings.PermutationEncoding;
    729using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    8 using HeuristicLab.Common;
    9 using HeuristicLab.Encodings.BinaryVectorEncoding;
    10 using HeuristicLab.Encodings.PermutationEncoding;
    11 using System.Drawing;
    1230
    1331namespace HeuristicLab.Analysis.FitnessLandscape.DistanceCalculators {
     
    6381        case PermutationTypes.RelativeUndirected: return RelativeDistance(a, b);
    6482        default: throw new NotImplementedException("Unknown permutation type " + a.PermutationType);
    65       }     
     83      }
    6684    }
    6785
    6886    private double AbsoluteDistance(Permutation a, Permutation b) {
    6987      int mismatches = 0;
    70       for (int i = 0; i<a.Length; i++) {
     88      for (int i = 0; i < a.Length; i++) {
    7189        if (a[i] != b[i])
    7290          mismatches++;
     
    87105    }
    88106
    89     private static Point GetEdge(Permutation a, int index) {     
     107    private static Point GetEdge(Permutation a, int index) {
    90108      int start = a[index];
    91       int end = a[(index + 1)%a.Length];
     109      int end = a[(index + 1) % a.Length];
    92110      switch (a.PermutationType) {
    93111        case PermutationTypes.RelativeDirected: return new Point(start, end);
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/DistanceCalculators/RealVectorDistanceCalculator.cs

    r12575 r13583  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
     23using System.Drawing;
     24using HeuristicLab.Common;
     25using HeuristicLab.Common.Resources;
    526using HeuristicLab.Core;
    6 using HeuristicLab.Common.Resources;
     27using HeuristicLab.Encodings.BinaryVectorEncoding;
     28using HeuristicLab.Encodings.RealVectorEncoding;
    729using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    8 using HeuristicLab.Common;
    9 using HeuristicLab.Encodings.BinaryVectorEncoding;
    10 using System.Drawing;
    11 using HeuristicLab.Encodings.RealVectorEncoding;
    1230
    1331namespace HeuristicLab.Analysis.FitnessLandscape.DistanceCalculators {
     
    1533  [Item("RealVectorDistanceCalculator", "Calculates the Euclidian distance of two real vectors")]
    1634  [StorableClass]
    17   public class RealVectorDistanceCalculator: NamedItem, IItemDistanceCalculator {
     35  public class RealVectorDistanceCalculator : NamedItem, IItemDistanceCalculator {
    1836
    1937    #region Properties
     
    5270
    5371    public double Distance(IItem x, IItem y) {
    54       RealVector a = (RealVector )x;
    55       RealVector b = (RealVector )y;
     72      RealVector a = (RealVector)x;
     73      RealVector b = (RealVector)y;
    5674      if (a.Length != b.Length)
    5775        throw new InvalidOperationException("Cannot compare vectors of different lengths");
     
    6381    }
    6482
    65     private static double Sqr(double x) { return x*x; }
     83    private static double Sqr(double x) { return x * x; }
    6684
    6785    #endregion
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Extensions.cs

    r13484 r13583  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
     23using System;
    224using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    525
    626namespace HeuristicLab.Analysis.FitnessLandscape {
    7   public static class ListExtensions {
     27  public static class IListExtensions {
    828    public static void DuplicateLast<T>(this IList<T> l) {
    9       l.Add(l[l.Count-1]);
     29      l.Add(l[l.Count - 1]);
    1030    }
    11     public static T Last<T>(this IList<T> l) {
    12       return l[l.Count - 1];
     31
     32    public static void Shuffle<T>(this IList<T> list, IRandom random) {
     33      int n = list.Count - 1;
     34      while (n > 0) {
     35        int k = random.Next(n + 1);
     36        T value = list[k];
     37        list[k] = list[n];
     38        list[n] = value;
     39        n--;
     40      }
     41    }
     42  }
     43
     44  public static class IDictionaryExtensions {
     45    public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> d, TKey key, Func<TValue> @default) {
     46      TValue value;
     47      return d.TryGetValue(key, out value) ? value : @default();
     48    }
     49
     50    public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> d, TKey key, TValue @default = default(TValue)) {
     51      TValue value;
     52      return d.TryGetValue(key, out value) ? value : @default;
    1353    }
    1454  }
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/HeuristicLab.Analysis.FitnessLandscape-3.3.csproj

    r13484 r13583  
    4040    <DebugType>full</DebugType>
    4141    <Optimize>false</Optimize>
    42     <OutputPath>..\..\..\trunk\sources\bin\</OutputPath>
     42    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    4343    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4444    <ErrorReport>prompt</ErrorReport>
     
    4949    <DebugType>pdbonly</DebugType>
    5050    <Optimize>true</Optimize>
    51     <OutputPath>..\..\..\trunk\sources\bin\</OutputPath>
     51    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    5252    <DefineConstants>TRACE</DefineConstants>
    5353    <ErrorReport>prompt</ErrorReport>
     
    5757  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    5858    <DebugSymbols>true</DebugSymbols>
    59     <OutputPath>..\..\..\trunk\sources\bin\</OutputPath>
     59    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    6060    <DefineConstants>DEBUG;TRACE</DefineConstants>
    6161    <DebugType>full</DebugType>
     
    6565  </PropertyGroup>
    6666  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    67     <OutputPath>..\..\..\trunk\sources\bin\</OutputPath>
     67    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    6868    <DefineConstants>TRACE</DefineConstants>
    6969    <Optimize>true</Optimize>
     
    7575  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    7676    <DebugSymbols>true</DebugSymbols>
    77     <OutputPath>..\..\..\trunk\sources\bin\</OutputPath>
     77    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    7878    <DefineConstants>DEBUG;TRACE</DefineConstants>
    7979    <DebugType>full</DebugType>
     
    8383  </PropertyGroup>
    8484  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    85     <OutputPath>..\..\..\trunk\sources\bin\</OutputPath>
     85    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    8686    <DefineConstants>TRACE</DefineConstants>
    8787    <Optimize>true</Optimize>
     
    9292  </PropertyGroup>
    9393  <ItemGroup>
    94     <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    95       <HintPath>..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
    96     </Reference>
    97     <Reference Include="HeuristicLab.Analysis-3.3">
    98       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     94    <Reference Include="ALGLIB-3.7.0">
     95      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
     96      <Private>False</Private>
    9997    </Reference>
    10098    <Reference Include="HeuristicLab.Collections-3.3">
    101       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     99      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     100      <Private>False</Private>
    102101    </Reference>
    103102    <Reference Include="HeuristicLab.Common-3.3">
    104       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     103      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     104      <Private>False</Private>
    105105    </Reference>
    106106    <Reference Include="HeuristicLab.Common.Resources-3.3">
    107       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     107      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     108      <Private>False</Private>
    108109    </Reference>
    109110    <Reference Include="HeuristicLab.Core-3.3">
    110       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     111      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     112      <Private>False</Private>
    111113    </Reference>
    112114    <Reference Include="HeuristicLab.Data-3.3">
    113       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     115      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     116      <Private>False</Private>
    114117    </Reference>
    115118    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">
    116       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
     119      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
     120      <Private>False</Private>
    117121    </Reference>
    118122    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3">
    119       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath>
     123      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath>
     124      <Private>False</Private>
    120125    </Reference>
    121126    <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3">
    122       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
     127      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
     128      <Private>False</Private>
    123129    </Reference>
    124130    <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3">
    125       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
     131      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
     132      <Private>False</Private>
    126133    </Reference>
    127134    <Reference Include="HeuristicLab.Operators-3.3">
    128       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
    129     </Reference>
    130     <Reference Include="HeuristicLab.Optimization-3.3">
    131       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     135      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
     136      <Private>False</Private>
    132137    </Reference>
    133138    <Reference Include="HeuristicLab.Optimization.Operators-3.3">
    134       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
     139      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
     140      <Private>False</Private>
    135141    </Reference>
    136142    <Reference Include="HeuristicLab.Parameters-3.3">
    137       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     143      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     144      <Private>False</Private>
    138145    </Reference>
    139146    <Reference Include="HeuristicLab.Persistence-3.3">
    140       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     147      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     148      <Private>False</Private>
    141149    </Reference>
    142150    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
    143       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    144     </Reference>
    145     <Reference Include="HeuristicLab.Problems.TestFunctions-3.3">
    146       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath>
     151      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     152      <Private>False</Private>
    147153    </Reference>
    148154    <Reference Include="HeuristicLab.Random-3.3">
    149       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     155      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     156      <Private>False</Private>
    150157    </Reference>
    151158    <Reference Include="HeuristicLab.Selection-3.3">
    152       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Selection-3.3.dll</HintPath>
     159      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Selection-3.3.dll</HintPath>
     160      <Private>False</Private>
    153161    </Reference>
    154162    <Reference Include="System" />
     
    170178  </ItemGroup>
    171179  <ItemGroup>
    172     <Compile Include="Algorithms\RepeatedUpDownWalkAnalyzer.cs" />
    173     <Compile Include="Algorithms\EvolvabilityAnalyzer.cs" />
    174     <Compile Include="Algorithms\RepeatedInformationAnalyzer.cs" />
    175     <Compile Include="Algorithms\RepeatMultiAnalyzer.cs" />
    176     <Compile Include="Algorithms\RepeatedRuggednessAnalyzer.cs" />
    177     <Compile Include="Algorithms\ScopeDuplicator.cs" />
    178     <Compile Include="Analysis\Aggregators\BoundingBoxAggregator.cs" />
    179     <Compile Include="Analysis\Aggregators\Aggregator.cs" />
    180     <Compile Include="Analysis\Aggregators\AutoCorrelationAggregator.cs" />
    181     <Compile Include="Analysis\Aggregators\UpDownAggregatorAggregator.cs" />
    182     <Compile Include="Analysis\Aggregators\EvolvabilityAggregator.cs" />
    183     <Compile Include="Analysis\Aggregators\InformationAnalysisPeakAggregator.cs" />
    184     <Compile Include="Analysis\Aggregators\InformationAnalysisValueAggregator.cs" />
    185     <Compile Include="Analysis\Aggregators\DistributionAnalyzer.cs" />
    186     <Compile Include="Analysis\Aggregators\RuggednessAggregator.cs" />
    187     <Compile Include="Analysis\Aggregators\QualityTrailSummaryAggregator.cs" />
    188     <Compile Include="Analysis\Aggregators\InformationStabilityAggregator.cs" />
    189     <Compile Include="Analysis\Aggregators\InformationAnalysisAggregator.cs" />
    190     <Compile Include="Analysis\Aggregators\IAggregator.cs" />
    191     <Compile Include="Algorithms\RepeatedLocalAnalysis.cs" />
     180    <Compile Include="Algorithms\AdaptiveWalk.cs" />
     181    <Compile Include="Algorithms\UpDownWalk.cs" />
     182    <Compile Include="Algorithms\RandomWalk.cs" />
     183    <Compile Include="Analysis\RuggednessCalculator.cs" />
    192184    <Compile Include="Analysis\UpDownWalkAnalyzer.cs" />
    193     <Compile Include="Analysis\NeutralityAnalyzer.cs" />
    194     <Compile Include="Analysis\QualityTrailSummarizer.cs" />
    195185    <Compile Include="Analysis\EnumerableExtensions.cs" />
    196186    <Compile Include="Analysis\FitnessCloudAnalyzer.cs" />
    197187    <Compile Include="Analysis\InformationAnalysis.cs" />
    198     <Compile Include="Analysis\InformationAnalysisCalculator.cs" />
    199188    <Compile Include="Analysis\QualityTrailMultiAnalyzer.cs" />
    200     <Compile Include="Analysis\RealVectorBoundingBoxUpdater.cs" />
    201     <Compile Include="Analysis\RepeatAggregator.cs" />
    202189    <Compile Include="Analysis\RuggednessAnalyzer.cs" />
    203190    <Compile Include="Analysis\IQualityTrailAnalyzer.cs" />
     
    205192    <Compile Include="Algorithms\LocalAnalysisMainLoop.cs" />
    206193    <Compile Include="Analysis\InformationAnalyzer.cs" />
    207     <Compile Include="Analysis\RuggednessCalculator.cs" />
    208194    <Compile Include="Analysis\UniqueThresholdCalculator.cs" />
    209     <Compile Include="BestWorstSelector.cs" />
    210     <Compile Include="BoxChart\BoxChartCreator.cs" />
    211     <Compile Include="BoxChart\ColorValue.cs" />
    212     <Compile Include="BoxChart\RunCollectionMultiDiscretizer.cs" />
    213     <Compile Include="BoxChart\ResultNamesCollector.cs" />
    214     <Compile Include="BoxChart\StringValueBoxChartElementGenerator.cs" />
    215     <Compile Include="BoxChart\IBoxChartElementGenerator.cs" />
    216     <Compile Include="BoxChart\EmptyBoxChartElementGenerator.cs" />
    217     <Compile Include="BoxChart\StringConstantBoxChartElementGenerator.cs" />
    218     <Compile Include="BoxChart\DiscreteValueBoxChartElementGenerator.cs" />
    219     <Compile Include="BoxChart\BitmapItem.cs" />
    220     <Compile Include="ColorGradient.cs" />
    221     <Compile Include="DictionaryExtensions.cs" />
     195    <Compile Include="CharacteristicCalculator\AdaptiveWalkCalculator.cs" />
     196    <Compile Include="CharacteristicCalculator\UpDownWalkCalculator.cs" />
     197    <Compile Include="CharacteristicCalculator\RandomWalkCalculator.cs" />
     198    <Compile Include="UpDownSelector.cs" />
    222199    <Compile Include="DistanceCalculators\RealVectorDistanceCalculator.cs" />
    223200    <Compile Include="DistanceCalculators\BinaryVectorDistanceCalculator.cs" />
    224201    <Compile Include="DistanceCalculators\PermutationDistanceCalculator.cs" />
    225202    <Compile Include="DistanceCalculators\IItemDistanceCalculator.cs" />
    226     <Compile Include="IListExtensions.cs" />
    227     <Compile Include="ListExtensions.cs" />
    228     <Compile Include="NeutralSelector.cs" />
    229     <Compile Include="DataTables\AutoCorrelationTable.cs" />
    230     <Compile Include="EngineAlgorithm\EngineAlgorithmOperator.cs" />
    231     <Compile Include="DataTables\QualityTrailSummaryTable.cs" />
    232     <Compile Include="DataTables\InformationStabilityTable.cs" />
    233     <Compile Include="DataTables\InformationAnalysisTable.cs" />
    234     <Compile Include="Evolvability\EvolvabilityAnalyzer.cs" />
     203    <Compile Include="Extensions.cs" />
    235204    <Compile Include="FDC\QAPPermutationFitnessDistanceCorrelationAnalyzer.cs" />
    236     <Compile Include="ScopePathLookupParameter.cs" />
    237205    <Compile Include="FDC\BinaryVectorFitnessDistanceCorrelationAnalyzer.cs" />
    238206    <Compile Include="FDC\HeatMap.cs" />
    239     <Compile Include="HeuristicLabAnalysisFitnessLandscapePlugin.cs" />
    240     <Compile Include="MultiTrajectory\GridRealVectorsCreator.cs" />
    241     <Compile Include="MultiTrajectory\PreassignedPermutationCreator.cs" />
    242     <Compile Include="MultiTrajectory\MultiTrajectoryAnalysis.cs" />
    243     <Compile Include="MultiTrajectory\PreassignedRealVectorCreator.cs" />
    244     <Compile Include="MultiTrajectory\PreassignedBinaryVectorCreator.cs" />
    245     <Compile Include="MultiTrajectory\PreassignedSolutionCreator.cs" />
    246     <Compile Include="PopDist\PopulationDistributionAnalyzer.cs" />
    247     <Compile Include="Exhaustive\PermutationEnumerationManipulator.cs" />
     207    <Compile Include="Plugin.cs" />
    248208    <Compile Include="FDC\PermutationFitnessDistanceCorrelationAnalyzer.cs" />
    249     <Compile Include="TestFunctions\CustomAdditiveMoveEvaluator.cs" />
    250     <Compile Include="TestFunctions\CustomEvaluator.cs" />
    251209    <None Include="Properties\AssemblyInfo.cs.frame" />
    252210    <Compile Include="Properties\AssemblyInfo.cs" />
    253211    <Compile Include="FDC\RealVectorFitnessDistanceCorrelationAnalyzer.cs" />
    254212    <Compile Include="FDC\FitnessDistanceCorrelationAnalyzer.cs" />
    255     <None Include="HeuristicLabAnalysisFitnessLandscapePlugin.cs.frame" />
     213    <None Include="Plugin.cs.frame" />
    256214    <Compile Include="FDC\ScatterPlot.cs" />
    257215  </ItemGroup>
     
    276234    </BootstrapperPackage>
    277235  </ItemGroup>
    278   <ItemGroup />
     236  <ItemGroup>
     237    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     238      <Project>{887425b4-4348-49ed-a457-b7d2c26ddbf9}</Project>
     239      <Name>HeuristicLab.Analysis-3.3</Name>
     240      <Private>False</Private>
     241    </ProjectReference>
     242    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     243      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
     244      <Name>HeuristicLab.Optimization-3.3</Name>
     245      <Private>False</Private>
     246    </ProjectReference>
     247  </ItemGroup>
    279248  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    280249  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
     
    286255  -->
    287256  <PropertyGroup>
    288     <PostBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    289 set ProjectDir=$(ProjectDir)
    290 set SolutionDir=$(SolutionDir)
    291 set Outdir=$(Outdir)
    292 set Platform=$(PlatformName)
    293 set Configuration=$(ConfigurationName)</PostBuildEvent>
     257    <PostBuildEvent>
     258    </PostBuildEvent>
    294259  </PropertyGroup>
    295260  <PropertyGroup>
     
    299264set Outdir=$(Outdir)
    300265
    301 SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\Properties\AssemblyInfo.cs.frame" "%25ProjectDir%25\Properties\AssemblyInfo.cs"
    302 SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabAnalysisFitnessLandscapePlugin.cs.frame" "%25ProjectDir%25\HeuristicLabAnalysisFitnessLandscapePlugin.cs"</PreBuildEvent>
     266call PreBuildEvent.cmd
     267</PreBuildEvent>
    303268  </PropertyGroup>
    304269</Project>
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Plugin.cs.frame

    r13484 r13583  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424namespace HeuristicLab.Analysis.FitnessLandscape {
    2525
    26   [Plugin("HeuristicLab.Analysis.FitnessLandscape", "3.3.0.$WCREV$")]
     26  [Plugin("HeuristicLab.Analysis.FitnessLandscape", "3.3.14.$WCREV$")]
    2727  [PluginFile("HeuristicLab.Analysis.FitnessLandscape-3.3.dll", PluginFileType.Assembly)]
    2828  [PluginDependency("HeuristicLab.ALGLIB", "3.7")]
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Properties/AssemblyInfo.cs.frame

    r7128 r13583  
    1 using System.Reflection;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System.Reflection;
    223using System.Runtime.CompilerServices;
    324using System.Runtime.InteropServices;
     
    1132[assembly: AssemblyCompany("")]
    1233[assembly: AssemblyProduct("HeuristicLab")]
    13 [assembly: AssemblyCopyright("(c) 2010 HEAL")]
     34[assembly: AssemblyCopyright("(c) 2016 HEAL")]
    1435[assembly: AssemblyTrademark("")]
    1536[assembly: AssemblyCulture("")]
     
    3354// by using the '*' as shown below:
    3455// [assembly: AssemblyVersion("1.0.*")]
    35 [assembly: AssemblyVersion("3.3.0.3000")]
    36 [assembly: AssemblyFileVersion("3.3.0.$WCREV$")]
     56[assembly: AssemblyVersion("3.3.0.0")]
     57[assembly: AssemblyFileVersion("3.3.14.$WCREV$")]
    3758
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/UpDownSelector.cs

    r13484 r13583  
    1 using System.Collections.Generic;
    2 using System.Linq;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    322using HeuristicLab.Common;
    423using HeuristicLab.Core;
    524using HeuristicLab.Data;
     25using HeuristicLab.Operators;
    626using HeuristicLab.Optimization;
    727using HeuristicLab.Parameters;
    828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    9 using HeuristicLab.Selection;
     29using System.Collections.Generic;
     30using System.Linq;
    1031
    1132namespace HeuristicLab.Analysis.FitnessLandscape {
    12   [Item("BestOrWorstSelector", "A selection operator that moves towards the next local optimum, when found reverses direction and so on.")]
     33  [Item("Up/DownSelector", "A selection operator that moves towards the next local optimum, when found reverses direction and so on.")]
    1334  [StorableClass]
    14   public class BestWorstSelector : SingleObjectiveSelector, ISingleObjectiveSelector {
     35  public class UpDownSelector : InstrumentedOperator, IStochasticOperator {
    1536
    1637    #region Parameters
    17     public ScopePathLookupParameter<BoolValue> MoveTowardsOptimumParameter {
    18       get { return (ScopePathLookupParameter<BoolValue>)Parameters["MoveTowardsOptimum"]; }
     38    public ILookupParameter<BoolValue> MaximizationParameter {
     39      get { return (ILookupParameter<BoolValue>)Parameters["Maximization"]; }
    1940    }
    20     public ScopePathLookupParameter<DoubleValue> BaseQualityParameter {
    21       get { return (ScopePathLookupParameter<DoubleValue>)Parameters["BaseQuality"]; }
     41    public ILookupParameter<BoolValue> MoveTowardsOptimumParameter {
     42      get { return (ILookupParameter<BoolValue>)Parameters["MoveTowardsOptimum"]; }
    2243    }
    23     public LookupParameter<IRandom> RandomParameter {
    24       get { return (LookupParameter<IRandom>)Parameters["Random"]; }
     44    public ILookupParameter<DoubleValue> BaseQualityParameter {
     45      get { return (ILookupParameter<DoubleValue>)Parameters["BaseQuality"]; }
     46    }
     47    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
     48      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
     49    }
     50    public ILookupParameter<IRandom> RandomParameter {
     51      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    2552    }
    2653    #endregion
     
    2956
    3057    [StorableConstructor]
    31     protected BestWorstSelector(bool deserializing) : base(deserializing) { }
    32     protected BestWorstSelector(BestWorstSelector original, Cloner cloner) : base(original, cloner) { }
    33     public BestWorstSelector() {
    34       Parameters.Add(new ScopePathLookupParameter<BoolValue>("MoveTowardsOptimum", "Specifies whether the selector should optimize towards or away from the optimum."));
    35       Parameters.Add(new ScopePathLookupParameter<DoubleValue>("BaseQuality", "The base quality value to compare to. This is required to determine wheter a local optimum has been found and the direction should be reversed."));
     58    protected UpDownSelector(bool deserializing) : base(deserializing) { }
     59    protected UpDownSelector(UpDownSelector original, Cloner cloner) : base(original, cloner) { }
     60    public UpDownSelector() {
     61      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "Whether the problem is a maximization or minimization problem."));
     62      Parameters.Add(new LookupParameter<BoolValue>("MoveTowardsOptimum", "Specifies whether the selector should optimize towards or away from the optimum."));
     63      Parameters.Add(new LookupParameter<DoubleValue>("BaseQuality", "The base quality value to compare to. This is required to determine wheter a local optimum has been found and the direction should be reversed."));
     64      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the solutions."));
    3665      Parameters.Add(new LookupParameter<IRandom>("Random", "Random number generator"));
    37       MoveTowardsOptimumParameter.Hidden = false;
    38       BaseQualityParameter.Hidden = false;
    39       MoveTowardsOptimumParameter.Path = "..";
    40       BaseQualityParameter.Path = "../Remaining/{0}";
    4166      BaseQualityParameter.ActualName = "Quality";
    42       QualityParameter.Hidden = false;
    43       MaximizationParameter.Hidden = true;
    44       NumberOfSelectedSubScopesParameter.Value = new IntValue(1);
    45       NumberOfSelectedSubScopesParameter.Hidden = true;
    4667    }
    4768    public override IDeepCloneable Clone(Cloner cloner) {
    48       return new BestWorstSelector(this, cloner);
     69      return new UpDownSelector(this, cloner);
    4970    }
    5071    #endregion
    5172
    52     protected override IScope[] Select(List<IScope> scopes) {
     73    public override IOperation InstrumentedApply() {
     74      var scopes = ExecutionContext.Scope.SubScopes.ToList();
     75      var selected = Select(scopes);
     76      scopes.Remove(selected);
     77      ExecutionContext.Scope.SubScopes.Clear();
     78      ExecutionContext.Scope.SubScopes.Add(new Scope("Remaining"));
     79      ExecutionContext.Scope.SubScopes[0].SubScopes.AddRange(scopes);
     80      ExecutionContext.Scope.SubScopes.Add(new Scope("Selected"));
     81      ExecutionContext.Scope.SubScopes[1].SubScopes.Add(selected);
     82      return base.InstrumentedApply();
     83    }
     84
     85    private IScope Select(List<IScope> scopes) {
     86      var maximization = MaximizationParameter.ActualValue.Value;
    5387      bool optimize = true;
    5488      if (MoveTowardsOptimumParameter.ActualValue == null) {
     
    5791        optimize = MoveTowardsOptimumParameter.ActualValue.Value;
    5892      }
    59       double baseQuality = BaseQualityParameter.ActualValue.Value;
    60       int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
    61       bool copy = CopySelectedParameter.Value.Value;
    62       bool maximization = MaximizationParameter.ActualValue.Value;
    63       ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
    64       IScope[] selected = new IScope[count];
    65       IRandom random = RandomParameter.ActualValue;
     93      var qualities = QualityParameter.ActualValue;
     94      var list = qualities.Select((x, i) => new { Index = i, Quality = x.Value }).ToList();
     95      var baseQuality = BaseQualityParameter.ActualValue.Value;
     96      if (double.IsNaN(baseQuality)) {
     97        baseQuality = maximization ? list.Max(x => x.Quality) : list.Min(x => x.Quality);
     98      }
     99      var random = RandomParameter.ActualValue;
    66100
    67       var list = qualities.Select((x, i) => new { Index=i, Quality=x.Value }).ToList();
    68101      if (random != null)
    69102        list.Shuffle(random);
     
    77110          MoveTowardsOptimumParameter.ActualValue = new BoolValue(!optimize);
    78111      }
    79 
    80       if (copy) {
    81         int j = 0;
    82         for (int i = 0; i < count; i++) {
    83           selected[i] = (IScope)scopes[list[j].Index].Clone();
    84           j++;
    85           if (j >= list.Count) j = 0;
    86         }
    87       } else {
    88         for (int i = 0; i < count; i++) {
    89           selected[i] = scopes[list[0].Index];
    90           scopes[list[0].Index] = null;
    91           list.RemoveAt(0);
    92         }
    93         scopes.RemoveAll(x => x == null);
    94       }
    95 
    96       return selected;
     112      return scopes[list[0].Index];
    97113    }
    98114  }
  • branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs

    r13475 r13583  
    2020#endregion
    2121
     22using HeuristicLab.Analysis;
     23using HeuristicLab.Collections;
     24using HeuristicLab.Core.Views;
     25using HeuristicLab.Data;
     26using HeuristicLab.MainForm;
     27using HeuristicLab.MainForm.WindowsForms;
    2228using System;
    2329using System.Collections.Generic;
     
    2733using System.Linq;
    2834using System.Windows.Forms;
    29 using HeuristicLab.Analysis;
    30 using HeuristicLab.Collections;
    31 using HeuristicLab.Core.Views;
    32 using HeuristicLab.Data;
    33 using HeuristicLab.MainForm;
    34 using HeuristicLab.MainForm.WindowsForms;
    3535
    3636namespace HeuristicLab.Optimization.Views {
     
    8686        VisualProperties = {
    8787          YAxisTitle = "Proportion of reached targets",
    88           YAxisMinimumFixedValue = 0, YAxisMinimumAuto = false,
    89           YAxisMaximumFixedValue = 1, YAxisMaximumAuto = false
     88          YAxisMinimumFixedValue = 0,
     89          YAxisMinimumAuto = false,
     90          YAxisMaximumFixedValue = 1,
     91          YAxisMaximumAuto = false
    9092        }
    9193      };
     
    9496        VisualProperties = {
    9597          YAxisTitle = "Proportion of unused budgets",
    96           YAxisMinimumFixedValue = 0, YAxisMinimumAuto = false,
    97           YAxisMaximumFixedValue = 1, YAxisMaximumAuto = false
     98          YAxisMinimumFixedValue = 0,
     99          YAxisMinimumAuto = false,
     100          YAxisMaximumFixedValue = 1,
     101          YAxisMaximumAuto = false
    98102        }
    99103      };
     
    223227      var problemNamesDifferent = problems.Select(x => x.ProblemName).Where(x => !string.IsNullOrEmpty(x)).Distinct().Count() > 1;
    224228      var evaluatorDifferent = problems.Select(x => x.Evaluator).Where(x => !string.IsNullOrEmpty(x)).Distinct().Count() > 1;
    225       var allEqual = !problemTypesDifferent && !problemNamesDifferent && !evaluatorDifferent;
     229      var maximizationDifferent = problems.Select(x => x.Maximization).Distinct().Count() > 1;
     230      var allEqual = !problemTypesDifferent && !problemNamesDifferent && !evaluatorDifferent && !maximizationDifferent;
    226231
    227232      var selectedProblemItem = (ProblemDescription)problemComboBox.SelectedItem;
     
    234239        prob.DisplayProblemName = problemNamesDifferent || allEqual;
    235240        prob.DisplayEvaluator = evaluatorDifferent;
     241        prob.DisplayMaximization = maximizationDifferent;
    236242        problemComboBox.Items.Add(prob);
    237243        if (prob.Equals(selectedProblemItem)) problemComboBox.SelectedItem = prob;
     
    266272    }
    267273
    268     private Dictionary<string, Dictionary<string, Tuple<double, List<IRun>>>> GroupRuns() {
    269       var groupedRuns = new Dictionary<string, Dictionary<string, Tuple<double, List<IRun>>>>();
     274    private Dictionary<string, Dictionary<ProblemDescription, Tuple<double, List<IRun>>>> GroupRuns() {
     275      var groupedRuns = new Dictionary<string, Dictionary<ProblemDescription, Tuple<double, List<IRun>>>>();
    270276
    271277      var table = (string)dataTableComboBox.SelectedItem;
     
    278284      if (selectedProblem == null) return groupedRuns;
    279285
    280       var maximization = IsMaximization();
    281 
    282       var targetsPerProblem = CalculateBestTargetPerProblemInstance(table, maximization);
     286      var targetsPerProblem = CalculateBestTargetPerProblemInstance(table);
    283287
    284288      foreach (var x in (from r in Content
     
    289293                         group r by selectedGroup == AllRuns ? AllRuns : r.Parameters[selectedGroup].ToString() into g
    290294                         select Tuple.Create(g.Key, g.ToList()))) {
    291         var pDict = new Dictionary<string, Tuple<double, List<IRun>>>();
     295        var pDict = new Dictionary<ProblemDescription, Tuple<double, List<IRun>>>();
    292296        foreach (var y in (from r in x.Item2
    293                            let pd = new ProblemDescription(r).ToString()
     297                           let pd = new ProblemDescription(r)
    294298                           group r by pd into g
    295299                           select Tuple.Create(g.Key, g.ToList()))) {
     
    319323      var colorCount = 0;
    320324      var lineStyleCount = 0;
    321       var maximization = IsMaximization();
    322325
    323326      foreach (var group in groupedRuns) {
     
    331334
    332335            if (eachOrAllTargetCheckBox.Checked) {
    333               CalculateHitsForEachTarget(hits, resultsTable.Rows.First(), maximization, group.Key, group.Value.Count, problem.Value.Item1, problem.Value.Item2.Count);
     336              CalculateHitsForEachTarget(hits, resultsTable.Rows.First(), problem.Key, group.Key, group.Value.Count, problem.Value.Item1, problem.Value.Item2.Count);
    334337            } else {
    335               maxLength = CalculateHitsForAllTargets(hits, resultsTable.Rows.First(), maximization, group.Key, group.Value.Count, problem.Value.Item1, problem.Value.Item2.Count);
     338              maxLength = CalculateHitsForAllTargets(hits, resultsTable.Rows.First(), problem.Key, group.Key, group.Value.Count, problem.Value.Item1, problem.Value.Item2.Count);
    336339            }
    337340          }
     
    379382    }
    380383
    381     private void CalculateHitsForEachTarget(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, bool maximization, string group, int groupCount, double bestTarget, int problemCount) {
    382       foreach (var l in targets.Select(x => (maximization ? (1 - x) : (1 + x)) * bestTarget)) {
     384    private void CalculateHitsForEachTarget(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, ProblemDescription problem, string group, int groupCount, double bestTarget, int problemCount) {
     385      foreach (var l in targets.Select(x => (problem.IsMaximization() ? (1 - x) : (1 + x)) * bestTarget)) {
    383386        var key = group + "-" + l;
    384387        if (!hits.ContainsKey(key)) hits.Add(key, new SortedList<double, double>());
    385388        foreach (var v in row.Values) {
    386           if (maximization && v.Item2 >= l || !maximization && v.Item2 <= l) {
     389          if (problem.IsMaximization() && v.Item2 >= l || !problem.IsMaximization() && v.Item2 <= l) {
    387390            if (hits[key].ContainsKey(v.Item1))
    388391              hits[key][v.Item1] += 1.0 / (groupCount * problemCount);
     
    394397    }
    395398
    396     private double CalculateHitsForAllTargets(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, bool maximization, string group, int groupCount, double bestTarget, int problemCount) {
     399    private double CalculateHitsForAllTargets(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, ProblemDescription problem, string group, int groupCount, double bestTarget, int problemCount) {
    397400      var values = row.Values;
    398401      if (!hits.ContainsKey(group)) hits.Add(group, new SortedList<double, double>());
     
    401404      var j = 0;
    402405      while (i < targets.Length && j < values.Count) {
    403         var target = (maximization ? (1 - targets[i]) : (1 + targets[i])) * bestTarget;
     406        var target = (problem.IsMaximization() ? (1 - targets[i]) : (1 + targets[i])) * bestTarget;
    404407        var current = values[j];
    405         if (maximization && current.Item2 >= target
    406           || !maximization && current.Item2 <= target) {
     408        if (problem.IsMaximization() && current.Item2 >= target
     409          || !problem.IsMaximization() && current.Item2 <= target) {
    407410          if (!hits[group].ContainsKey(current.Item1)) hits[group][current.Item1] = 0;
    408411          hits[group][current.Item1] += 1.0 / (groupCount * problemCount * targets.Length);
     
    416419    }
    417420
    418     private void UpdateErtTables(Dictionary<string, Dictionary<string, Tuple<double, List<IRun>>>> groupedRuns) {
     421    private void UpdateErtTables(Dictionary<string, Dictionary<ProblemDescription, Tuple<double, List<IRun>>>> groupedRuns) {
    419422      ertTableView.Content = null;
    420423      var columns = 1 + targets.Length + 1;
    421424      var matrix = new string[groupedRuns.Count * groupedRuns.Max(x => x.Value.Count) + groupedRuns.Max(x => x.Value.Count), columns];
    422425      var rowCount = 0;
    423       var maximization = IsMaximization();
    424426
    425427      var tableName = (string)dataTableComboBox.SelectedItem;
    426428      if (string.IsNullOrEmpty(tableName)) return;
    427429
    428       var targetsPerProblem = CalculateBestTargetPerProblemInstance(tableName, maximization);
     430      var targetsPerProblem = CalculateBestTargetPerProblemInstance(tableName);
    429431
    430432      var colNames = new string[columns];
     
    436438
    437439      foreach (var problem in problems) {
    438         matrix[rowCount, 0] = problem;
     440        matrix[rowCount, 0] = problem.ToString();
    439441        for (var i = 0; i < targets.Length; i++) {
    440           matrix[rowCount, i + 1] = (targetsPerProblem[problem] * (maximization ? (1 - targets[i]) : (1 + targets[i]))).ToString(CultureInfo.CurrentCulture.NumberFormat);
     442          matrix[rowCount, i + 1] = (targetsPerProblem[problem] * (problem.IsMaximization() ? (1 - targets[i]) : (1 + targets[i]))).ToString(CultureInfo.CurrentCulture.NumberFormat);
    441443        }
    442444        matrix[rowCount, columns - 1] = "#succ";
     
    453455          ErtCalculationResult result = default(ErtCalculationResult);
    454456          for (var i = 0; i < targets.Length; i++) {
    455             result = ExpectedRuntimeHelper.CalculateErt(runs, tableName, (maximization ? (1 - targets[i]) : (1 + targets[i])) * group.Value[problem].Item1, maximization);
     457            result = ExpectedRuntimeHelper.CalculateErt(runs, tableName, (problem.IsMaximization() ? (1 - targets[i]) : (1 + targets[i])) * group.Value[problem].Item1, problem.IsMaximization());
    456458            matrix[rowCount, i + 1] = result.ToString();
    457459          }
     
    482484      var lineStyleCount = 0;
    483485
    484       var maximization = IsMaximization();
    485       var targetsPerProblem = CalculateBestTargetPerProblemInstance((string)dataTableComboBox.SelectedItem, maximization);
     486      var targetsPerProblem = CalculateBestTargetPerProblemInstance((string)dataTableComboBox.SelectedItem);
    486487
    487488      foreach (var group in groupedRuns) {
     
    493494
    494495            if (eachOrAllBudgetsCheckBox.Checked) {
    495               CalculateHitsForEachBudget(hits, resultsTable.Rows.First(), maximization, group.Value.Count, group.Key, problem.Value.Item2.Count, targetsPerProblem[problem.Key]);
     496              CalculateHitsForEachBudget(hits, resultsTable.Rows.First(), group.Value.Count, problem.Key, group.Key, problem.Value.Item2.Count, targetsPerProblem[problem.Key]);
    496497            } else {
    497               CalculateHitsForAllBudgets(hits, resultsTable.Rows.First(), maximization, group.Value.Count, group.Key, problem.Value.Item2.Count, targetsPerProblem[problem.Key]);
     498              CalculateHitsForAllBudgets(hits, resultsTable.Rows.First(), group.Value.Count, problem.Key, group.Key, problem.Value.Item2.Count, targetsPerProblem[problem.Key]);
    498499            }
    499500          }
     
    547548    }
    548549
    549     private void CalculateHitsForEachBudget(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, bool maximization, int groupCount, string groupName, int problemCount, double bestTarget) {
     550    private void CalculateHitsForEachBudget(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, int groupCount, ProblemDescription problem, string groupName, int problemCount, double bestTarget) {
    550551      foreach (var b in budgets) {
    551552        var key = groupName + "-" + b;
     
    557558            if (prev == null && v.Item1 != b) break;
    558559            var tgt = ((prev == null || v.Item1 == b) ? v.Item2 : prev.Item2);
    559             tgt = maximization ? bestTarget / tgt : tgt / bestTarget;
     560            tgt = problem.IsMaximization() ? bestTarget / tgt : tgt / bestTarget;
    560561            if (hits[key].ContainsKey(tgt))
    561562              hits[key][tgt] += 1.0 / (groupCount * problemCount);
     
    569570    }
    570571
    571     private void CalculateHitsForAllBudgets(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, bool maximization, int groupCount, string groupName, int problemCount, double bestTarget) {
     572    private void CalculateHitsForAllBudgets(Dictionary<string, SortedList<double, double>> hits, IndexedDataRow<double> row, int groupCount, ProblemDescription problem, string groupName, int problemCount, double bestTarget) {
    572573      var values = row.Values;
    573574      if (!hits.ContainsKey(groupName)) hits.Add(groupName, new SortedList<double, double>());
     
    581582          if (prev != null || current.Item1 == budgets[i]) {
    582583            var tgt = (prev == null || current.Item1 == budgets[i]) ? current.Item2 : prev.Item2;
    583             tgt = maximization ? bestTarget / tgt : tgt / bestTarget;
     584            tgt = problem.IsMaximization() ? bestTarget / tgt : tgt / bestTarget;
    584585            if (!hits[groupName].ContainsKey(tgt)) hits[groupName][tgt] = 0;
    585586            hits[groupName][tgt] += 1.0 / (groupCount * problemCount * budgets.Length);
     
    592593      }
    593594      var lastTgt = values.Last().Item2;
    594       lastTgt = maximization ? bestTarget / lastTgt : lastTgt / bestTarget;
     595      lastTgt = problem.IsMaximization() ? bestTarget / lastTgt : lastTgt / bestTarget;
    595596      if (i < budgets.Length && !hits[groupName].ContainsKey(lastTgt)) hits[groupName][lastTgt] = 0;
    596597      while (i < budgets.Length) {
     
    665666
    666667    private void generateTargetsButton_Click(object sender, EventArgs e) {
    667       var maximization = IsMaximization();
    668668      decimal max = 1, min = 0, count = 10;
    669669      if (targets != null) {
     
    680680        if (dialog.ShowDialog() == DialogResult.OK) {
    681681          if (dialog.Values.Any()) {
    682             targets = maximization ? dialog.Values.Select(x => (double)x).ToArray()
    683                                   : dialog.Values.Reverse().Select(x => (double)x).ToArray();
     682            targets = dialog.Values.Select(x => (double)x).ToArray();
    684683            suppressTargetsEvents = true;
    685684            targetsTextBox.Text = string.Join("% ; ", targets);
     
    695694    private void addTargetsAsResultButton_Click(object sender, EventArgs e) {
    696695      var table = (string)dataTableComboBox.SelectedItem;
    697       var maximization = IsMaximization();
    698 
    699       var targetsPerProblem = CalculateBestTargetPerProblemInstance(table, maximization);
     696
     697      var targetsPerProblem = CalculateBestTargetPerProblemInstance(table);
    700698
    701699      foreach (var run in Content) {
     
    707705        var pd = new ProblemDescription(run);
    708706        while (i < targets.Length && j < values.Count) {
    709           var target = (maximization ? (1 - targets[i]) : (1 + targets[i])) * targetsPerProblem[pd.ToString()];
     707          var target = (pd.IsMaximization() ? (1 - targets[i]) : (1 + targets[i])) * targetsPerProblem[pd];
    710708          var current = values[j];
    711           if (maximization && current.Item2 >= target
    712               || !maximization && current.Item2 <= target) {
     709          if (pd.IsMaximization() && current.Item2 >= target
     710              || !pd.IsMaximization() && current.Item2 <= target) {
    713711            run.Results[table + ".Target" + target] = new DoubleValue(current.Item1);
    714712            i++;
     
    828826
    829827    #region Helpers
    830     // Determines if the RunCollection contains maximization or minimization runs
    831     private bool IsMaximization() {
    832       if (Content == null) return false;
    833       if (Content.Count > 0) {
    834         foreach (var run in Content.Where(x => x.Parameters.ContainsKey("Maximization")
    835                                             && x.Parameters["Maximization"] is BoolValue)) {
    836           if (((BoolValue)run.Parameters["Maximization"]).Value) {
    837             return true;
    838           } else {
    839             return false;
    840           }
    841         }
    842         if (dataTableComboBox.SelectedIndex >= 0) {
    843           var selectedTable = (string)dataTableComboBox.SelectedItem;
    844           foreach (var run in Content.Where(x => x.Results.ContainsKey(selectedTable))) {
    845             var table = run.Results[selectedTable] as IndexedDataTable<double>;
    846             if (table == null) continue;
    847             var firstRowValues = table.Rows.First().Values;
    848             if (firstRowValues.Count < 2) continue;
    849             return firstRowValues[0].Item2 < firstRowValues[firstRowValues.Count - 1].Item2;
    850           }
    851         }
    852       }
    853       // assume minimization by default
    854       return false;
    855     }
    856 
    857     private Dictionary<string, double> CalculateBestTargetPerProblemInstance(string table, bool maximization) {
     828    private Dictionary<ProblemDescription, double> CalculateBestTargetPerProblemInstance(string table) {
    858829      return (from r in Content
    859830              where r.Visible
    860               let pd = new ProblemDescription(r).ToString()
     831              let pd = new ProblemDescription(r)
    861832              let target = r.Parameters.ContainsKey("BestKnownQuality")
    862833                           && r.Parameters["BestKnownQuality"] is DoubleValue
     
    864835                : ((IndexedDataTable<double>)r.Results[table]).Rows.First().Values.Last().Item2
    865836              group target by pd into g
    866               select new { Problem = g.Key, Target = maximization ? g.Max() : g.Min() })
     837              select new { Problem = g.Key, Target = g.Key.IsMaximization() ? g.Max() : g.Min() })
    867838        .ToDictionary(x => x.Problem, x => x.Target);
    868839    }
     
    892863        ProblemName = string.Empty;
    893864        Evaluator = string.Empty;
     865        Maximization = string.Empty;
    894866        DisplayProblemType = false;
    895867        DisplayProblemName = false;
    896868        DisplayEvaluator = false;
     869        DisplayMaximization = false;
    897870        matchAll = true;
    898871      }
     
    902875        ProblemName = GetStringValueOrEmpty(run, "Problem Name");
    903876        Evaluator = GetStringValueOrEmpty(run, "Evaluator");
     877        Maximization = GetMaximizationValueOrEmpty(run, "Maximization");
    904878        DisplayProblemType = !string.IsNullOrEmpty(ProblemType);
    905879        DisplayProblemName = !string.IsNullOrEmpty(ProblemName);
    906880        DisplayEvaluator = !string.IsNullOrEmpty(Evaluator);
     881        DisplayMaximization = !string.IsNullOrEmpty(Maximization);
    907882        matchAll = false;
    908883      }
     
    914889      public bool DisplayEvaluator { get; set; }
    915890      public string Evaluator { get; set; }
     891      public bool DisplayMaximization { get; set; }
     892      public string Maximization { get; set; }
     893
     894      public bool IsMaximization() {
     895        return Maximization == "MAX";
     896      }
    916897
    917898      public bool Match(IRun run) {
     
    919900               GetStringValueOrEmpty(run, "Problem Type") == ProblemType
    920901               && GetStringValueOrEmpty(run, "Problem Name") == ProblemName
    921                && GetStringValueOrEmpty(run, "Evaluator") == Evaluator;
     902               && GetStringValueOrEmpty(run, "Evaluator") == Evaluator
     903               && GetMaximizationValueOrEmpty(run, "Maximization") == Maximization;
    922904      }
    923905
    924906      private string GetStringValueOrEmpty(IRun run, string key) {
    925907        return run.Parameters.ContainsKey(key) ? ((StringValue)run.Parameters[key]).Value : string.Empty;
     908      }
     909
     910      private string GetMaximizationValueOrEmpty(IRun run, string key) {
     911        return run.Parameters.ContainsKey(key) ? (((BoolValue)run.Parameters[key]).Value ? "MAX" : "MIN") : string.Empty;
    926912      }
    927913
     
    931917        return ProblemType == other.ProblemType
    932918               && ProblemName == other.ProblemName
    933                && Evaluator == other.Evaluator;
     919               && Evaluator == other.Evaluator
     920               && Maximization == other.Maximization;
    934921      }
    935922
    936923      public override int GetHashCode() {
    937         return ProblemType.GetHashCode() ^ ProblemName.GetHashCode() ^ Evaluator.GetHashCode();
     924        return ProblemType.GetHashCode() ^ ProblemName.GetHashCode() ^ Evaluator.GetHashCode() ^ Maximization.GetHashCode();
    938925      }
    939926
     
    942929          (DisplayProblemType ? ProblemType : string.Empty),
    943930          (DisplayProblemName ? ProblemName : string.Empty),
    944           (DisplayEvaluator ? Evaluator : string.Empty) }.Where(x => !string.IsNullOrEmpty(x)));
     931          (DisplayEvaluator ? Evaluator : string.Empty),
     932          (DisplayMaximization ? Maximization : string.Empty)}.Where(x => !string.IsNullOrEmpty(x)));
    945933      }
    946934    }
  • branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionTableView.cs

    r13475 r13583  
    2020#endregion
    2121
     22using HeuristicLab.Core;
     23using HeuristicLab.Data.Views;
     24using HeuristicLab.MainForm;
    2225using System;
    2326using System.Collections.Generic;
     
    2528using System.Linq;
    2629using System.Windows.Forms;
    27 using HeuristicLab.Collections;
    28 using HeuristicLab.Core;
    29 using HeuristicLab.Data.Views;
    30 using HeuristicLab.MainForm;
    3130
    3231namespace HeuristicLab.Optimization.Views {
     
    122121    }
    123122
    124     protected override void UpdateColumnHeaders() {
     123    public override void UpdateColumnHeaders() {
    125124      string[] colNames = base.Content.ColumnNames.ToArray();
    126125      int colCount = colNames.Length;
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3

    • Property svn:global-ignores set to
      *.DotSettings
  • branches/PerformanceComparison/PerformanceComparison.sln

    r13485 r13583  
    1515EndProject
    1616Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.OptimizationExpertSystem.Views-3.3", "HeuristicLab.OptimizationExpertSystem.Views\3.3\HeuristicLab.OptimizationExpertSystem.Views-3.3.csproj", "{6240A044-BD4B-4DDB-9E67-A6CFA5E0C7BE}"
     17EndProject
     18Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Analysis.FitnessLandscape-3.3", "HeuristicLab.Analysis.FitnessLandscape\3.3\HeuristicLab.Analysis.FitnessLandscape-3.3.csproj", "{5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}"
    1719EndProject
    1820Global
     
    98100    {6240A044-BD4B-4DDB-9E67-A6CFA5E0C7BE}.Release|x86.ActiveCfg = Release|x86
    99101    {6240A044-BD4B-4DDB-9E67-A6CFA5E0C7BE}.Release|x86.Build.0 = Release|x86
     102    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     103    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Debug|Any CPU.Build.0 = Debug|Any CPU
     104    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Debug|x64.ActiveCfg = Debug|x64
     105    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Debug|x64.Build.0 = Debug|x64
     106    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Debug|x86.ActiveCfg = Debug|x86
     107    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Debug|x86.Build.0 = Debug|x86
     108    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Release|Any CPU.ActiveCfg = Release|Any CPU
     109    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Release|Any CPU.Build.0 = Release|Any CPU
     110    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Release|x64.ActiveCfg = Release|x64
     111    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Release|x64.Build.0 = Release|x64
     112    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Release|x86.ActiveCfg = Release|x86
     113    {5FBDCD4A-3C2A-4EC6-83CE-34B29F43621A}.Release|x86.Build.0 = Release|x86
    100114  EndGlobalSection
    101115  GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset for help on using the changeset viewer.