Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7878


Ignore:
Timestamp:
05/23/12 16:28:05 (13 years ago)
Author:
abeham
Message:

#1722:

  • In QAPExhaustiveSwap2LocalImprovement moved local search code to a static method
  • Otherwise minor changes to the QAP
Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.Designer.cs

    r7823 r7878  
    6868      // parameterCollectionView
    6969      //
    70       this.parameterCollectionView.Location = new System.Drawing.Point(0, 3);
    71       this.parameterCollectionView.Size = new System.Drawing.Size(497, 269);
     70      this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
     71      this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
     72      this.parameterCollectionView.Location = new System.Drawing.Point(3, 3);
     73      this.parameterCollectionView.Size = new System.Drawing.Size(497, 274);
    7274      //
    7375      // nameTextBox
     
    7880      // tabControl
    7981      //
    80       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    81                   | System.Windows.Forms.AnchorStyles.Left)
    82                   | System.Windows.Forms.AnchorStyles.Right)));
     82      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     83            | System.Windows.Forms.AnchorStyles.Left)
     84            | System.Windows.Forms.AnchorStyles.Right)));
    8385      this.tabControl.Controls.Add(this.problemTabPage);
    8486      this.tabControl.Controls.Add(this.visualizationTabPage);
    85       this.tabControl.Location = new System.Drawing.Point(0, 29);
     87      this.tabControl.Location = new System.Drawing.Point(0, 27);
    8688      this.tabControl.Name = "tabControl";
    8789      this.tabControl.SelectedIndex = 0;
    88       this.tabControl.Size = new System.Drawing.Size(511, 304);
     90      this.tabControl.Size = new System.Drawing.Size(511, 306);
    8991      this.tabControl.TabIndex = 8;
    9092      //
     
    9597      this.problemTabPage.Name = "problemTabPage";
    9698      this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);
    97       this.problemTabPage.Size = new System.Drawing.Size(503, 278);
     99      this.problemTabPage.Size = new System.Drawing.Size(503, 280);
    98100      this.problemTabPage.TabIndex = 0;
    99101      this.problemTabPage.Text = "Problem";
     
    106108      this.visualizationTabPage.Name = "visualizationTabPage";
    107109      this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);
    108       this.visualizationTabPage.Size = new System.Drawing.Size(503, 278);
     110      this.visualizationTabPage.Size = new System.Drawing.Size(503, 280);
    109111      this.visualizationTabPage.TabIndex = 1;
    110112      this.visualizationTabPage.Text = "Visualization";
     
    118120      this.qapView.Location = new System.Drawing.Point(3, 3);
    119121      this.qapView.Name = "qapView";
    120       this.qapView.Size = new System.Drawing.Size(497, 272);
     122      this.qapView.Size = new System.Drawing.Size(497, 245);
    121123      this.qapView.TabIndex = 0;
    122124      this.qapView.Weights = null;
     
    128130      this.Name = "QuadraticAssignmentProblemView";
    129131      this.problemInstanceSplitContainer.Panel1.ResumeLayout(false);
    130       this.problemInstanceSplitContainer.Panel1.PerformLayout();
    131132      this.problemInstanceSplitContainer.Panel2.ResumeLayout(false);
    132133      this.problemInstanceSplitContainer.Panel2.PerformLayout();
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs

    r7641 r7878  
    3737    public QuadraticAssignmentProblemView() {
    3838      InitializeComponent();
    39       Controls.Remove(parameterCollectionView);
    40       parameterCollectionView.Dock = DockStyle.Fill;
    41       problemTabPage.Controls.Add(parameterCollectionView);
    4239    }
    4340
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/LocalImprovement/QAPExhaustiveSwap2LocalImprovement.cs

    r7259 r7878  
    100100    }
    101101
    102     public override IOperation Apply() {
    103       int maxIterations = MaximumIterationsParameter.ActualValue.Value;
    104       Permutation assignment = AssignmentParameter.ActualValue;
    105       bool maximization = MaximizationParameter.ActualValue.Value;
    106       DoubleMatrix weights = WeightsParameter.ActualValue;
    107       DoubleMatrix distances = DistancesParameter.ActualValue;
    108 
    109       double evaluatedSolutions = 0.0;
     102    public static double Improve(Permutation assignment, double quality, DoubleMatrix weights, DoubleMatrix distances, bool maximization, int maxIterations, out double evaluatedSolutions) {
     103      evaluatedSolutions = 0.0;
    110104      double evalSolPerMove = 4.0 / assignment.Length;
    111105
     
    124118        if (bestMove == null) break;
    125119        Swap2Manipulator.Apply(assignment, bestMove.Index1, bestMove.Index2);
    126         QualityParameter.ActualValue.Value += bestQuality;
     120        quality += bestQuality;
    127121      }
    128       EvaluatedSolutionsParameter.ActualValue.Value += (int)Math.Ceiling(evaluatedSolutions);
     122      return quality;
     123    }
     124
     125    public override IOperation Apply() {
     126      int maxIterations = MaximumIterationsParameter.ActualValue.Value;
     127      Permutation assignment = AssignmentParameter.ActualValue;
     128      bool maximization = MaximizationParameter.ActualValue.Value;
     129      DoubleMatrix weights = WeightsParameter.ActualValue;
     130      DoubleMatrix distances = DistancesParameter.ActualValue;
     131      double quality = QualityParameter.ActualValue.Value;
     132
     133      double evaluations;
     134      QualityParameter.ActualValue.Value = Improve(assignment, quality, weights, distances, maximization, maxIterations, out evaluations);
     135      EvaluatedSolutionsParameter.ActualValue.Value += (int)Math.Ceiling(evaluations);
    129136      return base.Apply();
    130137    }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.QuadraticAssignment-3.3/QAPLIBInstancesTest.cs

    r7558 r7878  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.IO;
    2524using System.Linq;
    2625using System.Text;
     
    176175      var qap = new QuadraticAssignmentProblem();
    177176      var failedInstances = new StringBuilder();
    178       string tempPath = Path.GetTempPath();
    179177
    180178      var instances = provider.GetDataDescriptors();
     
    196194      var qap = new QuadraticAssignmentProblem();
    197195      var failedInstances = new StringBuilder();
    198       string tempPath = Path.GetTempPath();
    199196
    200197      var instances = provider.GetDataDescriptors();
Note: See TracChangeset for help on using the changeset viewer.