Re: [Quantproject-developers] QuantProject/b1_ADT/Optimizing/Genetic GeneticOptimizer.cs, 1.23, 1.
Brought to you by:
glauco_1
|
From: Glauco S. <gl...@my...> - 2007-06-19 22:05:23
|
Mi sembra ci sia un problema nel codice: la get dovrebbe essere cosi'
(spero ti arrivi formattato in modo decente):
>+ if ( ! this.hasFitnessBeenAssigned )
{
>+ // the genome's fitness has not been
>assigned yet
>+ this.fitness =
>this.genomeManager.GetFitnessValue(this);
this.hasFitnessBeenAssigned = true;
}
> return this.fitness;
Confermi?
At 07:18 PM 6/19/2007 +0000, you wrote:
>Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic
>In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10974
>
>Modified Files:
> GeneticOptimizer.cs Genome.cs
>Log Message:
>AssignMeaning and CalculateFitness have been deleted from the
>GeneticOptimizer.
>Now the calculation of fitness and the meaning's assigning are controlled
>by the get method inside Fitness and Meaning properties.
>
>Index: Genome.cs
>===================================================================
>RCS file:
>/cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v
>retrieving revision 1.15
>retrieving revision 1.16
>diff -C2 -d -r1.15 -r1.16
>*** Genome.cs 3 Jan 2007 22:56:49 -0000 1.15
>--- Genome.cs 19 Jun 2007 19:18:38 -0000 1.16
>***************
>*** 44,47 ****
>--- 44,48 ----
> private GeneticOptimizer geneticOptimizer;
> private int generation;
>+ private bool hasFitnessBeenAssigned;
>
> public bool HasBeenCloned
>***************
>*** 67,79 ****
> throw new Exception(
> "The fitness for this
> genome is not a number!" );
> return this.fitness;
> }
>! set{this.fitness = value;}
> }
>
> public object Meaning
> {
>! get{return this.meaning;}
>! set{this.meaning = value;}
> }
>
>--- 68,96 ----
> throw new Exception(
> "The fitness for this
> genome is not a number!" );
>+ if ( ! this.hasFitnessBeenAssigned )
>+ // the genome's fitness has not been
>assigned yet
>+ this.fitness =
>this.genomeManager.GetFitnessValue(this);
> return this.fitness;
> }
>! set
>! {
>! this.fitness = value;
>! this.hasFitnessBeenAssigned = true;
>! }
> }
>
> public object Meaning
> {
>! get
>! {
>! if ( this.meaning == null )
>! // the genome's meaning has not been
>assigned yet
>! this.meaning = this.genomeManager.Decode(
>this );
>! return this.meaning;
>! }
>! set
>! {
>! this.meaning = value;
>! }
> }
>
>
>Index: GeneticOptimizer.cs
>===================================================================
>RCS file:
>/cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GeneticOptimizer.cs,v
>retrieving revision 1.23
>retrieving revision 1.24
>diff -C2 -d -r1.23 -r1.24
>*** GeneticOptimizer.cs 3 Jan 2007 23:20:11 -0000 1.23
>--- GeneticOptimizer.cs 19 Jun 2007 19:18:38 -0000 1.24
>***************
>*** 421,426 ****
> Genome g = new Genome(this.genomeManager, this);
> g.CreateGenes();
>- g.CalculateFitness();
>- g.AssignMeaning();
> this.currentGeneration.Add(g);
> }
>--- 421,424 ----
>***************
>*** 480,484 ****
> this.mutateGenomes();
> this.createNextGeneration_transmitEliteToNextGeneration();
>- this.calculateFitnessAndMeaningForAllGenomes();
> this.updateCurrentGeneration();
> this.sortCurrentGenerationAndFireNewGenerationEvent();
>--- 478,481 ----
>***************
>*** 494,513 ****
> }
> }
>!
>! private void calculateFitnessAndMeaningForAllGenomes()
>! {
>! foreach(Genome g in this.nextGeneration)
>! {
>! if(!g.HasBeenCloned || g.HasBeenChanged)
>! //if it has been cloned and it has not been changed,
>! //it's useless
>! //to calculate again fitness and meaning
>! {
>! g.CalculateFitness();
>! g.AssignMeaning();
>! }
>! }
>! }
>!
> private void updateCurrentGeneration()
> {
>--- 491,495 ----
> }
> }
>!
> private void updateCurrentGeneration()
> {
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>_______________________________________________
>Quantproject-developers mailing list
>Qua...@li...
>https://lists.sourceforge.net/lists/listinfo/quantproject-developers
|