Skip to content

Avoiding zero-valued gene #139

Open
Open
@raulazo-m

Description

@raulazo-m

I am optimizing a function with 3 parameters according to experimental data. I defined a value space for the 3 genes:

gene_space=[np.linspace(0.6,0.8,100), np.linspace(0.1,0.2,100),np.linspace(34,35,1000)]

and this is my general configuration:

ga_instance = pygad.GA(num_generations=num_generations, num_parents_mating=num_parents_mating, fitness_func=fitness_function, sol_per_pop=sol_per_pop, num_genes=num_genes, on_generation=callback_generation, crossover_type=crossover_func, parent_selection_type=parent_selection_func, gene_space=gene_space, mutation_type="adaptive", mutation_probability = [0.5, 0.1])

I get a fairly accurate final value with respect to the experimental value in the iterative process I am using. However, sometimes some of the parameters become zero and the range of values I imposed for the genes is not respected.

Is there any way to force the genes to take a non-zero value?

Thank you very much for any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions