Package org.uma.evolver.algorithm.meta
Class MetaAsyncNSGAIIBuilder
java.lang.Object
org.uma.evolver.algorithm.meta.MetaAsyncNSGAIIBuilder
Builder for creating asynchronous multi-threaded NSGA-II instances for optimization tasks.
This builder provides a convenient way to configure and create instances of
AsynchronousMultiThreadedNSGAII with sensible defaults for asynchronous parallel
execution. It follows the builder pattern for fluent configuration of algorithm parameters.
Example usage:
MetaAsyncNSGAIIBuilder builder = new MetaAsyncNSGAIIBuilder(problem)
.setPopulationSize(100)
.setMaxEvaluations(10000)
.setNumberOfCores(4)
.setCrossover(new SBXCrossover(1.0, 20.0))
.setMutation(new PolynomialMutation(1.0, 20.0));
AsynchronousMultiThreadedNSGAII<DoubleSolution> nsgaii = builder.build();
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMetaAsyncNSGAIIBuilder(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.doublesolution.DoubleSolution> problem) Creates a new builder with the specified problem. -
Method Summary
Modifier and TypeMethodDescriptionorg.uma.jmetal.parallel.asynchronous.algorithm.impl.AsynchronousMultiThreadedNSGAII<org.uma.jmetal.solution.doublesolution.DoubleSolution> build()Builds and configures an asynchronous multi-threaded NSGA-II instance.setCrossover(org.uma.jmetal.operator.crossover.CrossoverOperator<org.uma.jmetal.solution.doublesolution.DoubleSolution> crossover) Sets the crossover operator to be used by the algorithm.setMaxEvaluations(int maxEvaluations) Sets the maximum number of evaluations for the algorithm.setMutation(org.uma.jmetal.operator.mutation.MutationOperator<org.uma.jmetal.solution.doublesolution.DoubleSolution> mutation) Sets the mutation operator to be used by the algorithm.setNumberOfCores(int numberOfCores) Sets the number of CPU cores to use for parallel evaluation.setPopulationSize(int populationSize) Sets the population size for the asynchronous NSGA-II algorithm.
-
Constructor Details
-
MetaAsyncNSGAIIBuilder
public MetaAsyncNSGAIIBuilder(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.doublesolution.DoubleSolution> problem) Creates a new builder with the specified problem.Initializes with default operators:
- Crossover: SBX with probability 1.0 and distribution index 20.0
- Mutation: Polynomial with probability 1.0 and distribution index 20.0
- Parameters:
problem- the optimization problem to be solved (must not be null)- Throws:
NullPointerException- if the problem is null
-
-
Method Details
-
setPopulationSize
Sets the population size for the asynchronous NSGA-II algorithm.- Parameters:
populationSize- the population size (must be non-negative)- Returns:
- this builder instance for method chaining
- Throws:
IllegalArgumentException- if populationSize is negative
-
setMaxEvaluations
Sets the maximum number of evaluations for the algorithm.- Parameters:
maxEvaluations- the maximum number of evaluations (must be non-negative)- Returns:
- this builder instance for method chaining
- Throws:
IllegalArgumentException- if maxEvaluations is negative
-
setNumberOfCores
Sets the number of CPU cores to use for parallel evaluation.- Parameters:
numberOfCores- the number of CPU cores (must be non-negative)- Returns:
- this builder instance for method chaining
- Throws:
IllegalArgumentException- if numberOfCores is negative
-
setCrossover
public MetaAsyncNSGAIIBuilder setCrossover(org.uma.jmetal.operator.crossover.CrossoverOperator<org.uma.jmetal.solution.doublesolution.DoubleSolution> crossover) Sets the crossover operator to be used by the algorithm.- Parameters:
crossover- the crossover operator (must not be null)- Returns:
- this builder instance for method chaining
- Throws:
NullPointerException- if crossover is null
-
setMutation
public MetaAsyncNSGAIIBuilder setMutation(org.uma.jmetal.operator.mutation.MutationOperator<org.uma.jmetal.solution.doublesolution.DoubleSolution> mutation) Sets the mutation operator to be used by the algorithm.- Parameters:
mutation- the mutation operator (must not be null)- Returns:
- this builder instance for method chaining
- Throws:
NullPointerException- if mutation is null
-
build
public org.uma.jmetal.parallel.asynchronous.algorithm.impl.AsynchronousMultiThreadedNSGAII<org.uma.jmetal.solution.doublesolution.DoubleSolution> build()Builds and configures an asynchronous multi-threaded NSGA-II instance.The returned instance is ready for execution with the configured parameters. The algorithm will use the specified number of cores for parallel evaluation and will terminate after reaching the maximum number of evaluations.
- Returns:
- a fully configured asynchronous NSGA-II instance
- Throws:
IllegalStateException- if required parameters are not set properly
-