Class: WattsStrogatzConnectStrategy
- Inherits:
-
ConnectStrategy
- Object
- ConnectStrategy
- WattsStrogatzConnectStrategy
- Defined in:
- lib/gimuby/genetic/archipelago/connect_strategy/watts_strogatz_connect_strategy.rb
Instance Attribute Summary collapse
-
#average_degree ⇒ Object
Returns the value of attribute average_degree.
-
#rewire_rate ⇒ Object
Returns the value of attribute rewire_rate.
Instance Method Summary collapse
- #connect(archipelago) ⇒ Object
-
#initialize ⇒ WattsStrogatzConnectStrategy
constructor
A new instance of WattsStrogatzConnectStrategy.
Constructor Details
#initialize ⇒ WattsStrogatzConnectStrategy
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_degree ⇒ Object
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_rate ⇒ Object
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 |