Changeset 11203 for branches/HiveStatistics/sources/HeuristicLab.Problems.LinearAssignment/3.3/LinearAssignmentProblemSolver.cs
- Timestamp:
- 07/18/14 12:35:00 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll11 10 HeuristicLab 3.3.5.1.ReSharper.user 12 11 HeuristicLab 3.3.6.0.ReSharper.user 13 12 HeuristicLab.4.5.resharper.user 14 13 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development16 14 HeuristicLab.resharper.user 17 15 ProtoGen.exe … … 19 17 _ReSharper.HeuristicLab 20 18 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests22 19 _ReSharper.HeuristicLab.ExtLibs 23 20 bin 24 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Problems.LinearAssignment/3.3/LinearAssignmentProblemSolver.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 34 34 private const int UNASSIGNED = -1; 35 35 36 public IValueLookupParameter<BoolValue> MaximizationParameter {37 get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }38 }39 36 public ILookupParameter<DoubleMatrix> CostsParameter { 40 37 get { return (ILookupParameter<DoubleMatrix>)Parameters["Costs"]; } … … 52 49 public LinearAssignmentProblemSolver() 53 50 : base() { 54 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "Whether the costs should be maximized or minimized."));55 51 Parameters.Add(new LookupParameter<DoubleMatrix>("Costs", LinearAssignmentProblem.CostsDescription)); 56 52 Parameters.Add(new LookupParameter<Permutation>("Assignment", "The assignment solution to create.")); … … 62 58 } 63 59 64 [StorableHook(HookType.AfterDeserialization)]65 private void AfterDeserialization() {66 // BackwardsCompatibility3.367 #region Backwards compatible code, remove with 3.468 if (!Parameters.ContainsKey("Maximization"))69 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "Whether the costs should be maximized or minimized."));70 #endregion71 }72 73 60 public override IOperation Apply() { 74 61 var costs = CostsParameter.ActualValue; 75 var maximization = MaximizationParameter.ActualValue.Value;76 if (maximization) {77 costs = (DoubleMatrix)costs.Clone();78 for (int i = 0; i < costs.Rows; i++)79 for (int j = 0; j < costs.Rows; j++)80 costs[i, j] = -costs[i, j];81 }82 62 double quality; 83 63 var solution = Solve(costs, out quality); 84 64 85 65 AssignmentParameter.ActualValue = new Permutation(PermutationTypes.Absolute, solution); 86 if (maximization) quality = -quality;87 66 QualityParameter.ActualValue = new DoubleValue(quality); 88 67
Note: See TracChangeset
for help on using the changeset viewer.