Chromosome breed(Chromosome partner) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException{
        int min = genes.size();
        int max = genes.size();
        
        if( partner.getGenes().size() > min ){
            max = partner.getGenes().size();
        }else{
            min = partner.getGenes().size();
        }
        
        ArrayList<Gene> bredGenes = new ArrayList<Gene>();
        
        for (int i = 0; i < max; i++) {
            if ( i > min ){
                //randomly decide whether to add anymore genes if we 
                //over the min limit.
                if ( parent.getRandom().nextBoolean() ){break;}
            }
            
            //randomly decide which way round to add genes.
            //When the genes are added they are cloned to make sure 
            //any mutations in the genetic algorithm don't have 
            //undesired consequences.
            if (parent.getRandom().nextBoolean() ){
                //make sure we have more genes to add from this 
                //chromosome if not use the partner
                if (i<genes.size()){
                    bredGenes.add(genes.get(i).clone());
                }else{
                    bredGenes.add(partner.getGenes().get(i).clone());
                }
            }else{
                //make sure we have more genes to add from the 
                //partener if not add them from this chromosome
                if (i<partner.getGenes().size()){
                    bredGenes.add(partner.getGenes().get(i).clone());
                }else{
                    bredGenes.add(genes.get(i).clone());
                }
            }
            
        }
        
        Class[] parameterDefinition = {parent.getClass(),bredGenes.getClass()};
        Object[] parameters = {parent, bredGenes};
        Chromosome chromosome = instantiateNewChromosomeSubObject(parameterDefinition, parameters);
        return chromosome;
        
    }