Class: NEAT::NeatOb

Inherits:
Object
  • Object
show all
Includes:
DeepDive
Defined in:
lib/rubyneat/rubyneat.rb

Overview

Basis of all NEAT objects

Direct Known Subclasses

Controller, Controller::NeatSettings, Critter, Critter::Genotype, Critter::Genotype::Gene, Critter::Phenotype, Evolver::CritterOp, Graph::DependencyResolver, Neuron, Operator, Population, Trait

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (NeatOb) initialize(controller = nil, name = nil)

Initializer for all NEAT objects. Requires that the controller object is specified for all classes with the exception of the Controller itself or the Controller's NeatSettings.



99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/rubyneat/rubyneat.rb', line 99

def initialize(controller = nil, name = nil)
  @name = unless name.nil?
            name.to_sym
          else
            NEAT::random_name_generator
          end
  unless controller.nil?
    @controller = controller
  else
    raise NeatException.new "Controller Needed!" unless self.is_a?(Controller) or self.is_a?(Controller::NeatSettings)
    @controller = self unless self.is_a? Controller::NeatSettings
  end
end

Instance Attribute Details

- (Object) controller (readonly)

Who's your daddy?



90
91
92
# File 'lib/rubyneat/rubyneat.rb', line 90

def controller
  @controller
end

- (Object) name (readonly)

Designation of this particular object instance



87
88
89
# File 'lib/rubyneat/rubyneat.rb', line 87

def name
  @name
end

Class Method Details

+ (Object) log



93
# File 'lib/rubyneat/rubyneat.rb', line 93

def self.log ; $log; end

Instance Method Details

- (Object) log



92
# File 'lib/rubyneat/rubyneat.rb', line 92

def log ; $log ; end

- (Object) to_s



113
114
115
# File 'lib/rubyneat/rubyneat.rb', line 113

def to_s
  "%s<%s>" % [self.class, self.name]
end