Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/01/12 14:36:47 (13 years ago)
Author:
gkronber
Message:

#1797: adapted return type of ConstrainedValueParameter properties in FLA branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/SortedRandomInteractionsInitializer.cs

    r7128 r8172  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     1using System.Linq;
     2using HeuristicLab.Common;
    53using HeuristicLab.Core;
    64using HeuristicLab.Data;
    7 using HeuristicLab.Common;
    8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    95using HeuristicLab.Encodings.BinaryVectorEncoding;
    106using HeuristicLab.Parameters;
     7using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    118using HeuristicLab.PluginInfrastructure;
    129
     
    1714  public class SortedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {
    1815
    19     public ConstrainedValueParameter<IBinaryVectorComparer> ComparerParameter {
    20       get { return (ConstrainedValueParameter<IBinaryVectorComparer>)Parameters["Comparer"]; }
     16    public IConstrainedValueParameter<IBinaryVectorComparer> ComparerParameter {
     17      get { return (IConstrainedValueParameter<IBinaryVectorComparer>)Parameters["Comparer"]; }
    2118    }
    2219
     
    2421      get { return ComparerParameter.Value; }
    2522    }
    26    
     23
    2724    [StorableConstructor]
    2825    protected SortedRandomInteractionsInitializer(bool serializing) : base(serializing) { }
     
    4744      try {
    4845        IBinaryVectorComparer comparer = Comparer;
    49       } catch {
     46      }
     47      catch {
    5048        Parameters.Remove("Comparer");
    5149        AddComparerParameter();
     
    6058        if (indices.Count > c) {
    6159          indices.RemoveAt(c);
    62           components[c][c] = true;         
     60          components[c][c] = true;
    6361        }
    6462        while (indices.Count > nInteractions) {
     
    6664        }
    6765        foreach (var i in indices) {
    68           components[c][i] = true;         
     66          components[c][i] = true;
    6967        }
    7068      }
    7169      BoolMatrix m = new BoolMatrix(length, nComponents);
    72       foreach (var c in components.OrderBy(v => v, Comparer).Select((v, j) => new {v, j})) {
    73         for (int i = 0; i<c.v.Length; i++) {
     70      foreach (var c in components.OrderBy(v => v, Comparer).Select((v, j) => new { v, j })) {
     71        for (int i = 0; i < c.v.Length; i++) {
    7472          m[i, c.j] = c.v[i];
    75         }   
     73        }
    7674      }
    7775      return m;
Note: See TracChangeset for help on using the changeset viewer.