RFC: A .NET Evolutionary computing framework...

Merrion

Junior Contributor
Joined
Sep 29, 2001
Messages
265
Location
Dublin, Ireland
An evolutionary computing framework is one that facilitates the principles of evolution for solving problems.
The main players are:
IEnvironment - The interface that defines the environment of the problem. The environment is responsible for defining the viability of individuals.

IPopulation is a type safe collection class with additional methods for querying the population as a whole (such as the average viability and viability spread etc.) and affecting it (culling).

IIndividual is a single individual that represents a possible solution in the problem. An individual has a set of genes that define it's solution to the problem space and individuals may breed which will result in offspring with genes selected at random from each parent.

IGene represents a parameter that affects a part of the solution.

For example, suppose we have a chess board with a game in play and want to select the best next move. Our class that inherits IEnvironment needs to supply a method that returns the viability of an individual - i.e. how sensible a move is.
Genes are created that specify which piece to move and which of it's possible end positions to chose. The population is seeded with a random set of individuals with a random mix of these genes.
The population is allowed to breed and then the bottom half are culled. This process is repeated a number of times until the population has a zero (or prechosen very low) viability spread. An individual in this population fits our best move.

The power of this framework is that it can be mapped to a huge range of problems by setting the environment and genes and the same underlying processes can be used to solve these problems.

Anyway - that is where I have got to. Any thoughts?
 
Merrion said:
Any thoughts?
Yep. You've successfully confused me:)
Maybe you could either enhance your example, specifically to show how the IGene is related. If you have an idea of what the methods are on these interfaces, it'd probably give more insight into what you're getting at too.
 
Yep. You've successfully confused me

It's a good start.

OK - the environment determines the health of the individual. In the real world of evolution for example if the individual is a short-legged zebra then the environment will cause it to be eaten by lions.

Visual Basic:
Interface IEnvironment

   Sub CalculateIndividualsViability(Individual As IIndividual)

   Readonly Property Population() As IPopulation

End Iterface
When an individual is passed to this subroutine it can either be passed as viable or killed off as being unviable. ...

*goes off to seek stronger coffee....*
 
So an IIndividual has, say, a collection of attributes (IGenes?) which mean little until they are introduced into the IEnvironment. At which time the attributes can be inspected for those that are considered "weaknesses/strengths" for that particular environment, which will ultimately determine whether it can survive in the environment based on some environmental threshold? Wouldn't there have to be a collection of IPopulations in the IEnvironment? Am I totally missing you?
 
At the moment I only envisage one population which is a collection of like typed individuals, because until I have that sorted there is no way I will be able to work out any predator-prey type interactions between populations.

OK - the individual has a collection of genes. Each gene has a value and a name and affects one aspect of the problem space.

All individuals have the same set of genes by name, but perhaps different values. When two individuals breed (probably implemented by IPopulation as it doesn't make sense for individuals to be in charge of their own breeding - or does it?) then the offspring has a gene pool that contains genes randomly selected from either parent (plus a random error factor determined by the environment?).
 
Ok, I think I'm tracking with the concept now. Now I'm trying to get a handle on a real-world problem that it could be used to solve (ie. non-gaming). Got an example of that?
 
I'll have you know I haven't had a cont all night drinkstable ;)

Now the terrarium is a simulation type thing which is all well and good but what I want to do is use the .NET programming env. to do what these eggheads are doing.

Did I mention I'm part Irish?
I'm only Irish by marriage...but sure that's close enough ;)
 
Merrion said:
When two individuals breed (probably implemented by IPopulation as it doesn't make sense for individuals to be in charge of their own breeding - or does it?) then the offspring has a gene pool that contains genes randomly selected from either parent (plus a random error factor determined by the environment?).

Breeding (the product of which instantiates my day job) is rarely random, and frequently is affected by the afore mentioned ale
(not infrequently with disastrous results). :eek:

Allowing a near extinction of some genes would be essential. I say near extinction because over the course of
evolution a non expressed gene in the pool may re-imerge to provide an essential component of a solution.
Complete extinction would create loss of a method by a class that over iterations may be essential to the survival of the class.
On the other hand, other methods may interfere with new methods instantiated from the mixing of types.
These would best be relegated to non-expressed genes.

And I've been sober 12 years.
:p

Twisted minds.....
 
I think an intermediary between Individual and Gene is needed because the position of a gene in the set is also an important factor....

IGeneSet A known-layout collection of genes that is constant across all individuals belonging to the same population.
 
Since the individual is defined by the collection of genes, or as I
said before, by the expression of some of those genes,
your intermediary would need to describe the method of that
expression and since breeding is implemented (otherwise, what's
the point, there can be no evolution without it), their
heirarchachal dominance in expression.
 
IEnvironment / IGenome / IGene

Visual Basic:
Public MustInherit Class IEnvironment

    Public MustOverride Function GetPopulation() As IPopulation

End Class

#Region "IGenome base class"
'\\ --[IGenome]----------------------------------------------------------------------------
'\\  The genome defines the number of genes a member of a population has and their explicit 
'\\ locations. These locations have an explicit meaning in relation to the problem being 
'\\ tested by the environment and are not interchangeable
'\\ ----------------------------------------------------------------------------------------
Public MustInherit Class IGenome
    Inherits System.Collections.DictionaryBase

End Class
#End Region

#Region "Individuals type safe collection"
'\\ --[Individuals]-------------------------------------------------------------------------
'\\  A collection of IGenome based objects
'\\ ----------------------------------------------------------------------------------------
Public Class Individuals
    Inherits System.Collections.CollectionBase

End Class
#End Region

'\\ --[IPopulation]------------------------------------------------------------------------
'\\ The population represents a set of potential solutions to the problem. It can be 
'\\ created from a randomly generated, or seeded by a predefined set, of individuals.
'\\ ----------------------------------------------------------------------------------------
Public MustInherit Class IPopulation
    Inherits System.Collections.CollectionBase

    Public MustOverride Function Breed(ByVal Parents As Individuals) As IGenome

#Region "Public constructors"
    Public Sub New()

    End Sub

    Public Sub New(ByVal Seedgroup As Individuals)

    End Sub
#End Region
End Class
'\\ --[IGene]-------------------------------------------------------------------------------
'\\ The gene holds the current value for an individual variable that is used to compute the 
'\\ gene set's fitness to solve the environment's problem
'\\ ----------------------------------------------------------------------------------------
Public MustInherit Class IGene

    Public MustOverride Property Value() As Integer

    Public MustOverride Property MinimumValue() As Integer

    Public MustOverride Property MaximumValue() As Integer

End Class
 
I know it seems like gravedigging but this really has been sat at the bottom of my todo list for all this while.

Attached is an updated version of the framework and a hello world application of same - a program that tries to solve the "Mastermind" game (coloured pegs thing).

Any thoughts?
 

Attachments

Damn... I'm sure you were all in the same party and that you were pretty drunk at that time !!! :p

but hey.... it work. Maybe we shall see your problem again. Gravedigging is only to those who try to bring skeleton back... but this is a great living idea that could make more sens to a program than anything I've seen before (I'm tired of those flame war between VB.NET and C# :p)

We have a project here I think. What is your goal with this ? I'm interested !! :)
 
Back
Top