- Timestamp:
- 03/28/11 15:34:30 (14 years ago)
- Location:
- branches/QAP
- Files:
-
- 11 added
- 11 deleted
- 23 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/QAP/HeuristicLab.Analysis.Views/3.3
- Property svn:ignore
-
old new 3 3 HeuristicLabAnalysisViewsPlugin.cs 4 4 *.user 5 *.vs10x
-
-
Property
svn:mergeinfo
set to
/trunk/sources/HeuristicLab.Analysis.Views/3.3 merged eligible
- Property svn:ignore
-
branches/QAP/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs
r5445 r5838 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.Windows.Forms.DataVisualization.Charting.ChartArea defaultChartArea= new System.Windows.Forms.DataVisualization.Charting.ChartArea();48 System.Windows.Forms.DataVisualization.Charting.Legend defaultLegend= new System.Windows.Forms.DataVisualization.Charting.Legend();49 System.Windows.Forms.DataVisualization.Charting.Series defaultSeries= new System.Windows.Forms.DataVisualization.Charting.Series();50 System.Windows.Forms.DataVisualization.Charting.Title defaultTitle= new System.Windows.Forms.DataVisualization.Charting.Title();47 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 48 System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 49 System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); 50 System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title(); 51 51 this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 52 52 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); … … 58 58 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 59 59 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 60 this.nameTextBox.Size = new System.Drawing.Size(287, 20); 60 this.nameTextBox.Location = new System.Drawing.Point(55, 0); 61 this.nameTextBox.Size = new System.Drawing.Size(279, 20); 61 62 // 62 // descriptionTextBox63 // infoLabel 63 64 // 64 this. descriptionTextBox.Size = new System.Drawing.Size(287, 20);65 this.infoLabel.Location = new System.Drawing.Point(340, 3); 65 66 // 66 67 // chart … … 71 72 this.chart.BorderlineColor = System.Drawing.Color.Black; 72 73 this.chart.BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid; 73 defaultChartArea.AxisX.Minimum = 0;74 defaultChartArea.CursorX.IsUserEnabled = true;75 defaultChartArea.CursorX.IsUserSelectionEnabled = true;76 defaultChartArea.CursorY.IsUserEnabled = true;77 defaultChartArea.CursorY.IsUserSelectionEnabled = true;78 defaultChartArea.Name = "Default";79 this.chart.ChartAreas.Add( defaultChartArea);80 defaultLegend.Alignment = System.Drawing.StringAlignment.Center;81 defaultLegend.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;82 defaultLegend.Name = "Default";83 this.chart.Legends.Add( defaultLegend);84 this.chart.Location = new System.Drawing.Point(0, 52);74 chartArea1.AxisX.Minimum = 0D; 75 chartArea1.CursorX.IsUserEnabled = true; 76 chartArea1.CursorX.IsUserSelectionEnabled = true; 77 chartArea1.CursorY.IsUserEnabled = true; 78 chartArea1.CursorY.IsUserSelectionEnabled = true; 79 chartArea1.Name = "Default"; 80 this.chart.ChartAreas.Add(chartArea1); 81 legend1.Alignment = System.Drawing.StringAlignment.Center; 82 legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top; 83 legend1.Name = "Default"; 84 this.chart.Legends.Add(legend1); 85 this.chart.Location = new System.Drawing.Point(0, 26); 85 86 this.chart.Name = "chart"; 86 defaultSeries.ChartArea = "Default";87 defaultSeries.Legend = "Default";88 defaultSeries.Name = "Default";89 this.chart.Series.Add( defaultSeries);90 this.chart.Size = new System.Drawing.Size(359, 2 22);91 this.chart.TabIndex = 4;87 series1.ChartArea = "Default"; 88 series1.Legend = "Default"; 89 series1.Name = "Default"; 90 this.chart.Series.Add(series1); 91 this.chart.Size = new System.Drawing.Size(359, 248); 92 this.chart.TabIndex = 3; 92 93 this.chart.Text = "chart"; 93 defaultTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));94 defaultTitle.Name = "Default";95 defaultTitle.Text = "Title";96 this.chart.Titles.Add( defaultTitle);94 title1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 95 title1.Name = "Default"; 96 title1.Text = "Title"; 97 this.chart.Titles.Add(title1); 97 98 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend); 98 99 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); … … 106 107 this.Name = "DataTableView"; 107 108 this.Size = new System.Drawing.Size(359, 274); 109 this.Controls.SetChildIndex(this.infoLabel, 0); 108 110 this.Controls.SetChildIndex(this.chart, 0); 109 111 this.Controls.SetChildIndex(this.nameLabel, 0); 110 this.Controls.SetChildIndex(this.descriptionLabel, 0);111 112 this.Controls.SetChildIndex(this.nameTextBox, 0); 112 this.Controls.SetChildIndex(this.descriptionTextBox, 0);113 113 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 114 114 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); -
branches/QAP/HeuristicLab.Encodings.PermutationEncoding/3.3/HeuristicLab.Encodings.PermutationEncoding-3.3.csproj
r5785 r5838 168 168 <Compile Include="Moves\PermutationMoveAttribute.cs" /> 169 169 <Compile Include="Moves\StandardEdgeEqualityComparer.cs" /> 170 <Compile Include="Moves\Swap \SwapMoveSoftTabuCriterion.cs" />171 <Compile Include="Moves\Swap \ExhaustiveSwapMoveGenerator.cs" />172 <Compile Include="Moves\Swap \StochasticSwapSingleMoveGenerator.cs" />173 <Compile Include="Moves\Swap \SwapMoveAbsoluteAttribute.cs" />174 <Compile Include="Moves\Swap \SwapMoveHardTabuCriterion.cs" />175 <Compile Include="Moves\Swap \SwapMoveMaker.cs" />176 <Compile Include="Moves\Swap \SwapMoveRelativeAttribute.cs" />177 <Compile Include="Moves\Swap \SwapMoveTabuMaker.cs" />178 <Compile Include="Moves\Swap \StochasticSwapMultiMoveGenerator.cs" />179 <Compile Include="Moves\Swap \SwapMoveGenerator.cs" />180 <Compile Include="Moves\Swap \SwapMove.cs" />170 <Compile Include="Moves\Swap2\ExhaustiveSwap2MoveGenerator.cs" /> 171 <Compile Include="Moves\Swap2\StochasticSwap2MultiMoveGenerator.cs" /> 172 <Compile Include="Moves\Swap2\StochasticSwap2SingleMoveGenerator.cs" /> 173 <Compile Include="Moves\Swap2\Swap2Move.cs" /> 174 <Compile Include="Moves\Swap2\Swap2MoveAbsoluteAttribute.cs" /> 175 <Compile Include="Moves\Swap2\Swap2MoveGenerator.cs" /> 176 <Compile Include="Moves\Swap2\Swap2MoveHardTabuCriterion.cs" /> 177 <Compile Include="Moves\Swap2\Swap2MoveMaker.cs" /> 178 <Compile Include="Moves\Swap2\Swap2MoveRelativeAttribute.cs" /> 179 <Compile Include="Moves\Swap2\Swap2MoveSoftTabuCriterion.cs" /> 180 <Compile Include="Moves\Swap2\Swap2MoveTabuMaker.cs" /> 181 181 <Compile Include="Moves\ThreeIndexMove.cs" /> 182 182 <Compile Include="Moves\ThreeOpt\StochasticSingleInsertionMoveGenerator.cs" /> -
branches/QAP/HeuristicLab.Encodings.PermutationEncoding/3.3/Interfaces/IPermutationSwapMoveOperator.cs
r5785 r5838 23 23 24 24 namespace HeuristicLab.Encodings.PermutationEncoding { 25 public interface IPermutationSwap MoveOperator : IPermutationMoveOperator {26 ILookupParameter<Swap Move> SwapMoveParameter { get; }25 public interface IPermutationSwap2MoveOperator : IPermutationMoveOperator { 26 ILookupParameter<Swap2Move> Swap2MoveParameter { get; } 27 27 } 28 28 } -
branches/QAP/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeIndexMove.cs
r5445 r5838 25 25 26 26 namespace HeuristicLab.Encodings.PermutationEncoding { 27 [Item("ThreeIndexMove", "A move on a permutation that is specified by 3 indices ")]27 [Item("ThreeIndexMove", "A move on a permutation that is specified by 3 indices.")] 28 28 [StorableClass] 29 29 public class ThreeIndexMove : Item { -
branches/QAP/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoIndexMove.cs
r5445 r5838 25 25 26 26 namespace HeuristicLab.Encodings.PermutationEncoding { 27 [Item("TwoIndexMove", "A move on a permutation that is specified by 2 indices ")]27 [Item("TwoIndexMove", "A move on a permutation that is specified by 2 indices.")] 28 28 [StorableClass] 29 29 public class TwoIndexMove : Item { -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.Designer.cs
r5641 r5838 75 75 this.nameLabel.Location = new System.Drawing.Point(3, 32); 76 76 // 77 // descriptionLabel78 //79 this.descriptionLabel.Location = new System.Drawing.Point(3, 58);80 //81 // descriptionTextBox82 //83 this.descriptionTextBox.Location = new System.Drawing.Point(86, 55);84 this.descriptionTextBox.Size = new System.Drawing.Size(561, 20);85 //86 77 // importInstanceButton 87 78 // … … 147 138 this.tabControl.Controls.Add(this.problemTabPage); 148 139 this.tabControl.Controls.Add(this.visualizationTabPage); 149 this.tabControl.Location = new System.Drawing.Point(0, 81);140 this.tabControl.Location = new System.Drawing.Point(0, 55); 150 141 this.tabControl.Name = "tabControl"; 151 142 this.tabControl.SelectedIndex = 0; 152 this.tabControl.Size = new System.Drawing.Size(647, 4 11);143 this.tabControl.Size = new System.Drawing.Size(647, 437); 153 144 this.tabControl.TabIndex = 8; 154 145 // … … 158 149 this.problemTabPage.Name = "problemTabPage"; 159 150 this.problemTabPage.Padding = new System.Windows.Forms.Padding(3); 160 this.problemTabPage.Size = new System.Drawing.Size(639, 385);151 this.problemTabPage.Size = new System.Drawing.Size(639, 411); 161 152 this.problemTabPage.TabIndex = 0; 162 153 this.problemTabPage.Text = "Problem"; … … 196 187 this.Name = "QuadraticAssignmentProblemView"; 197 188 this.Size = new System.Drawing.Size(647, 492); 189 this.Controls.SetChildIndex(this.infoLabel, 0); 198 190 this.Controls.SetChildIndex(this.parameterCollectionView, 0); 199 this.Controls.SetChildIndex(this.descriptionLabel, 0);200 191 this.Controls.SetChildIndex(this.nameLabel, 0); 201 192 this.Controls.SetChildIndex(this.nameTextBox, 0); 202 193 this.Controls.SetChildIndex(this.QAPLIBInstancesLabel, 0); 203 this.Controls.SetChildIndex(this.descriptionTextBox, 0);204 194 this.Controls.SetChildIndex(this.loadInstanceButton, 0); 205 195 this.Controls.SetChildIndex(this.importInstanceButton, 0); -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs
r5641 r5838 46 46 protected override void RegisterContentEvents() { 47 47 base.RegisterContentEvents(); 48 Content.Distance MatrixParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged);48 Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged); 49 49 Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged); 50 50 Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged); … … 52 52 53 53 protected override void DeregisterContentEvents() { 54 Content.Distance MatrixParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged);54 Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged); 55 55 Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged); 56 56 Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged); … … 59 59 60 60 private void DistanceMatrixParameter_ValueChanged(object sender, System.EventArgs e) { 61 qapView.Distances = Content.Distance Matrix;61 qapView.Distances = Content.Distances; 62 62 } 63 63 … … 77 77 instancesComboBox.Items.Add(instance); 78 78 } 79 qapView.Distances = Content.Distance Matrix;79 qapView.Distances = Content.Distances; 80 80 qapView.Weights = Content.Weights; 81 81 qapView.Assignment = Content.BestKnownSolution; -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/BestQAPSolutionAnalyzer.cs
r5583 r5838 89 89 90 90 public override IOperation Apply() { 91 DoubleMatrix coordinates = CoordinatesParameter.ActualValue;92 91 DoubleMatrix distances = DistancesParameter.ActualValue; 93 92 DoubleMatrix weights = WeightsParameter.ActualValue; … … 113 112 if (assignment == null) { 114 113 assignment = new QAPAssignment(weights, (Permutation)permutations[i].Clone(), new DoubleValue(qualities[i].Value)); 115 assignment.Coordinates = coordinates;116 114 assignment.Distances = distances; 117 115 BestSolutionParameter.ActualValue = assignment; … … 120 118 if (max && assignment.Quality.Value < qualities[i].Value || 121 119 !max && assignment.Quality.Value > qualities[i].Value) { 122 assignment.Coordinates = coordinates;123 120 assignment.Distances = distances; 124 121 assignment.Weights = weights; -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPEvaluator.cs
r5598 r5838 35 35 get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; } 36 36 } 37 public ILookupParameter<DoubleMatrix> DistanceMatrixParameter { 38 get { return (ILookupParameter<DoubleMatrix>)Parameters["DistanceMatrix"]; } 39 } 40 public ILookupParameter<DoubleMatrix> CoordinatesParameter { 41 get { return (ILookupParameter<DoubleMatrix>)Parameters["Coordinates"]; } 37 public ILookupParameter<DoubleMatrix> DistancesParameter { 38 get { return (ILookupParameter<DoubleMatrix>)Parameters["Distances"]; } 42 39 } 43 40 public ILookupParameter<DoubleMatrix> WeightsParameter { … … 53 50 public QAPEvaluator() { 54 51 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation that represents the current solution.")); 55 Parameters.Add(new LookupParameter<DoubleMatrix>("DistanceMatrix", "The distance matrix that contains the distances between the locations.")); 56 Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The coordinates in case the distance matrix should not be used.")); 52 Parameters.Add(new LookupParameter<DoubleMatrix>("Distances", "The distance matrix that contains the distances between the locations.")); 57 53 Parameters.Add(new LookupParameter<DoubleMatrix>("Weights", "The matrix with the weights between the facilities, that is how strongly they're connected to each other.")); 58 54 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution.")); … … 76 72 Permutation assignment = PermutationParameter.ActualValue; 77 73 DoubleMatrix weights = WeightsParameter.ActualValue; 78 DoubleMatrix distanceMatrix = Distance MatrixParameter.ActualValue;74 DoubleMatrix distanceMatrix = DistancesParameter.ActualValue; 79 75 80 76 double quality = Apply(assignment, weights, distanceMatrix); -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPInversionMoveEvaluator.cs
r5785 r5838 73 73 if (move == null) throw new InvalidOperationException("Inversion move is not found."); 74 74 Permutation assignment = PermutationParameter.ActualValue; 75 DoubleMatrix distances = Distance MatrixParameter.ActualValue;75 DoubleMatrix distances = DistancesParameter.ActualValue; 76 76 DoubleMatrix weights = WeightsParameter.ActualValue; 77 77 -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPMoveEvaluator.cs
r5785 r5838 49 49 get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; } 50 50 } 51 public ILookupParameter<DoubleMatrix> Distance MatrixParameter {52 get { return (ILookupParameter<DoubleMatrix>)Parameters["Distance Matrix"]; }51 public ILookupParameter<DoubleMatrix> DistancesParameter { 52 get { return (ILookupParameter<DoubleMatrix>)Parameters["Distances"]; } 53 53 } 54 54 public ILookupParameter<DoubleMatrix> WeightsParameter { … … 64 64 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The evaluated quality of a move on a QAP solution.")); 65 65 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); 66 Parameters.Add(new LookupParameter<DoubleMatrix>("Distance Matrix", "The matrix which contains the distances between the facilities."));66 Parameters.Add(new LookupParameter<DoubleMatrix>("Distances", "The matrix which contains the distances between the facilities.")); 67 67 Parameters.Add(new LookupParameter<DoubleMatrix>("Weights", "The matrix with the weights between the facilities, that is how strongly they're connected to each other.")); 68 68 } -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPSwapMoveEvaluator.cs
r5785 r5838 29 29 30 30 namespace HeuristicLab.Problems.QuadraticAssignment { 31 [Item("QAPSwap MoveEvaluator", "Evaluated a swapmove on a QAP solution.")]31 [Item("QAPSwap2MoveEvaluator", "Evaluated a swap-2 move on a QAP solution.")] 32 32 [StorableClass] 33 public class QAPSwap MoveEvaluator : QAPMoveEvaluator, IPermutationSwapMoveOperator {34 public ILookupParameter<Swap Move> SwapMoveParameter {35 get { return (ILookupParameter<Swap Move>)Parameters["SwapMove"]; }33 public class QAPSwap2MoveEvaluator : QAPMoveEvaluator, IPermutationSwap2MoveOperator { 34 public ILookupParameter<Swap2Move> Swap2MoveParameter { 35 get { return (ILookupParameter<Swap2Move>)Parameters["Swap2Move"]; } 36 36 } 37 37 38 38 [StorableConstructor] 39 protected QAPSwap MoveEvaluator(bool deserializing) : base(deserializing) { }40 protected QAPSwap MoveEvaluator(QAPSwapMoveEvaluator original, Cloner cloner)39 protected QAPSwap2MoveEvaluator(bool deserializing) : base(deserializing) { } 40 protected QAPSwap2MoveEvaluator(QAPSwap2MoveEvaluator original, Cloner cloner) 41 41 : base(original, cloner) { 42 42 } 43 public QAPSwap MoveEvaluator() {44 Parameters.Add(new LookupParameter<Swap Move>("SwapMove", "The move to evaluate."));43 public QAPSwap2MoveEvaluator() { 44 Parameters.Add(new LookupParameter<Swap2Move>("Swap2Move", "The move to evaluate.")); 45 45 } 46 46 47 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new QAPSwap MoveEvaluator(this, cloner);48 return new QAPSwap2MoveEvaluator(this, cloner); 49 49 } 50 50 51 public static double Apply(Permutation assignment, Swap Move move, DoubleMatrix weights, DoubleMatrix distances) {51 public static double Apply(Permutation assignment, Swap2Move move, DoubleMatrix weights, DoubleMatrix distances) { 52 52 if (move.Index1 == move.Index2) return 0; 53 53 double moveQuality = 0; … … 70 70 71 71 public override IOperation Apply() { 72 Swap Move move = SwapMoveParameter.ActualValue;73 if (move == null) throw new InvalidOperationException("Swap move is not found.");72 Swap2Move move = Swap2MoveParameter.ActualValue; 73 if (move == null) throw new InvalidOperationException("Swap-2 move is not found."); 74 74 Permutation assignment = PermutationParameter.ActualValue; 75 DoubleMatrix distances = Distance MatrixParameter.ActualValue;75 DoubleMatrix distances = DistancesParameter.ActualValue; 76 76 DoubleMatrix weights = WeightsParameter.ActualValue; 77 77 -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPTranslocationMoveEvaluator.cs
r5801 r5838 85 85 if (move == null) throw new InvalidOperationException("Translocation move is not found."); 86 86 Permutation assignment = PermutationParameter.ActualValue; 87 DoubleMatrix distances = Distance MatrixParameter.ActualValue;87 DoubleMatrix distances = DistancesParameter.ActualValue; 88 88 DoubleMatrix weights = WeightsParameter.ActualValue; 89 89 -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Interfaces/IQAPEvaluator.cs
r5598 r5838 28 28 public interface IQAPEvaluator : ISingleObjectiveEvaluator { 29 29 ILookupParameter<Permutation> PermutationParameter { get; } 30 ILookupParameter<DoubleMatrix> DistanceMatrixParameter { get; } 31 ILookupParameter<DoubleMatrix> CoordinatesParameter { get; } 30 ILookupParameter<DoubleMatrix> DistancesParameter { get; } 32 31 ILookupParameter<DoubleMatrix> WeightsParameter { get; } 33 32 } -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Interfaces/IQAPMoveEvaluator.cs
r5785 r5838 28 28 public interface IQAPMoveEvaluator : ISingleObjectiveMoveEvaluator, IMoveOperator { 29 29 ILookupParameter<Permutation> PermutationParameter { get; } 30 ILookupParameter<DoubleMatrix> Distance MatrixParameter { get; }30 ILookupParameter<DoubleMatrix> DistancesParameter { get; } 31 31 ILookupParameter<DoubleMatrix> WeightsParameter { get; } 32 32 } -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Parsers/QAPLIBParser.cs
r5648 r5838 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.IO; 3 24 -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Parsers/QAPLIBSolutionParser.cs
r5814 r5838 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Globalization; 3 24 using System.IO; -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Plugin.cs.frame
r5563 r5838 25 25 [Plugin("HeuristicLab.Problems.QuadraticAssignment", "3.3.3.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Problems.QuadraticAssignment-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.Collections", "3.3 .3")]28 [PluginDependency("HeuristicLab.Common", "3.3 .3")]29 [PluginDependency("HeuristicLab.Common.Resources", "3.3 .3")]30 [PluginDependency("HeuristicLab.Core", "3.3 .3")]31 [PluginDependency("HeuristicLab.Data", "3.3 .3")]32 [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3 .3")]33 [PluginDependency("HeuristicLab.Operators", "3.3 .3")]34 [PluginDependency("HeuristicLab.Optimization", "3.3 .3")]35 [PluginDependency("HeuristicLab.Parameters", "3.3 .3")]36 [PluginDependency("HeuristicLab.Persistence", "3.3 .3")]27 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 [PluginDependency("HeuristicLab.Common", "3.3")] 29 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 30 [PluginDependency("HeuristicLab.Core", "3.3")] 31 [PluginDependency("HeuristicLab.Data", "3.3")] 32 [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")] 33 [PluginDependency("HeuristicLab.Operators", "3.3")] 34 [PluginDependency("HeuristicLab.Optimization", "3.3")] 35 [PluginDependency("HeuristicLab.Parameters", "3.3")] 36 [PluginDependency("HeuristicLab.Persistence", "3.3")] 37 37 public class HeuristicLabProblemsQuadraticAssignmentPlugin : PluginBase { } 38 38 } -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/QAPAssignment.cs
r5648 r5838 10 10 [StorableClass] 11 11 public sealed class QAPAssignment : Item, INotifyPropertyChanged { 12 [Storable]13 private DoubleMatrix coordinates;14 public DoubleMatrix Coordinates {15 get { return coordinates; }16 set {17 bool changed = (coordinates != value);18 coordinates = value;19 if (changed) OnPropertyChanged("Coordinates");20 }21 }22 12 23 13 [Storable] … … 69 59 private QAPAssignment(QAPAssignment original, Cloner cloner) 70 60 : base(original, cloner) { 71 coordinates = cloner.Clone(original.coordinates);72 61 distances = cloner.Clone(original.distances); 73 62 weights = cloner.Clone(original.weights); -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
r5814 r5838 36 36 37 37 namespace HeuristicLab.Problems.QuadraticAssignment { 38 [Item("Quadratic Assignment Problem", "The Quadratic Assignment Problem (QAP) is the problem of assigning N facilities to N fixed locations such that there is exactly one facility in each location and thatthe distances multiplied by the connection strength between the facilities becomes minimal.")]38 [Item("Quadratic Assignment Problem", "The Quadratic Assignment Problem (QAP) can be described as the problem of assigning N facilities to N fixed locations such that there is exactly one facility in each location and that the sum of the distances multiplied by the connection strength between the facilities becomes minimal.")] 39 39 [Creatable("Problems")] 40 40 [StorableClass] … … 56 56 get { return (IValueParameter<DoubleMatrix>)Parameters["Weights"]; } 57 57 } 58 public IValueParameter<DoubleMatrix> Distance MatrixParameter {59 get { return (IValueParameter<DoubleMatrix>)Parameters["Distance Matrix"]; }58 public IValueParameter<DoubleMatrix> DistancesParameter { 59 get { return (IValueParameter<DoubleMatrix>)Parameters["Distances"]; } 60 60 } 61 61 #endregion … … 74 74 set { WeightsParameter.Value = value; } 75 75 } 76 public DoubleMatrix Distance Matrix{77 get { return Distance MatrixParameter.Value; }78 set { Distance MatrixParameter.Value = value; }76 public DoubleMatrix Distances { 77 get { return DistancesParameter.Value; } 78 set { DistancesParameter.Value = value; } 79 79 } 80 80 … … 106 106 Parameters.Add(new ValueParameter<DoubleMatrix>("Coordinates", "The coordinates of the locations. If this is changed the distance matrix is calculated automatically using the euclidean distance.")); 107 107 Parameters.Add(new ValueParameter<DoubleMatrix>("Weights", "The strength of the connection between the facilities.", new DoubleMatrix(5, 5))); 108 Parameters.Add(new ValueParameter<DoubleMatrix>("Distance Matrix", "The distance matrix which can either be specified directly without the coordinates, or can be calculated automatically from the coordinates.", new DoubleMatrix(5, 5)));108 Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "The distance matrix which can either be specified directly without the coordinates, or can be calculated automatically from the coordinates.", new DoubleMatrix(5, 5))); 109 109 110 110 Maximization = new BoolValue(false); … … 126 126 }); 127 127 128 Distance Matrix= new DoubleMatrix(new double[,] {128 Distances = new DoubleMatrix(new double[,] { 129 129 { 0, 360, 582, 582, 360 }, 130 130 { 360, 0, 360, 582, 582 }, … … 231 231 if (Evaluator != null) { 232 232 Evaluator.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 233 Evaluator.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name; 234 Evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name; 233 Evaluator.DistancesParameter.ActualName = DistancesParameter.Name; 235 234 Evaluator.WeightsParameter.ActualName = WeightsParameter.Name; 236 235 } … … 240 239 BestQAPSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 241 240 BestQAPSolutionAnalyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name; 242 BestQAPSolutionAnalyzer.DistancesParameter.ActualName = Distance MatrixParameter.Name;241 BestQAPSolutionAnalyzer.DistancesParameter.ActualName = DistancesParameter.Name; 243 242 BestQAPSolutionAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name; 244 243 BestQAPSolutionAnalyzer.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; … … 267 266 foreach (IPermutationTranslocationMoveOperator op in Operators.OfType<IPermutationTranslocationMoveOperator>()) 268 267 op.TranslocationMoveParameter.ActualName = translocationMove; 269 string swapMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationSwap MoveOperator>().First().SwapMoveParameter.ActualName;270 foreach (IPermutationSwap MoveOperator op in Operators.OfType<IPermutationSwapMoveOperator>()) {271 op.Swap MoveParameter.ActualName = swapMove;268 string swapMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationSwap2MoveOperator>().First().Swap2MoveParameter.ActualName; 269 foreach (IPermutationSwap2MoveOperator op in Operators.OfType<IPermutationSwap2MoveOperator>()) { 270 op.Swap2MoveParameter.ActualName = swapMove; 272 271 } 273 272 } … … 282 281 double dy = Coordinates[i, 1] - Coordinates[j, 1]; 283 282 distance[i, j] = Math.Sqrt(dx * dx + dy * dy); 284 distance[j, i] = Distance Matrix[i, j];283 distance[j, i] = Distances[i, j]; 285 284 } 286 285 } 287 Distance Matrix= distance;286 Distances = distance; 288 287 } 289 288 } … … 295 294 if (parser.Error != null) throw parser.Error; 296 295 Coordinates = new DoubleMatrix(); 297 Distance Matrix= new DoubleMatrix(parser.Distances);296 Distances = new DoubleMatrix(parser.Distances); 298 297 Weights = new DoubleMatrix(parser.Weights); 299 298 Name = "Quadratic Assignment Problem (imported from " + Path.GetFileNameWithoutExtension(filename) + ")"; … … 311 310 if (parser.Error != null) throw parser.Error; 312 311 Coordinates = new DoubleMatrix(); 313 Distance Matrix= new DoubleMatrix(parser.Distances);312 Distances = new DoubleMatrix(parser.Distances); 314 313 Weights = new DoubleMatrix(parser.Weights); 315 314 Name = "Quadratic Assignment Problem (loaded instance " + instance + ")"; … … 327 326 solParser.Parse(solStream, false); // most sln's seem to be of the type index = location => value = facility 328 327 if (solParser.Error != null) throw solParser.Error; 329 if (!solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distance Matrix))) {328 if (!solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distances))) { 330 329 solStream.Seek(0, SeekOrigin.Begin); 331 330 solParser.Parse(solStream, true); // some sln's seem to be of the type index = facility => value = location 332 331 if (solParser.Error != null) throw solParser.Error; 333 if (solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distance Matrix))) {332 if (solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distances))) { 334 333 BestKnownQuality = new DoubleValue(solParser.Quality); 335 334 BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment); -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPLIBInstancesTest.cs
r5814 r5838 35 35 double quality = double.NaN; 36 36 try { 37 quality = QAPEvaluator.Apply(qap.BestKnownSolution, qap.Weights, qap.Distance Matrix);37 quality = QAPEvaluator.Apply(qap.BestKnownSolution, qap.Weights, qap.Distances); 38 38 } catch (Exception ex) { 39 39 failedInstances.AppendLine("An unknown problem occurred evaluating solution of instance " + instance + ": " + ex.Message); -
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPMoveEvaluatorTest.cs
r5801 r5838 97 97 double after = QAPEvaluator.Apply(assignment, weights, distances); 98 98 // evaluate swap back 99 double move = QAPSwap MoveEvaluator.Apply(assignment, new SwapMove(index1, index2, assignment), weights, distances);99 double move = QAPSwap2MoveEvaluator.Apply(assignment, new Swap2Move(index1, index2, assignment), weights, distances); 100 100 Assert.IsTrue(move.IsAlmost(before - after)); 101 101 }
Note: See TracChangeset
for help on using the changeset viewer.