Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5622 for branches/VNS


Ignore:
Timestamp:
03/07/11 17:23:04 (14 years ago)
Author:
svonolfe
Message:

Worked on VNS (#1425)

Location:
branches/VNS
Files:
2 added
2 deleted
6 edited

Legend:

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

    r5163 r5622  
    1212    <AssemblyName>HeuristicLab.Algorithms.LocalSearch-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="HeuristicLabAlgorithmsLocalSearchPlugin.cs" />
     110    <Compile Include="LocalSearchImprovement.cs" />
    109111    <Compile Include="LocalSearchMainLoop.cs" />
    110112    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/VNS/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

    r5445 r5622  
    7979    public LocalSearchMainLoop()
    8080      : base() {
    81       Initialize();
     81      Initialize(false);
     82    }
     83    public LocalSearchMainLoop(BoolValue nested)
     84      : base() {
     85      Initialize(nested.Value);
    8286    }
    8387    private LocalSearchMainLoop(LocalSearchMainLoop original, Cloner cloner)
     
    8892    }
    8993
    90     private void Initialize() {
     94    private void Initialize(bool nested) {
    9195      #region Create parameters
    9296      Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
     
    132136
    133137      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); // Class LocalSearch expects this to be called Iterations
    134       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
     138      if (!nested) {
     139        variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
     140      }
    135141
    136142      bestQualityInitializer.Name = "Initialize BestQuality";
     
    143149      resultsCollector1.CopyValue = new BoolValue(false);
    144150      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    145       resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     151      if (!nested) {
     152        resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     153      }
    146154      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    147155
     
    197205      OperatorGraph.InitialOperator = variableCreator;
    198206      variableCreator.Successor = subScopesProcessor0;
    199       subScopesProcessor0.Operators.Add(bestQualityInitializer);
     207      if (!nested) {
     208        subScopesProcessor0.Operators.Add(bestQualityInitializer);
     209      } else {
     210        subScopesProcessor0.Operators.Add(analyzer1);
     211      }
    200212      subScopesProcessor0.Successor = resultsCollector1;
    201213      bestQualityInitializer.Successor = analyzer1;
     
    218230      improvesQualityBranch.FalseBranch = null;
    219231      improvesQualityBranch.Successor = null;
    220       moveMaker.Successor = bestQualityUpdater;
     232      if (!nested) {
     233        moveMaker.Successor = bestQualityUpdater;
     234      } else {
     235        moveMaker.Successor = null;
     236      }
    221237      bestQualityUpdater.Successor = null;
    222238      mergingReducer.Successor = analyzer2;
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/HeuristicLab.Algorithms.VariableNeighborhoodSearch-3.3.csproj

    r5603 r5622  
    108108  <ItemGroup>
    109109    <Compile Include="HeuristicLabAlgorithmsVariableNeighborhoodSearchPlugin.cs" />
    110     <Compile Include="ILocalImprovement.cs" />
    111     <Compile Include="LocalSearchImprovement.cs" />
    112110    <Compile Include="Properties\AssemblyInfo.cs" />
    113111    <Compile Include="ShakingOperator.cs" />
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearch.cs

    r5603 r5622  
    1313using HeuristicLab.Optimization.Operators;
    1414using HeuristicLab.Operators;
     15using HeuristicLab.Algorithms.LocalSearch;
    1516
    1617namespace HeuristicLab.Algorithms.VariableNeighborhoodSearch {
  • branches/VNS/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearchMainLoop.cs

    r5610 r5622  
    3232using HeuristicLab.Optimization.Operators;
    3333using HeuristicLab.Selection;
     34using HeuristicLab.Optimization;
    3435
    3536namespace HeuristicLab.Algorithms.VariableNeighborhoodSearch {
     
    123124      Placeholder localImprovement = new Placeholder();
    124125      Placeholder evaluator = new Placeholder();
     126      IntCounter evalCounter = new IntCounter();
    125127
    126128      QualityComparator qualityComparator = new QualityComparator();
     
    187189      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
    188190
     191      evalCounter.Name = "Count evaluateions";
     192      evalCounter.Increment.Value = 1;
     193      evalCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.ActualName;
     194
    189195      qualityComparator.LeftSideParameter.ActualName = QualityParameter.Name;
    190196      qualityComparator.RightSideParameter.ActualName = "OriginalQuality";
     
    236242      #region Create operator graph
    237243      OperatorGraph.InitialOperator = variableCreator;
    238       variableCreator.Successor = subScopesProcessor0;
     244      variableCreator.Successor = analyzer1;
     245      analyzer1.Successor = subScopesProcessor0;
    239246      subScopesProcessor0.Operators.Add(bestQualityInitializer);
    240247      subScopesProcessor0.Successor = resultsCollector1;
    241       //////////
    242       bestQualityInitializer.Successor = analyzer1;
    243248      /////////
    244249      resultsCollector1.Successor = iteration;
     
    250255      createChild.Successor = childProcessor;
    251256      childProcessor.Operators.Add(parentCloner);
    252       childProcessor.Successor = indexTermination;
     257      childProcessor.Successor = analyzer2;
    253258      /////////
    254259      parentCloner.Successor = qualityAssigner;
    255260      qualityAssigner.Successor = shaking;
    256       shaking.Successor = localImprovement;
    257       localImprovement.Successor = evaluator;
    258       evaluator.Successor = qualityComparator;
     261      shaking.Successor = evaluator;
     262      evaluator.Successor = evalCounter;
     263      evalCounter.Successor = localImprovement;
     264      localImprovement.Successor = qualityComparator;
    259265      qualityComparator.Successor = improvesQualityBranch;
    260266      improvesQualityBranch.TrueBranch = bestQualityUpdater;
     
    268274      remover2.Successor = indexCounter;
    269275      /////////
     276      analyzer2.Successor = indexTermination;
    270277      indexTermination.TrueBranch = improvesQualityBranch2;
    271278      indexTermination.FalseBranch = null;
  • branches/VNS/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r5560 r5622  
    116116    <Compile Include="Interfaces\IDiscreteDoubleMatrixModifier.cs" />
    117117    <Compile Include="Interfaces\IGlobalParticleUpdater.cs" />
     118    <Compile Include="Interfaces\ILocalImprovement.cs" />
    118119    <Compile Include="Interfaces\ILocalParticleUpdater.cs" />
    119120    <Compile Include="Interfaces\IMultiAnalyzer.cs" />
Note: See TracChangeset for help on using the changeset viewer.