Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7040


Ignore:
Timestamp:
11/22/11 14:54:17 (12 years ago)
Author:
abeham
Message:

#1541

  • Fixed permutation view and changed label
  • Fixed problem in the RTS operator when all moves are tabu (the original code continues when all moves are tabu, so this is also the case here)
  • Changed the Analyzer parameter type in RTS, a FixedValueParameter is not appropriate for operator parameters
Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding.Views/3.3/PermutationTypeView.Designer.cs

    r5445 r7040  
    5454      this.valueLabel.Location = new System.Drawing.Point(3, 3);
    5555      this.valueLabel.Name = "valueLabel";
    56       this.valueLabel.Size = new System.Drawing.Size(37, 13);
     56      this.valueLabel.Size = new System.Drawing.Size(34, 13);
    5757      this.valueLabel.TabIndex = 0;
    58       this.valueLabel.Text = "&Value:";
     58      this.valueLabel.Text = "&Type:";
    5959      //
    6060      // valueComboBox
     
    7171      this.valueComboBox.SelectedIndexChanged += new System.EventHandler(this.valueComboBox_SelectedIndexChanged);
    7272      //
    73       // ComparisonView
     73      // PermutationTypeView
    7474      //
    7575      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     
    7777      this.Controls.Add(this.valueComboBox);
    7878      this.Controls.Add(this.valueLabel);
    79       this.Name = "ComparisonView";
     79      this.Name = "PermutationTypeView";
    8080      this.Size = new System.Drawing.Size(265, 29);
    8181      this.ResumeLayout(false);
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding.Views/3.3/PermutationView.Designer.cs

    r6628 r7040  
    7272      this.Controls.Add(this.permutationTypeView);
    7373      this.Name = "PermutationView";
    74       this.Controls.SetChildIndex(this.permutationTypeView, 0);
    7574      this.Controls.SetChildIndex(this.lengthLabel, 0);
    7675      this.Controls.SetChildIndex(this.lengthTextBox, 0);
     76      this.Controls.SetChildIndex(this.permutationTypeView, 0);
    7777      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    7878      this.ResumeLayout(false);
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding.Views/3.3/PermutationView.cs

    r6628 r7040  
    3737      InitializeComponent();
    3838      dataGridView.Top = permutationTypeView.Bottom + permutationTypeView.Margin.Bottom + dataGridView.Margin.Top;
     39      dataGridView.Height = Bottom - dataGridView.Top;
    3940    }
    4041
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSeachOperator.cs

    r6628 r7040  
    3131namespace HeuristicLab.Problems.QuadraticAssignment.Algorithms {
    3232  [Item("RobustTabooSearchOperator", "Performs an iteration of the robust taboo search algorithm as descrbied in Taillard 1991.")]
     33  [StorableClass]
    3334  public sealed class RobustTabooSeachOperator : SingleSuccessorOperator, IIterationBasedOperator, IStochasticOperator {
    3435
     
    8586    public IValueLookupParameter<IntValue> AlternativeAspirationTenureParameter {
    8687      get { return (IValueLookupParameter<IntValue>)Parameters["AlternativeAspirationTenure"]; }
     88    }
     89
     90    private ILookupParameter<BoolValue> AllMovesTabuParameter {
     91      get { return (ILookupParameter<BoolValue>)Parameters["AllMovesTabu"]; }
    8792    }
    8893    #endregion
     
    111116      Parameters.Add(new ValueLookupParameter<BoolValue>("UseAlternativeAspiration", "True if the alternative aspiration condition should be used that takes moves that have not been made for some time above others."));
    112117      Parameters.Add(new ValueLookupParameter<IntValue>("AlternativeAspirationTenure", "The time t that a move will be remembered for the alternative aspiration condition."));
     118      Parameters.Add(new LookupParameter<BoolValue>("AllMovesTabu", "Indicates that all moves are tabu."));
    113119    }
    114120
    115121    public override IDeepCloneable Clone(Cloner cloner) {
    116122      return new RobustTabooSeachOperator(this, cloner);
     123    }
     124
     125    [StorableHook(HookType.AfterDeserialization)]
     126    private void AfterDeserialization() {
     127      // BackwardsCompatibility3.3
     128      #region Backwards compatible code, remove with 3.4
     129      if (!Parameters.ContainsKey("AllMovesTabu")) {
     130        Parameters.Add(new LookupParameter<BoolValue>("AllMovesTabu", "Indicates that all moves are tabu."));
     131      }
     132      #endregion
    117133    }
    118134
     
    131147        bestQuality = BestQualityParameter.ActualValue;
    132148      }
     149      bool allMovesTabu = false;
     150      if (AllMovesTabuParameter.ActualValue == null)
     151        AllMovesTabuParameter.ActualValue = new BoolValue(false);
     152      else allMovesTabu = AllMovesTabuParameter.ActualValue.Value;
    133153
    134154      int minTenure = MinimumTabuTenureParameter.ActualValue.Value;
     
    147167        if (lastMove == null)
    148168          moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, weights, distances);
     169        else if (allMovesTabu) moveQuality = moveQualityMatrix[move.Index1, move.Index2];
    149170        else moveQuality = QAPSwap2MoveEvaluator.Apply(solution, move, moveQualityMatrix[move.Index1, move.Index2], weights, distances, lastMove);
    150171
     
    180201      }
    181202
    182       LastMoveParameter.ActualValue = bestMove;
    183 
    184       if (bestMove == null) return base.Apply();
     203      allMovesTabu = bestMove == null;
     204      if (!allMovesTabu)
     205        LastMoveParameter.ActualValue = bestMove;
     206      AllMovesTabuParameter.ActualValue.Value = allMovesTabu;
     207
     208      if (allMovesTabu) return base.Apply();
    185209
    186210      bool useNewAdaptionScheme = UseNewTabuTenureAdaptionSchemeParameter.ActualValue.Value;
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSearch.cs

    r6953 r7040  
    5151
    5252    #region Parameter Properties
    53     public FixedValueParameter<MultiAnalyzer> AnalyzerParameter {
    54       get { return (FixedValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     53    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
     54      get { return (IValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    5555    }
    5656    public FixedValueParameter<IntValue> SeedParameter {
     
    7777    public FixedValueParameter<BoolValue> UseNewTabuTenureAdaptionSchemeParameter {
    7878      get { return (FixedValueParameter<BoolValue>)Parameters["UseNewTabuTenureAdaptionScheme"]; }
     79    }
     80    public FixedValueParameter<BoolValue> TerminateOnOptimalSolutionParameter {
     81      get { return (FixedValueParameter<BoolValue>)Parameters["TerminateOnOptimalSolution"]; }
    7982    }
    8083    #endregion
     
    112115      get { return UseNewTabuTenureAdaptionSchemeParameter.Value.Value; }
    113116      set { UseNewTabuTenureAdaptionSchemeParameter.Value.Value = value; }
     117    }
     118    public bool TerminateOnOptimalSolution {
     119      get { return TerminateOnOptimalSolutionParameter.Value.Value; }
     120      set { TerminateOnOptimalSolutionParameter.Value.Value = value; }
    114121    }
    115122    #endregion
     
    132139    }
    133140    public RobustTabooSearch() {
    134       Parameters.Add(new FixedValueParameter<MultiAnalyzer>("Analyzer", "The analyzers that are applied after each iteration.", new MultiAnalyzer()));
     141      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The analyzers that are applied after each iteration.", new MultiAnalyzer()));
    135142      Parameters.Add(new FixedValueParameter<IntValue>("Seed", "The seed value of the random number generator.", new IntValue(0)));
    136143      Parameters.Add(new FixedValueParameter<BoolValue>("SetSeedRandomly", "True whether the seed should be set randomly for each run, false if it should be fixed.", new BoolValue(true)));
     
    140147      Parameters.Add(new FixedValueParameter<BoolValue>("UseAlternativeAspiration", "True if the alternative aspiration condition should be used that takes moves that have not been made for some time above others.", new BoolValue(false)));
    141148      Parameters.Add(new FixedValueParameter<IntValue>("AlternativeAspirationTenure", "The time t that a move will be remembered for the alternative aspiration condition.", new IntValue(int.MaxValue)));
    142       Parameters.Add(new FixedValueParameter<BoolValue>("TerminateOnOptimalSolution", "True when the algorithm should stop if it reached a quality equal or smaller to the BestKnownQuality.", new BoolValue(true)));
     149      Parameters.Add(new FixedValueParameter<BoolValue>("TerminateOnOptimalSolution", "True when the algorithm should stop if it reached a quality equal or smaller to the BestKnownQuality.", new BoolValue(false)));
    143150      Parameters.Add(new FixedValueParameter<BoolValue>("UseNewTabuTenureAdaptionScheme", @"In an updated version of his implementation, Eric Taillard introduced a different way to change the tabu tenure.
    144151Instead of setting it uniformly between min and max, it will be set between 0 and max according to a right-skewed distribution.
    145152Set this option to false if you want to optimize using the earlier 1991 version, and set to true if you want to optimize using the newer version.
    146153Please note that the MinimumTabuTenure parameter has no effect in the new version.", new BoolValue(true)));
     154
     155      TerminateOnOptimalSolutionParameter.Hidden = true;
    147156
    148157      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
     
    298307    [StorableHook(HookType.AfterDeserialization)]
    299308    private void AfterDeserialization() {
     309      // BackwardsCompatibility3.3
     310      #region Backwards compatible code, remove with 3.4
     311      if (Parameters["Analyzer"] is FixedValueParameter<MultiAnalyzer>) {
     312        MultiAnalyzer analyzer = AnalyzerParameter.Value;
     313        Parameters.Remove("Analyzer");
     314        Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The analyzers that are applied after each iteration.", analyzer));
     315      }
     316      #endregion
    300317      RegisterEventHandlers();
    301318    }
Note: See TracChangeset for help on using the changeset viewer.