Skip to content

ability to define default values in the define_algorithm_and_builder_macro #267

@andresliszt

Description

@andresliszt

The introduction of the mentioned macro simplifies a lot the creation of a new algorithm, however it doesn't allow to define default values for survival or selection operators. For example, in NSGA-III I'd like to have are_aspirational defaulted in false as shown in the code below

use ndarray::Array2;

use crate::{
    define_algorithm_and_builder,
    operators::{
        selection::moo::Nsga3RandomSelection, survival::moo::Nsga3ReferencePointsSurvival,
    },
};

define_algorithm_and_builder!(
    Nsga3,
    Nsga3RandomSelection,
    Nsga3ReferencePointsSurvival,
    survival_args = [ reference_points: Array2<f64>, are_aspirational: bool  = false]
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions