Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/24/12 17:57:51 (12 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/LinearAssignmentProblem.cs

    r8022 r8093  
    3838  public sealed class LinearAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<ILAPEvaluator, IPermutationCreator> {
    3939    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.";
    4042
    4143    public override Image ItemImage {
     
    5254    public IValueParameter<Permutation> BestKnownSolutionParameter {
    5355      get { return (IValueParameter<Permutation>)Parameters["BestKnownSolution"]; }
     56    }
     57    public IValueParameter<StringArray> RowNamesParameter {
     58      get { return (IValueParameter<StringArray>)Parameters["RowNames"]; }
     59    }
     60    public IValueParameter<StringArray> ColumnNamesParameter {
     61      get { return (IValueParameter<StringArray>)Parameters["ColumnNames"]; }
    5462    }
    5563    #endregion
     
    5967      get { return CostsParameter.Value; }
    6068      set { CostsParameter.Value = value; }
     69    }
     70    public StringArray RowNames {
     71      get { return RowNamesParameter.Value; }
     72      set { RowNamesParameter.Value = value; }
     73    }
     74    public StringArray ColumnNames {
     75      get { return ColumnNamesParameter.Value; }
     76      set { ColumnNamesParameter.Value = value; }
    6177    }
    6278    public ItemSet<Permutation> BestKnownSolutions {
     
    85101      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));
    86102      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      
     103      Parameters.Add(new OptionalValueParameter<StringArray>("RowNames", RowNamesDescription));
     104      Parameters.Add(new OptionalValueParameter<StringArray>("ColumnNames", ColumnNamesDescription));
     105
    88106      ((ValueParameter<DoubleMatrix>)CostsParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
     107      ((OptionalValueParameter<StringArray>)RowNamesParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
     108      ((OptionalValueParameter<StringArray>)ColumnNamesParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
     109
     110      RowNames = new StringArray(new string[] { "Human", "Von Neumann machine", "Quantum computer" });
     111      ColumnNames = new StringArray(new string[] { "Find a person's e-mail address", "Compute first 1000 decimals of Pi", "Factorize large integers" });
     112      Costs[0, 0] = 1; Costs[0, 1] = 10; Costs[0, 2] = 100;
     113      Costs[1, 0] = 10; Costs[1, 1] = 1; Costs[1, 2] = 100;
     114      Costs[2, 0] = 100; Costs[2, 1] = 10; Costs[2, 1] = 1;
    89115
    90116      bestLAPSolutionAnalyzer = new BestLAPSolutionAnalyzer();
Note: See TracChangeset for help on using the changeset viewer.