Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/22/12 11:11:38 (12 years ago)
Author:
jkarder
Message:

#1331:

  • synced branch with trunk
  • added custom interface (ISimilarityBasedOperator) to mark operators that conduct similarity calculation
  • similarity calculators are now parameterized by the algorithm
  • deleted SolutionPool2TierUpdateMethod
  • deleted KnapsackMultipleGuidesPathRelinker
  • moved IImprovementOperator, IPathRelinker and ISimilarityCalculator to HeuristicLab.Optimization
  • added parameter descriptions
  • fixed plugin references
  • fixed count of EvaluatedSolutions
  • fixed check for duplicate solutions
  • minor code improvements
Location:
branches/ScatterSearch (trunk integration)
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)

  • branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r7517 r8086  
    144144    [Storable]
    145145    private QualityAnalyzer qualityAnalyzer;
     146    [Storable]
     147    private SingleValueAnalyzer temperatureAnalyzer;
    146148    #endregion
    147149
     
    150152    [StorableHook(HookType.AfterDeserialization)]
    151153    private void AfterDeserialization() {
     154      if (temperatureAnalyzer == null) {
     155        temperatureAnalyzer = new SingleValueAnalyzer();
     156        temperatureAnalyzer.Name = "TemperatureAnalyzer";
     157        temperatureAnalyzer.ResultsParameter.ActualName = "Results";
     158        temperatureAnalyzer.ValueParameter.ActualName = "Temperature";
     159        temperatureAnalyzer.ValuesParameter.ActualName = "Temperature Chart";
     160        Analyzer.Operators.Add(temperatureAnalyzer);
     161      }
    152162      Initialize();
    153163    }
     
    155165      : base(original, cloner) {
    156166      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     167      temperatureAnalyzer = cloner.Clone(original.temperatureAnalyzer);
    157168      Initialize();
    158169    }
     
    205216      mainLoop.AnnealingOperatorParameter.ActualName = AnnealingOperatorParameter.Name;
    206217      mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
     218      mainLoop.TemperatureParameter.ActualName = "Temperature";
    207219      mainLoop.StartTemperatureParameter.ActualName = StartTemperatureParameter.Name;
    208220      mainLoop.EndTemperatureParameter.ActualName = EndTemperatureParameter.Name;
     
    218230
    219231      qualityAnalyzer = new QualityAnalyzer();
     232      temperatureAnalyzer = new SingleValueAnalyzer();
     233      temperatureAnalyzer.Name = "TemperatureAnalyzer";
    220234      ParameterizeAnalyzers();
    221235      UpdateAnalyzers();
     
    233247      ParameterizeStochasticOperator(Problem.SolutionCreator);
    234248      ParameterizeStochasticOperator(Problem.Evaluator);
    235       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     249      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    236250      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
    237251        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
     
    266280    }
    267281    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    268       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     282      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    269283      // This may seem pointless, but some operators already have the eventhandler registered, others don't
    270284      // FIXME: Is there another way to solve this problem?
     
    348362        qualityAnalyzer.QualityParameter.Hidden = false;
    349363        qualityAnalyzer.BestKnownQualityParameter.Hidden = false;
     364        temperatureAnalyzer.ResultsParameter.ActualName = "Results";
     365        temperatureAnalyzer.ValueParameter.ActualName = "Temperature";
     366        temperatureAnalyzer.ValuesParameter.ActualName = "Temperature Chart";
    350367      }
    351368    }
     
    470487      }
    471488      Analyzer.Operators.Add(qualityAnalyzer, qualityAnalyzer.EnabledByDefault);
     489      Analyzer.Operators.Add(temperatureAnalyzer, temperatureAnalyzer.EnabledByDefault);
    472490    }
    473491    private SimulatedAnnealingMainLoop FindMainLoop(IOperator start) {
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingImprovementOperator.cs

    r7259 r8086  
    316316      if (MoveGenerator != null) {
    317317        IMoveGenerator generator = MoveGeneratorParameter.Value;
    318         foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators).OrderBy(x => x.Name))
     318        foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name))
    319319          MoveMakerParameter.ValidValues.Add(moveMaker);
    320         foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators).OrderBy(x => x.Name))
     320        foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name))
    321321          MoveEvaluatorParameter.ValidValues.Add(moveEvaluator);
    322322
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs

    r7259 r8086  
    5151      get { return (LookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
    5252    }
     53    public ILookupParameter<DoubleValue> TemperatureParameter {
     54      get { return (ILookupParameter<DoubleValue>)Parameters["Temperature"]; }
     55    }
    5356    public ValueLookupParameter<DoubleValue> StartTemperatureParameter {
    5457      get { return (ValueLookupParameter<DoubleValue>)Parameters["StartTemperature"]; }
     
    109112      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
    110113      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
     114      Parameters.Add(new LookupParameter<DoubleValue>("Temperature", "The current temperature."));
    111115      Parameters.Add(new ValueLookupParameter<DoubleValue>("StartTemperature", "The initial temperature."));
    112116      Parameters.Add(new ValueLookupParameter<DoubleValue>("EndTemperature", "The end temperature."));
     
    126130
    127131      #region Create operators
    128       VariableCreator variableCreator = new VariableCreator();
     132      Assigner temperatureInitializer = new Assigner();
    129133      ResultsCollector resultsCollector1 = new ResultsCollector();
    130134      SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor();
     
    148152      ConditionalBranch iterationsTermination = new ConditionalBranch();
    149153
    150       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Temperature", new DoubleValue(double.MaxValue)));
     154      temperatureInitializer.LeftSideParameter.ActualName = TemperatureParameter.ActualName;
     155      temperatureInitializer.RightSideParameter.ActualName = StartTemperatureParameter.Name;
    151156
    152157      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>(IterationsParameter.Name));
    153       resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Temperature"));
    154158      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    155159
     
    199203
    200204      #region Create operator graph
    201       OperatorGraph.InitialOperator = variableCreator;
    202       variableCreator.Successor = resultsCollector1;
     205      OperatorGraph.InitialOperator = temperatureInitializer;
     206      temperatureInitializer.Successor = resultsCollector1;
    203207      resultsCollector1.Successor = subScopesProcessor0;
    204208      subScopesProcessor0.Operators.Add(analyzer1);
     
    237241      if (!Parameters.ContainsKey("Iterations"))
    238242        Parameters.Add(new LookupParameter<IntValue>("Iterations", "The number of iterations."));
     243      if (!Parameters.ContainsKey("Temperature"))
     244        Parameters.Add(new LookupParameter<DoubleValue>("Temperature", "The current temperature."));
    239245      #endregion
    240246    }
Note: See TracChangeset for help on using the changeset viewer.