Changeset 8022
- Timestamp:
- 06/18/12 02:53:03 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 9 added
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r7985 r8022 248 248 <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project> 249 249 <Name>HeuristicLab.Data.Views-3.3</Name> 250 <Private>False</Private> 250 251 </ProjectReference> 251 252 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 252 253 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 253 254 <Name>HeuristicLab.Data-3.3</Name> 255 <Private>False</Private> 254 256 </ProjectReference> 255 257 <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj"> … … 271 273 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 272 274 <Name>HeuristicLab.Parameters-3.3</Name> 275 <Private>False</Private> 273 276 </ProjectReference> 274 277 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> … … 285 288 <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project> 286 289 <Name>HeuristicLab.Problems.Instances-3.3</Name> 290 <Private>False</Private> 287 291 </ProjectReference> 288 292 </ItemGroup> -
trunk/sources/HeuristicLab.Problems.LinearAssignment.Views/3.3/HeuristicLab.Problems.LinearAssignment.Views-3.3.csproj
r7874 r8022 102 102 </PropertyGroup> 103 103 <ItemGroup> 104 <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 105 <Private>False</Private> 106 </Reference> 104 107 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 105 108 <HintPath>..\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> … … 114 117 <ItemGroup> 115 118 <None Include="Plugin.cs.frame" /> 116 <Compile Include="L inearAssignmentProblemView.cs">119 <Compile Include="LAPAssignmentView.cs"> 117 120 <SubType>UserControl</SubType> 118 121 </Compile> 119 <Compile Include="L inearAssignmentProblemView.Designer.cs">120 <DependentUpon>L inearAssignmentProblemView.cs</DependentUpon>122 <Compile Include="LAPAssignmentView.Designer.cs"> 123 <DependentUpon>LAPAssignmentView.cs</DependentUpon> 121 124 </Compile> 122 125 <Compile Include="Plugin.cs" /> … … 148 151 <Private>False</Private> 149 152 </ProjectReference> 153 <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj"> 154 <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project> 155 <Name>HeuristicLab.Data.Views-3.3</Name> 156 <Private>False</Private> 157 </ProjectReference> 150 158 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 151 159 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> … … 153 161 <Private>False</Private> 154 162 </ProjectReference> 163 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj"> 164 <Project>{DBECB8B0-B166-4133-BAF1-ED67C3FD7FCA}</Project> 165 <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name> 166 <Private>False</Private> 167 </ProjectReference> 155 168 <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj"> 156 169 <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project> … … 163 176 <Private>False</Private> 164 177 </ProjectReference> 165 <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj"> 166 <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project> 167 <Name>HeuristicLab.Optimization.Views-3.3</Name> 168 <Private>False</Private> 169 </ProjectReference> 170 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 171 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 172 <Name>HeuristicLab.Optimization-3.3</Name> 178 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 179 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 180 <Name>HeuristicLab.Operators-3.3</Name> 173 181 <Private>False</Private> 174 182 </ProjectReference> -
trunk/sources/HeuristicLab.Problems.LinearAssignment.Views/3.3/Plugin.cs.frame
r7937 r8022 25 25 [Plugin("HeuristicLab.Problems.LinearAssignment.Views", "3.3.6.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Problems.LinearAssignment.Views-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.Core", "3.3")] 27 28 [PluginDependency("HeuristicLab.Core.Views", "3.3")] 28 29 [PluginDependency("HeuristicLab.Data", "3.3")] 30 [PluginDependency("HeuristicLab.Data.Views", "3.3")] 31 [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")] 29 32 [PluginDependency("HeuristicLab.MainForm", "3.3")] 30 33 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")] 31 [PluginDependency("HeuristicLab.Optimization", "3.3")]32 [PluginDependency("HeuristicLab.Optimization.Views", "3.3")]33 34 [PluginDependency("HeuristicLab.Problems.LinearAssignment", "3.3")] 34 35 public class HeuristicLabProblemsLinearAssignmentViewsPlugin : PluginBase { -
trunk/sources/HeuristicLab.Problems.LinearAssignment/3.3/HeuristicLab.Problems.LinearAssignment-3.3.csproj
r7874 r8022 112 112 </ItemGroup> 113 113 <ItemGroup> 114 <Compile Include="HungarianAlgorithm.cs" /> 115 <Compile Include="LAPAssignment.cs" /> 114 116 <None Include="Plugin.cs.frame" /> 117 <Compile Include="Analyzers\BestLAPSolutionAnalyzer.cs" /> 118 <Compile Include="Interfaces\ILAPEvaluator.cs" /> 119 <Compile Include="LAPEvaluator.cs" /> 115 120 <Compile Include="LinearAssignmentProblem.cs" /> 116 121 <Compile Include="LinearAssignmentProblemSolver.cs" /> … … 123 128 </ItemGroup> 124 129 <ItemGroup> 130 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 131 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 132 <Name>HeuristicLab.Analysis-3.3</Name> 133 <Private>False</Private> 134 </ProjectReference> 125 135 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 126 136 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> … … 146 156 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 147 157 <Name>HeuristicLab.Data-3.3</Name> 158 <Private>False</Private> 159 </ProjectReference> 160 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj"> 161 <Project>{DBECB8B0-B166-4133-BAF1-ED67C3FD7FCA}</Project> 162 <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name> 148 163 <Private>False</Private> 149 164 </ProjectReference> -
trunk/sources/HeuristicLab.Problems.LinearAssignment/3.3/LinearAssignmentProblem.cs
r7934 r8022 22 22 using System; 23 23 using System.Drawing; 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 28 using HeuristicLab.Encodings.PermutationEncoding; 27 29 using HeuristicLab.Optimization; 28 30 using HeuristicLab.Parameters; 29 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 using HeuristicLab.PluginInfrastructure; 30 33 31 34 namespace HeuristicLab.Problems.LinearAssignment { … … 33 36 [Creatable("Problems")] 34 37 [StorableClass] 35 public sealed class LinearAssignmentProblem : Problem { 38 public sealed class LinearAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<ILAPEvaluator, IPermutationCreator> { 39 public static readonly string CostsDescription = "The cost matrix that describes the assignment of rows to columns."; 40 36 41 public override Image ItemImage { 37 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } … … 42 47 get { return (IValueParameter<DoubleMatrix>)Parameters["Costs"]; } 43 48 } 44 public IValueParameter<I ntArray> SolutionParameter {45 get { return (IValueParameter<I ntArray>)Parameters["Solution"]; }49 public IValueParameter<ItemSet<Permutation>> BestKnownSolutionsParameter { 50 get { return (IValueParameter<ItemSet<Permutation>>)Parameters["BestKnownSolutions"]; } 46 51 } 47 public IValueParameter< DoubleValue> QualityParameter {48 get { return (IValueParameter< DoubleValue>)Parameters["Quality"]; }52 public IValueParameter<Permutation> BestKnownSolutionParameter { 53 get { return (IValueParameter<Permutation>)Parameters["BestKnownSolution"]; } 49 54 } 50 55 #endregion … … 55 60 set { CostsParameter.Value = value; } 56 61 } 57 public I ntArray Solution{58 get { return SolutionParameter.Value; }59 set { SolutionParameter.Value = value; }62 public ItemSet<Permutation> BestKnownSolutions { 63 get { return BestKnownSolutionsParameter.Value; } 64 set { BestKnownSolutionsParameter.Value = value; } 60 65 } 61 public DoubleValue Quality{62 get { return QualityParameter.Value; }63 set { QualityParameter.Value = value; }66 public Permutation BestKnownSolution { 67 get { return BestKnownSolutionParameter.Value; } 68 set { BestKnownSolutionParameter.Value = value; } 64 69 } 70 #endregion 65 71 66 #endregion 72 [Storable] 73 private BestLAPSolutionAnalyzer bestLAPSolutionAnalyzer; 67 74 68 75 [StorableConstructor] … … 70 77 private LinearAssignmentProblem(LinearAssignmentProblem original, Cloner cloner) 71 78 : base(original, cloner) { 79 this.bestLAPSolutionAnalyzer = cloner.Clone(original.bestLAPSolutionAnalyzer); 72 80 AttachEventHandlers(); 73 81 } 74 82 public LinearAssignmentProblem() 75 : base( ) {76 Parameters.Add(new ValueParameter<DoubleMatrix>("Costs", "The cost matrix that describes the assignment of rows to columns.", new DoubleMatrix(3, 3)));77 Parameters.Add(new OptionalValueParameter<I ntArray>("Solution", "An optimal solution.", null));78 Parameters.Add(new OptionalValueParameter< DoubleValue>("Quality", "The solution quality.", null));79 83 : base(new LAPEvaluator(), new RandomPermutationCreator()) { 84 Parameters.Add(new ValueParameter<DoubleMatrix>("Costs", CostsDescription, new DoubleMatrix(3, 3))); 85 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 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 80 88 ((ValueParameter<DoubleMatrix>)CostsParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; 81 89 90 bestLAPSolutionAnalyzer = new BestLAPSolutionAnalyzer(); 91 SolutionCreator.PermutationParameter.ActualName = "Assignment"; 92 InitializeOperators(); 93 Parameterize(); 82 94 AttachEventHandlers(); 83 95 } … … 88 100 89 101 #region Events 102 protected override void OnEvaluatorChanged() { 103 base.OnEvaluatorChanged(); 104 Parameterize(); 105 } 106 protected override void OnOperatorsChanged() { 107 base.OnOperatorsChanged(); 108 Parameterize(); 109 } 110 protected override void OnSolutionCreatorChanged() { 111 base.OnSolutionCreatorChanged(); 112 SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged); 113 Parameterize(); 114 } 90 115 private void Costs_RowsChanged(object sender, EventArgs e) { 91 if (Costs.Rows != Costs.Columns) 116 if (Costs.Rows != Costs.Columns) { 92 117 ((IStringConvertibleMatrix)Costs).Columns = Costs.Rows; 118 Parameterize(); 119 } 93 120 } 94 121 private void Costs_ColumnsChanged(object sender, EventArgs e) { 95 if (Costs.Rows != Costs.Columns) 122 if (Costs.Rows != Costs.Columns) { 96 123 ((IStringConvertibleMatrix)Costs).Rows = Costs.Columns; 124 Parameterize(); 125 } 126 } 127 private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) { 128 Parameterize(); 97 129 } 98 130 #endregion … … 107 139 Costs.RowsChanged += new EventHandler(Costs_RowsChanged); 108 140 Costs.ColumnsChanged += new EventHandler(Costs_ColumnsChanged); 141 SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged); 142 } 143 144 private void InitializeOperators() { 145 Operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>()); 146 Operators.RemoveAll(x => x is IMoveOperator); 147 Operators.Add(bestLAPSolutionAnalyzer); 148 } 149 150 private void Parameterize() { 151 SolutionCreator.LengthParameter.Value = new IntValue(Costs.Rows); 152 SolutionCreator.LengthParameter.Hidden = false; 153 Evaluator.CostsParameter.ActualName = CostsParameter.Name; 154 Evaluator.CostsParameter.Hidden = true; 155 Evaluator.AssignmentParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 156 Evaluator.AssignmentParameter.Hidden = true; 157 158 foreach (var op in Operators.OfType<IPermutationCrossover>()) { 159 op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 160 op.ParentsParameter.Hidden = true; 161 op.ChildParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 162 op.ChildParameter.Hidden = true; 163 } 164 165 foreach (var op in Operators.OfType<IPermutationManipulator>()) { 166 op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 167 op.PermutationParameter.Hidden = true; 168 } 169 170 foreach (var op in Operators.OfType<IPermutationMultiNeighborhoodShakingOperator>()) { 171 op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 172 op.PermutationParameter.Hidden = true; 173 } 174 175 bestLAPSolutionAnalyzer.AssignmentParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 176 bestLAPSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 177 bestLAPSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 178 bestLAPSolutionAnalyzer.BestKnownSolutionsParameter.ActualName = BestKnownSolutionsParameter.Name; 179 bestLAPSolutionAnalyzer.CostsParameter.ActualName = CostsParameter.Name; 180 bestLAPSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 181 bestLAPSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 109 182 } 110 183 #endregion -
trunk/sources/HeuristicLab.Problems.LinearAssignment/3.3/LinearAssignmentProblemSolver.cs
r7873 r8022 21 21 22 22 using HeuristicLab.Common; 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.PermutationEncoding; 26 using HeuristicLab.Operators; 27 using HeuristicLab.Parameters; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 29 25 30 namespace HeuristicLab.Problems.LinearAssignment { 26 public static class LinearAssignmentProblemSolver { 31 [Item("LinearAssignmentProblemSolver", "Uses the hungarian algorithm to solve linear assignment problems.")] 32 [StorableClass] 33 public sealed class LinearAssignmentProblemSolver : SingleSuccessorOperator { 27 34 private const int UNASSIGNED = -1; 35 36 public ILookupParameter<DoubleMatrix> CostsParameter { 37 get { return (ILookupParameter<DoubleMatrix>)Parameters["Costs"]; } 38 } 39 public ILookupParameter<Permutation> AssignmentParameter { 40 get { return (ILookupParameter<Permutation>)Parameters["Assignment"]; } 41 } 42 public ILookupParameter<DoubleValue> QualityParameter { 43 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } 44 } 45 46 [StorableConstructor] 47 private LinearAssignmentProblemSolver(bool deserializing) : base(deserializing) { } 48 private LinearAssignmentProblemSolver(LinearAssignmentProblemSolver original, Cloner cloner) : base(original, cloner) { } 49 public LinearAssignmentProblemSolver() 50 : base() { 51 Parameters.Add(new LookupParameter<DoubleMatrix>("Costs", LinearAssignmentProblem.CostsDescription)); 52 Parameters.Add(new LookupParameter<Permutation>("Assignment", "The assignment solution to create.")); 53 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the solution.")); 54 } 55 56 public override IDeepCloneable Clone(Cloner cloner) { 57 return new LinearAssignmentProblemSolver(this, cloner); 58 } 59 60 public override IOperation Apply() { 61 var costs = CostsParameter.ActualValue; 62 double quality; 63 var solution = Solve(costs, out quality); 64 65 AssignmentParameter.ActualValue = new Permutation(PermutationTypes.Absolute, solution); 66 QualityParameter.ActualValue = new DoubleValue(quality); 67 68 return base.Apply(); 69 } 28 70 29 71 /// <summary> -
trunk/sources/HeuristicLab.Problems.LinearAssignment/3.3/Plugin.cs.frame
r7873 r8022 25 25 [Plugin("HeuristicLab.Problems.LinearAssignment", "3.3.6.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Problems.LinearAssignment-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] 27 28 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 29 [PluginDependency("HeuristicLab.Common", "3.3")] … … 30 31 [PluginDependency("HeuristicLab.Core", "3.3")] 31 32 [PluginDependency("HeuristicLab.Data", "3.3")] 33 [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")] 34 [PluginDependency("HeuristicLab.Operators", "3.3")] 32 35 [PluginDependency("HeuristicLab.Optimization", "3.3")] 33 36 [PluginDependency("HeuristicLab.Parameters", "3.3")]
Note: See TracChangeset
for help on using the changeset viewer.