Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5752


Ignore:
Timestamp:
03/18/11 15:20:24 (12 years ago)
Author:
svonolfe
Message:

Added simulated annealing improvement operator (#1425)

Location:
branches/VNS
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/VNS/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/HeuristicLab.Algorithms.SimulatedAnnealing-3.3.csproj

    r5163 r5752  
    1212    <AssemblyName>HeuristicLab.Algorithms.SimulatedAnnealing-3.3</AssemblyName>
    1313    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    14     <TargetFrameworkProfile></TargetFrameworkProfile>
     14    <TargetFrameworkProfile>
     15    </TargetFrameworkProfile>
    1516    <FileAlignment>512</FileAlignment>
    1617    <SignAssembly>true</SignAssembly>
     
    107108  <ItemGroup>
    108109    <Compile Include="HeuristicLabAlgorithmsSimulatedAnnealingPlugin.cs" />
     110    <Compile Include="SimulatedAnnealingImprovementOperator.cs" />
    109111    <Compile Include="Properties\AssemblyInfo.cs" />
    110112    <Compile Include="SimulatedAnnealing.cs" />
  • branches/VNS/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r5445 r5752  
    189189      variableCreator.Name = "Initialize EvaluatedMoves";
    190190      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue()));
     191      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    191192      variableCreator.Successor = resultsCollector;
    192193
     
    206207      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
    207208      mainLoop.EvaluatedMovesParameter.ActualName = "EvaluatedMoves";
     209      mainLoop.IterationsParameter.ActualName = "Iterations";
    208210
    209211      foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name))
  • branches/VNS/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs

    r5445 r5752  
    6060      get { return (ValueLookupParameter<IntValue>)Parameters["InnerIterations"]; }
    6161    }
     62    public LookupParameter<IntValue> IterationsParameter {
     63      get { return (LookupParameter<IntValue>)Parameters["LocalIterations"]; }
     64    }
    6265    public ValueLookupParameter<IntValue> MaximumIterationsParameter {
    6366      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
     
    109112      Parameters.Add(new ValueLookupParameter<DoubleValue>("EndTemperature", "The end temperature."));
    110113      Parameters.Add(new ValueLookupParameter<IntValue>("InnerIterations", "The amount of inner iterations (number of moves before temperature is adjusted again)."));
     114      Parameters.Add(new LookupParameter<IntValue>("LocalIterations", "The number of generations."));
    111115      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed."));
    112116
     
    144148      ConditionalBranch iterationsTermination = new ConditionalBranch();
    145149
    146       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); // Class SimulatedAnnealing expects this to be called Iterations
    147150      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Temperature", new DoubleValue(double.MaxValue)));
    148151
    149       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     152      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>(IterationsParameter.Name));
    150153      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Temperature"));
    151154      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
     
    180183      iterationsCounter.Name = "Increment Iterations";
    181184      iterationsCounter.Increment = new IntValue(1);
    182       iterationsCounter.ValueParameter.ActualName = "Iterations";
     185      iterationsCounter.ValueParameter.ActualName = IterationsParameter.Name;
    183186
    184187      iterationsComparator.Name = "Iterations >= MaximumIterations";
    185       iterationsComparator.LeftSideParameter.ActualName = "Iterations";
     188      iterationsComparator.LeftSideParameter.ActualName = IterationsParameter.Name;
    186189      iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
    187190      iterationsComparator.ResultParameter.ActualName = "Terminate";
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/IShakingOperator.cs

    r5642 r5752  
    2929namespace HeuristicLab.Algorithms.VariableNeighborhoodSearch {
    3030  public interface IShakingOperator: IManipulator {
    31     void Parameterize(IProblem problem);
     31    void OnProblemChanged(IProblem problem);
    3232  }
    3333}
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/ShakingOperator.cs

    r5642 r5752  
    5959    }
    6060
    61     public void Parameterize(IProblem problem) {
     61    public void OnProblemChanged(IProblem problem) {
    6262      Operators.Clear();
    6363
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearch.cs

    r5735 r5752  
    143143        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    144144      }
     145      LocalImprovementParameter.ValueChanged += new EventHandler(LocalImprovementParameter_ValueChanged);
    145146    }
    146147
     
    186187      ParameterizeVNSMainLoop();
    187188      ParameterizeAnalyzers();
     189    }
     190
     191    void LocalImprovementParameter_ValueChanged(object sender, EventArgs e) {
     192      if (LocalImprovementParameter.Value != null)
     193        LocalImprovementParameter.Value.OnProblemChanged(Problem);
    188194    }
    189195    #endregion
     
    264270      ShakingParameter.Value = (IShakingOperator)Activator.CreateInstance(genericType, new object[]{});
    265271
    266       ShakingParameter.Value.Parameterize(Problem);
     272      ShakingParameter.Value.OnProblemChanged(Problem);
    267273    }
    268274    private void UpdateLocalImprovementOperator() {
Note: See TracChangeset for help on using the changeset viewer.