Print

Print



Can any one please help?

The problem is :in a regression problem.  i simply want to add a new individual after each generation, it's like (the same individual '+' 0.01 ), the problem is in how to solve the issue of the constrains and to add a new individual in the individual array as it's restricted for a limited number, i thought to remove the worst individual and add this one, but as i told u i face problem in constraints and how to set up the add gpnode and and the constraints of the class which returns back the value of 0.0.

this is the code, it's written in simpleexchanger class
========================================================
double lowestRaw=10000;//very small value to acheive the if condition below in the first time
        GPIndividual tempInd=null;

        for(int i=0;i<((GPIndividual)(state.population.subpops[0].individuals[0])).size();i++){

            double temp=((KozaFitness)(((GPIndividual)(state.population.subpops[0].individuals[i])).fitness)).rawFitness();

            if(temp<lowestRaw){
                lowestRaw=temp;
                tempInd=((GPIndividual)(state.population.subpops[0].individuals[i]));

            }//end of if

        }//end of for
                
        
        GPIndividual bestInd=(GPIndividual) tempInd.clone();
        GPNode add=new Add();
        add.setup(state, new Parameter("pop"));
        add.children[0]=bestInd.trees[0].child;
        GPNode small=new SmallValue();
        small.setup(state, new Parameter("pop"));
        add.children[1]=small;
        add.children[0].parent=add;
        add.children[1].parent=add;
        GPIndividual newInd=new GPIndividual();
        newInd.setup(state, new Parameter("pop"));
        newInd.trees[0].child=add;

        double biggestRaw=0;
        GPIndividual worstInd=null;
        for (int i=0;i<state.population.subpops[0].individuals.length;i++){
            double temp=((KozaFitness)((GPIndividual)(state.population.subpops[0].individuals[i])).fitness).rawFitness();
            if (temp>biggestRaw){
                biggestRaw=temp;
                worstInd=(GPIndividual)(state.population.subpops[0].individuals[i]);
            }
        }
        worstInd=newInd;
        ====================================
this is the output of the program
===================================================
Initializing Generation 0
        SubPopulation number 0 evaluated succesfully
        SubPopulation number 100 evaluated succesfully
        SubPopulation number 200 evaluated succesfully
        SubPopulation number 300 evaluated succesfully
        SubPopulation number 400 evaluated succesfully
        SubPopulation number 500 evaluated succesfully
Subpop 0 best fitness of generation: Fitness: Raw=3558.1477 Adjusted=2.8096614E-4 Hits=0
FATAL ERROR:
No node constraints are defined for the GPNode +
PARAMETER: pop.nc
     ALSO: gp.node.nc
Java Result: 1
============================


could u please help ?
I'm looking forward to ur reply
thanks for ur time
urs 
mohamed taher