Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

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?

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • Leaders
Posted
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.

--tim
  • *Experts*
Posted

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.

 

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....*

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • Leaders
Posted
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?
--tim
  • *Experts*
Posted

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?).

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • Leaders
Posted
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?
--tim
  • *Experts*
Posted

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 ;)

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • *Experts*
Posted

Ah... finally, all the pieces are coming together (sorta).

 

Take me drunk officer, I'm home, *hic*

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • *Experts*
Posted
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.....

  • *Experts*
Posted

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.

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • *Experts*
Posted

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.

  • 3 weeks later...
  • *Experts*
Posted

IEnvironment / IGenome / IGene

 

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

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • 1 year later...
  • *Experts*
Posted

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?

Mastermind.zip

Printer Monitor for .NET? - see Merrion Computing Ltd for details
Posted

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 !! :)

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...