Formal Definition of Framework ================================================================================ *Any/All input is welcome!* Namespace: The project files will exist in the namespace "rgenetic." Currently, there are no addtionaly namespaces within rgenetic, but this may change as the project progresses. Class Files: (inside rgenetic/ namespace) Agent Population Environment World Modules: Evolve Class File Details: Agent Attributes: chromosome # A data structure representing the genome of this agent age # The age, in generations, of this agent fitness # The fitness value assigned to this agent by the environment in which it exists Public: attr_readers: chromosome, age, fitness attr_writers: chromosome, age, fitness initialize( chromosome_in ) # Called upon creation <=>( Agent ) # Comparison operator, compares fitness of two agents to_s # Textual visualization of this agent Population Attributes: members # A data structure containing the agents who are a member of this population size # The current size of this population Public: attr_readers: members, size attr_writers: size initialize( ) # Called upon creation most_fit # Returns the agent who is most fit in this population add_member( Agent ) # Add's an agent to this population each_member( ) # An iterator, iterates over each member in the population <=>( Population ) # Comparison operator, compares fitness between 2 populations to_s # Textual visualization of the population Environment Attributes: population(s) # One or more Populations that exist in this environment mutation_rate # The frequency of mutation mutation_success # The rate at which an attempted mutation is successful crossover_rate # The frequency of a crossover event crossover_succuess # The rate at which an attempted crossover is successful catastrophy_rate # The frequency in which to introduce a "catastrophy" (high attrition, high mutation) max_age # The maximum age an agent can survive in this environment Public: attr_reader: mutation_rate, mutation_success, crossover_rate, crossover_success, catastrophy_rate, max_age, populations attr_writer: none initialize( mutation_rate, mutation_success, crossover_rate, crossover_success, catastrphy_rate, max_age ) step # Induces the populations to evolve by one generation most_fit # returns the most fit population World (Facade) Attributes: environment(s) # One or more environments which exist in this world Public: attr_reader: none attr_writer: none initialize( properties_file ) run( times ) # Forces each environment to evolve to the next generation "times" times. Returns the most fit population (? or agent?) run_until( val, max ) # Forces each environment to evolve until an agent with a fitness level of "val" is reached, or "max" number of generations have evolved step # Forces each envoronment to evolve to the next generation once. Returns the most fit popluation (? or agent?) Module Details: Evolve Attributes: none Public: attr_readers: none attr_writers: none mutate( Agent ) # Mutation of the given agent, returns the result of the mutation mutate!( Agent ) # Mutation of the given agent, modifies in place crossover( agentA, agentB ) # Crossover of agents A and B. Returns results of crossover event. crossover!( agentA, agentB )# Crossover of agents A and B, modifies in place catastrophy( agentA ) # Performs a catastrophic mutation of the given agent, returning the new agent catastrophy!( agentA ) # Performs a catastrophic mutation of the given agent, modifies in place compare( agentA, agentB ) # Compares the fitness of the 2 agents.