Changeset 8331 for branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.LinearAssignment
- Timestamp:
- 07/26/12 09:51:13 (12 years ago)
- Location:
- branches/ScatterSearch (trunk integration)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.LinearAssignment/3.3/Analyzers/BestLAPSolutionAnalyzer.cs
r8086 r8331 42 42 get { return (ILookupParameter<DoubleMatrix>)Parameters["Costs"]; } 43 43 } 44 public IValueLookupParameter<StringArray> RowNamesParameter { 45 get { return (IValueLookupParameter<StringArray>)Parameters["RowNames"]; } 46 } 47 public IValueLookupParameter<StringArray> ColumnNamesParameter { 48 get { return (IValueLookupParameter<StringArray>)Parameters["ColumnNames"]; } 49 } 44 50 public IScopeTreeLookupParameter<Permutation> AssignmentParameter { 45 51 get { return (IScopeTreeLookupParameter<Permutation>)Parameters["Assignment"]; } … … 71 77 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem.")); 72 78 Parameters.Add(new LookupParameter<DoubleMatrix>("Costs", LinearAssignmentProblem.CostsDescription)); 79 Parameters.Add(new ValueLookupParameter<StringArray>("RowNames", LinearAssignmentProblem.RowNamesDescription)); 80 Parameters.Add(new ValueLookupParameter<StringArray>("ColumnNames", LinearAssignmentProblem.ColumnNamesDescription)); 73 81 Parameters.Add(new ScopeTreeLookupParameter<Permutation>("Assignment", "The LAP solutions from which the best solution should be analyzed.")); 74 82 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the LAP solutions which should be analyzed.")); … … 86 94 public override IOperation Apply() { 87 95 var costs = CostsParameter.ActualValue; 96 var rowNames = RowNamesParameter.ActualValue; 97 var columnNames = ColumnNamesParameter.ActualValue; 88 98 var permutations = AssignmentParameter.ActualValue; 89 99 var qualities = QualityParameter.ActualValue; … … 122 132 LAPAssignment assignment = BestSolutionParameter.ActualValue; 123 133 if (assignment == null) { 124 assignment = new LAPAssignment(costs, (Permutation)permutations[i].Clone(), new DoubleValue(qualities[i].Value));134 assignment = new LAPAssignment(costs, rowNames, columnNames, (Permutation)permutations[i].Clone(), new DoubleValue(qualities[i].Value)); 125 135 BestSolutionParameter.ActualValue = assignment; 126 136 results.Add(new Result("Best LAP Solution", assignment)); … … 131 141 assignment.Assignment = (Permutation)permutations[i].Clone(); 132 142 assignment.Quality.Value = qualities[i].Value; 143 if (rowNames != null) 144 assignment.RowNames = rowNames; 145 else assignment.RowNames = null; 146 if (columnNames != null) 147 assignment.ColumnNames = columnNames; 148 else assignment.ColumnNames = null; 133 149 } 134 150 } -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.LinearAssignment/3.3/HungarianAlgorithm.cs
r8086 r8331 34 34 /// A genetic algorithm. 35 35 /// </summary> 36 [Item("Hungarian Algorithm", "The Hungarian algorithm can be used to solve the linear assignment problem in O(n^3). It is also known as the Kuhn–Munkres algorithm or Munkres assignment algorithm.")]36 [Item("Hungarian Algorithm", "The Hungarian algorithm can be used to solve the linear assignment problem in O(n^3). It is also known as the Kuhn–Munkres algorithm or Munkres assignment algorithm.")] 37 37 [Creatable("Algorithms")] 38 38 [StorableClass] 39 public sealed class HungarianAlgorithm : EngineAlgorithm { 39 public sealed class HungarianAlgorithm : EngineAlgorithm, IStorableContent { 40 public string Filename { get; set; } 41 40 42 #region Problem Properties 41 43 public override Type ProblemType { … … 52 54 get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 53 55 } 54 55 56 #endregion 56 57 … … 69 70 private HungarianAlgorithm(HungarianAlgorithm original, Cloner cloner) 70 71 : base(original, cloner) { 71 // TODO: clone your private fields here 72 AttachEventHandlers(); 72 RegisterEventHandlers(); 73 73 } 74 74 public HungarianAlgorithm() … … 85 85 86 86 UpdateAnalyzers(); 87 AttachEventHandlers(); 87 RegisterEventHandlers(); 88 89 Problem = new LinearAssignmentProblem(); 88 90 } 89 91 … … 121 123 #region Helpers 122 124 [StorableHook(HookType.AfterDeserialization)] 123 private void AttachEventHandlers() { 125 private void AfterDeserialization() { 126 RegisterEventHandlers(); 127 } 128 129 private void RegisterEventHandlers() { 124 130 if (Problem != null) { 125 131 Problem.SolutionCreatorChanged += new EventHandler(Problem_SolutionCreatorChanged); -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.LinearAssignment/3.3/LAPAssignment.cs
r8086 r8331 30 30 [Item("LAP Assignment", "Represents a solution to the LAP.")] 31 31 [StorableClass] 32 public sealed class LAPAssignment : Item, INotifyPropertyChanged { 32 public sealed class LAPAssignment : Item, INotifyPropertyChanged, IStorableContent { 33 public string Filename { get; set; } 33 34 34 35 [Storable] … … 40 41 costs = value; 41 42 if (changed) OnPropertyChanged("Costs"); 43 } 44 } 45 46 [Storable] 47 private StringArray rowNames; 48 public StringArray RowNames { 49 get { return rowNames; } 50 set { 51 bool changed = (rowNames != value); 52 rowNames = value; 53 if (changed) OnPropertyChanged("RowNames"); 54 } 55 } 56 57 [Storable] 58 private StringArray columnNames; 59 public StringArray ColumnNames { 60 get { return columnNames; } 61 set { 62 bool changed = (columnNames != value); 63 columnNames = value; 64 if (changed) OnPropertyChanged("ColumnNames"); 42 65 } 43 66 } … … 71 94 costs = cloner.Clone(original.costs); 72 95 assignment = cloner.Clone(original.assignment); 96 rowNames = cloner.Clone(original.rowNames); 97 columnNames = cloner.Clone(original.columnNames); 73 98 quality = cloner.Clone(original.quality); 74 99 } … … 81 106 this.quality = quality; 82 107 } 108 public LAPAssignment(DoubleMatrix costs, StringArray rowNames, StringArray columnNames, Permutation assignment) 109 : this(costs, assignment) { 110 this.rowNames = rowNames; 111 this.columnNames = columnNames; 112 } 113 public LAPAssignment(DoubleMatrix costs, StringArray rowNames, StringArray columnNames, Permutation assignment, DoubleValue quality) 114 : this(costs, rowNames, columnNames, assignment) { 115 this.quality = quality; 116 } 83 117 84 118 public override IDeepCloneable Clone(Cloner cloner) { 85 119 return new LAPAssignment(this, cloner); 86 120 } 87 88 121 89 122 public event PropertyChangedEventHandler PropertyChanged; -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.LinearAssignment/3.3/LinearAssignmentProblem.cs
r8086 r8331 36 36 [Creatable("Problems")] 37 37 [StorableClass] 38 public sealed class LinearAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<ILAPEvaluator, IPermutationCreator> {38 public sealed class LinearAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<ILAPEvaluator, IPermutationCreator>, IStorableContent { 39 39 public static readonly string CostsDescription = "The cost matrix that describes the assignment of rows to columns."; 40 public static readonly string RowNamesDescription = "The elements represented by the rows of the costs matrix."; 41 public static readonly string ColumnNamesDescription = "The elements represented by the columns of the costs matrix."; 42 43 public string Filename { get; set; } 40 44 41 45 public override Image ItemImage { … … 52 56 public IValueParameter<Permutation> BestKnownSolutionParameter { 53 57 get { return (IValueParameter<Permutation>)Parameters["BestKnownSolution"]; } 58 } 59 public IValueParameter<StringArray> RowNamesParameter { 60 get { return (IValueParameter<StringArray>)Parameters["RowNames"]; } 61 } 62 public IValueParameter<StringArray> ColumnNamesParameter { 63 get { return (IValueParameter<StringArray>)Parameters["ColumnNames"]; } 54 64 } 55 65 #endregion … … 59 69 get { return CostsParameter.Value; } 60 70 set { CostsParameter.Value = value; } 71 } 72 public StringArray RowNames { 73 get { return RowNamesParameter.Value; } 74 set { RowNamesParameter.Value = value; } 75 } 76 public StringArray ColumnNames { 77 get { return ColumnNamesParameter.Value; } 78 set { ColumnNamesParameter.Value = value; } 61 79 } 62 80 public ItemSet<Permutation> BestKnownSolutions { … … 85 103 Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null)); 86 104 Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null)); 87 105 Parameters.Add(new OptionalValueParameter<StringArray>("RowNames", RowNamesDescription)); 106 Parameters.Add(new OptionalValueParameter<StringArray>("ColumnNames", ColumnNamesDescription)); 107 88 108 ((ValueParameter<DoubleMatrix>)CostsParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; 109 ((OptionalValueParameter<StringArray>)RowNamesParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; 110 ((OptionalValueParameter<StringArray>)ColumnNamesParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; 111 112 RowNames = new StringArray(new string[] { "Eric", "Robert", "Allison" }); 113 ColumnNames = new StringArray(new string[] { "MRI", "Blood test", "Angiogram" }); 114 Costs[0, 0] = 4; Costs[0, 1] = 5; Costs[0, 2] = 3; 115 Costs[1, 0] = 6; Costs[1, 1] = 6; Costs[1, 2] = 4; 116 Costs[2, 0] = 5; Costs[2, 1] = 5; Costs[2, 2] = 1; 89 117 90 118 bestLAPSolutionAnalyzer = new BestLAPSolutionAnalyzer(); -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.LinearAssignment/3.3/Plugin.cs.frame
r8086 r8331 23 23 24 24 namespace HeuristicLab.Problems.LinearAssignment { 25 [Plugin("HeuristicLab.Problems.LinearAssignment", "3.3. 6.$WCREV$")]25 [Plugin("HeuristicLab.Problems.LinearAssignment", "3.3.7.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Problems.LinearAssignment-3.3.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.LinearAssignment/3.3/Properties/AssemblyInfo.cs.frame
r8086 r8331 55 55 // [assembly: AssemblyVersion("1.0.*")] 56 56 [assembly: AssemblyVersion("3.3.0.0")] 57 [assembly: AssemblyFileVersion("3.3. 6.$WCREV$")]57 [assembly: AssemblyFileVersion("3.3.7.$WCREV$")]
Note: See TracChangeset
for help on using the changeset viewer.