Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/09/10 18:14:06 (14 years ago)
Author:
abeham
Message:

Added a TS operator and a default TabuSelector #840

Location:
trunk/sources/HeuristicLab.Algorithms.TS/3.3
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.TS/3.3/HeuristicLab.Algorithms.TS-3.3.csproj

    r2976 r2981  
    8383    <Compile Include="HeuristicLabAlgorithmsTSPlugin.cs" />
    8484    <Compile Include="Properties\AssemblyInfo.cs" />
     85    <Compile Include="TabuSelector.cs" />
    8586    <Compile Include="TSOperator.cs" />
    8687  </ItemGroup>
     
    110111      <Name>HeuristicLab.Operators-3.3</Name>
    111112    </ProjectReference>
     113    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     114      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     115      <Name>HeuristicLab.Optimization-3.3</Name>
     116    </ProjectReference>
    112117    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    113118      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
    114119      <Name>HeuristicLab.Parameters-3.3</Name>
    115120    </ProjectReference>
     121    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     122      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
     123      <Name>HeuristicLab.Persistence-3.3</Name>
     124    </ProjectReference>
    116125    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
    117126      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    118127      <Name>HeuristicLab.PluginInfrastructure</Name>
     128    </ProjectReference>
     129    <ProjectReference Include="..\..\HeuristicLab.Selection\3.3\HeuristicLab.Selection-3.3.csproj">
     130      <Project>{2C36CD4F-E5F5-43A4-801A-201EA895FE17}</Project>
     131      <Name>HeuristicLab.Selection-3.3</Name>
    119132    </ProjectReference>
    120133  </ItemGroup>
  • trunk/sources/HeuristicLab.Algorithms.TS/3.3/HeuristicLabAlgorithmsTSPlugin.cs.frame

    r2976 r2981  
    3232  [PluginDependency("HeuristicLab.Core", "3.3")]
    3333  [PluginDependency("HeuristicLab.Data", "3.3")]
    34   //[PluginDependency("HeuristicLab.Evolutionary", "3.3")]
    3534  [PluginDependency("HeuristicLab.Operators", "3.3")]
    36   //[PluginDependency("HeuristicLab.Optimization", "3.3")]
     35  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    3736  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    38   //[PluginDependency("HeuristicLab.Persistence", "3.3")]
     37  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3938  //[PluginDependency("HeuristicLab.Random", "3.3")]
    40   //[PluginDependency("HeuristicLab.Selection", "3.3")]
     39  [PluginDependency("HeuristicLab.Selection", "3.3")]
    4140  public class HeuristicLabAlgorithmsTSPlugin : PluginBase {
    4241  }
  • trunk/sources/HeuristicLab.Algorithms.TS/3.3/TSOperator.cs

    r2976 r2981  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
    25 //using HeuristicLab.Evolutionary;
    2625using HeuristicLab.Operators;
    2726using HeuristicLab.Parameters;
    28 //using HeuristicLab.Selection;
    2927
    3028namespace HeuristicLab.Algorithms.TS {
     
    4745      get { return (ValueLookupParameter<IntData>)Parameters["MaximumIterations"]; }
    4846    }
     47    public ValueLookupParameter<IntData> TabuTenureParameter {
     48      get { return (ValueLookupParameter<IntData>)Parameters["TabuTenure"]; }
     49    }
    4950    public ValueLookupParameter<VariableCollection> ResultsParameter {
    5051      get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
     
    6667      Parameters.Add(new SubScopesLookupParameter<DoubleData>("Quality", "The value which represents the quality of a solution."));
    6768      Parameters.Add(new ValueLookupParameter<IntData>("MaximumIterations", "The maximum number of generations which should be processed."));
     69      Parameters.Add(new ValueLookupParameter<IntData>("TabuTenure", "The length of the tabu list, and also means the number of iterations a move is kept tabu"));
    6870      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
    6971      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied."));
    7072      #endregion
    7173
    72       #region Create operator graph
     74      #region Create operators
    7375      VariableCreator variableCreator = new VariableCreator();
    7476      ResultsCollector resultsCollector = new ResultsCollector();
    75 
    76       OperatorGraph.InitialOperator = variableCreator;
     77      Placeholder moveGenerator = new Placeholder();
     78      UniformSequentialSubScopesProcessor moveEvaluationProcessor = new UniformSequentialSubScopesProcessor();
     79      Placeholder moveQualityEvaluator = new Placeholder();
     80      Placeholder moveTabuEvaluator = new Placeholder();
     81      SubScopesSorter moveQualitySorter = new SubScopesSorter();
     82      Placeholder tabuSelector = new Placeholder();
     83      SequentialSubScopesProcessor moveMakingProcessor = new SequentialSubScopesProcessor();
     84      EmptyOperator emptyOp = new EmptyOperator();
     85      UniformSequentialSubScopesProcessor actualMoveMakingProcessor = new UniformSequentialSubScopesProcessor();
     86      Placeholder moveMaker = new Placeholder();
     87      Placeholder moveTabuMaker = new Placeholder();
     88      SubScopesRemover subScopesRemover = new SubScopesRemover();
     89      IntCounter iterationsCounter = new IntCounter();
     90      Comparator iterationsComparator = new Comparator();
     91      ConditionalBranch iterationsTermination = new ConditionalBranch();
     92      EmptyOperator finished = new EmptyOperator();
    7793
    7894      variableCreator.CollectedValues.Add(new ValueParameter<IntData>("Iterations", new IntData(0)));
     
    8399      variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("Qualities", new DataTable("Qualities")));
    84100      variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("MoveQualities", new DataTable("MoveQualities")));
    85       variableCreator.Successor = resultsCollector;
    86101
    87102      resultsCollector.CollectedValues.Add(new LookupParameter<IntData>("Iterations"));
     
    93108      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("MoveQualities"));
    94109      resultsCollector.ResultsParameter.ActualName = "Results";
    95       resultsCollector.Successor = null;
     110
     111      moveGenerator.Name = "MoveGenerator (placeholder)";
     112      moveGenerator.OperatorParameter.ActualName = "MoveGenerator";
     113
     114      moveQualityEvaluator.Name = "MoveQualityEvaluator (placeholder)";
     115      moveQualityEvaluator.OperatorParameter.ActualName = "MoveQualityEvaluator";
     116
     117      moveTabuEvaluator.Name = "MoveTabuEvaluator (placeholder)";
     118      moveTabuEvaluator.OperatorParameter.ActualName = "MoveTabuEvaluator";
     119
     120      moveQualitySorter.DescendingParameter.ActualName = "Maximization";
     121      moveQualitySorter.ValueParameter.ActualName = "MoveQuality";
     122
     123      tabuSelector.Name = "TabuSelector (placeholder)";
     124      tabuSelector.OperatorParameter.ActualName = "TabuSelector";
     125
     126      moveMaker.Name = "MoveMaker (placeholder)";
     127      moveMaker.OperatorParameter.ActualName = "MoveMaker";
     128
     129      moveTabuMaker.Name = "MoveTabuMaker (placeholder)";
     130      moveTabuMaker.OperatorParameter.ActualName = "MoveTabuMaker";
     131
     132      subScopesRemover.RemoveAllSubScopes = true;
     133
     134      iterationsCounter.Increment = new IntData(1);
     135      iterationsCounter.IncrementParameter.ActualName = "Iterations";
     136
     137      iterationsComparator.Comparison = new ComparisonData(Comparison.Less);
     138      iterationsComparator.LeftSideParameter.ActualName = "Iterations";
     139      iterationsComparator.RightSideParameter.ActualName = "MaximumIterations";
     140      iterationsComparator.ResultParameter.ActualName = "IterationsCondition";
     141
     142      iterationsTermination.ConditionParameter.ActualName = "IterationsCondition";
     143      #endregion
     144
     145      #region Create operator graph
     146      OperatorGraph.InitialOperator = variableCreator;
     147      variableCreator.Successor = resultsCollector;
     148      resultsCollector.Successor = moveGenerator;
     149      moveGenerator.Successor = moveEvaluationProcessor;
     150      moveEvaluationProcessor.Operator = moveQualityEvaluator;
     151      moveQualityEvaluator.Successor = moveTabuEvaluator;
     152      moveEvaluationProcessor.Successor = moveQualitySorter;
     153      moveQualitySorter.Successor = tabuSelector;
     154      tabuSelector.Successor = moveMakingProcessor;
     155      moveMakingProcessor.Operators.AddRange(new Operator[] { emptyOp, actualMoveMakingProcessor });
     156      actualMoveMakingProcessor.Operator = moveMaker;
     157      moveMaker.Successor = moveTabuMaker;
     158      moveMakingProcessor.Successor = subScopesRemover;
     159      subScopesRemover.Successor = iterationsCounter;
     160      iterationsCounter.Successor = iterationsComparator;
     161      iterationsComparator.Successor = iterationsTermination;
     162      iterationsTermination.TrueBranch = resultsCollector;
     163      iterationsTermination.FalseBranch = finished;
    96164      #endregion
    97165    }
Note: See TracChangeset for help on using the changeset viewer.