Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/01/15 15:32:22 (9 years ago)
Author:
ascheibe
Message:

#2306

  • removed unused usings
  • renamed plugin.cs file
  • fixed prebuild event
  • fixed plugin dependencies
  • added license headers
  • updated assemblyinfo
File:
1 edited

Legend:

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

    r7128 r12566  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    222using System.Collections.Generic;
    323using System.Linq;
    4 using System.Text;
     24using HeuristicLab.Common;
    525using HeuristicLab.Core;
    626using HeuristicLab.Data;
    7 using HeuristicLab.Common;
     27using HeuristicLab.Encodings.BinaryVectorEncoding;
    828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    9 using HeuristicLab.Encodings.BinaryVectorEncoding;
    10 using HeuristicLab.Parameters;
    11 using HeuristicLab.PluginInfrastructure;
    1229
    1330namespace HeuristicLab.Problems.NK {
     
    1532  [Item("IncreasingBlockSizeInteractionsInitializer", "Randomly assignes interactions across all bits but makes sure that different numbers of ineractions are applied to different bits.")]
    1633  [StorableClass]
    17   public class IncreasingBlockSizeInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {   
    18    
     34  public class IncreasingBlockSizeInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {
     35
    1936    [StorableConstructor]
    2037    protected IncreasingBlockSizeInteractionsInitializer(bool serializing) : base(serializing) { }
    2138    protected IncreasingBlockSizeInteractionsInitializer(IncreasingBlockSizeInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
    22     public IncreasingBlockSizeInteractionsInitializer() {     
     39    public IncreasingBlockSizeInteractionsInitializer() {
    2340    }
    24    
     41
    2542
    2643    public override IDeepCloneable Clone(Cloner cloner) {
    2744      return new IncreasingBlockSizeInteractionsInitializer(this, cloner);
    28     }   
     45    }
    2946
    3047    #region IInteractionInitializer Members
    3148    public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) {
    3249      Dictionary<int, int> bitInteractionCounts = new Dictionary<int, int>();
    33       for (int i = 0; i<length; i++) {
    34         int count = nInteractions*2*i/length;
     50      for (int i = 0; i < length; i++) {
     51        int count = nInteractions * 2 * i / length;
    3552        if (count > 0)
    3653          bitInteractionCounts[i] = count;
     
    3956      while (bitInteractionCounts.Count > 0) {
    4057        BinaryVector component = new BinaryVector(length);
    41         for (int i = 0; i<nInteractions; i++) {         
     58        for (int i = 0; i < nInteractions; i++) {
    4259          while (bitInteractionCounts.Count > 0) {
    4360            int bit = bitInteractionCounts.ElementAt(random.Next(bitInteractionCounts.Count)).Key;
     
    4865              break;
    4966            }
    50           }         
     67          }
    5168        }
    5269        components.Add(component);
    53       }     
     70      }
    5471      BoolMatrix m = new BoolMatrix(length, components.Count);
    55       foreach (var c in components.Select((v, j) => new {v, j})) {
    56         for (int i = 0; i<c.v.Length; i++) {
     72      foreach (var c in components.Select((v, j) => new { v, j })) {
     73        for (int i = 0; i < c.v.Length; i++) {
    5774          m[i, c.j] = c.v[i];
    58         }   
     75        }
    5976      }
    6077      return m;
Note: See TracChangeset for help on using the changeset viewer.