Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhancing stop_criteria for Multi-Objective Optimization #314

Open
@Scyneo

Description

In the current PyGAD implementation, the stop_criteria parameter references the fitness function's return value to determine when the desired fitness has been achieved. For example:

def fitness_func(ga_instance, solution, solution_idx):
 output = numpy.sum(solution * equation_inputs)
 fitness = 1.0 / (numpy.abs(output - desired_output) + 0.000001)
 return fitness
ga_instance = pygad.GA(
 num_generations=200,
 sol_per_pop=10,
 num_parents_mating=4,
 num_genes=len(equation_inputs),
 fitness_func=fitness_func,
 stop_criteria=["reach_127.4", "saturate_15"])

In this case, the reach_127.4 is pretty clear with what it does. However, the docs do not specify how stop_criteria works in the context of multi-objective optimization, where the fitness function returns multiple values like here:

def fitness_func(ga_instance, solution, solution_idx):
 ...
 return [fitness1, fitness2, ..., fitnessN]

From a quick look at the code I deduced that pygad actually supports it, but it's just not mentioned in the docs. So if I'm correct something like this works just fine for multi-objective optimization:

ga_instance = pygad.GA(
 num_generations=200,
 sol_per_pop=10,
 num_parents_mating=4,
 num_genes=len(equation_inputs),
 fitness_func=fitness_func,
 stop_criteria=["reach_127.4", "reach_130.1", "saturate_15"])

If that's the case, it would be great to have docs updated to reflect this mechanism

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /