Class: WattsStrogatzConnectStrategy

Inherits:
ConnectStrategy show all
Defined in:
lib/gimuby/genetic/archipelago/connect_strategy/watts_strogatz_connect_strategy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWattsStrogatzConnectStrategy

Returns a new instance of WattsStrogatzConnectStrategy.



5
6
7
8
# File 'lib/gimuby/genetic/archipelago/connect_strategy/watts_strogatz_connect_strategy.rb', line 5

def initialize
  @average_degree = 4.0
  @rewire_rate = 0.2
end

Instance Attribute Details

#average_degreeObject

Returns the value of attribute average_degree.



10
11
12
# File 'lib/gimuby/genetic/archipelago/connect_strategy/watts_strogatz_connect_strategy.rb', line 10

def average_degree
  @average_degree
end

#rewire_rateObject

Returns the value of attribute rewire_rate.



11
12
13
# File 'lib/gimuby/genetic/archipelago/connect_strategy/watts_strogatz_connect_strategy.rb', line 11

def rewire_rate
  @rewire_rate
end

Instance Method Details

#connect(archipelago) ⇒ Object



13
14
15
16
# File 'lib/gimuby/genetic/archipelago/connect_strategy/watts_strogatz_connect_strategy.rb', line 13

def connect(archipelago)
  make_regular_latice(archipelago)
  rewire(archipelago)
end