Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/24/12 17:57:51 (13 years ago)
Author:
abeham
Message:

#1855:

  • Added possibility to name row and column in matrix (to have more interpretable results)
  • Added a "standard" assignment problem
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.LinearAssignment/3.3/Analyzers/BestLAPSolutionAnalyzer.cs

    r8022 r8093  
    4242      get { return (ILookupParameter<DoubleMatrix>)Parameters["Costs"]; }
    4343    }
     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    }
    4450    public IScopeTreeLookupParameter<Permutation> AssignmentParameter {
    4551      get { return (IScopeTreeLookupParameter<Permutation>)Parameters["Assignment"]; }
     
    7177      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
    7278      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));
    7381      Parameters.Add(new ScopeTreeLookupParameter<Permutation>("Assignment", "The LAP solutions from which the best solution should be analyzed."));
    7482      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the LAP solutions which should be analyzed."));
     
    8694    public override IOperation Apply() {
    8795      var costs = CostsParameter.ActualValue;
     96      var rowNames = RowNamesParameter.ActualValue;
     97      var columnNames = ColumnNamesParameter.ActualValue;
    8898      var permutations = AssignmentParameter.ActualValue;
    8999      var qualities = QualityParameter.ActualValue;
     
    122132      LAPAssignment assignment = BestSolutionParameter.ActualValue;
    123133      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));
    125135        BestSolutionParameter.ActualValue = assignment;
    126136        results.Add(new Result("Best LAP Solution", assignment));
     
    131141          assignment.Assignment = (Permutation)permutations[i].Clone();
    132142          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;
    133149        }
    134150      }
Note: See TracChangeset for help on using the changeset viewer.