Class BinaryNSGAII
- All Implemented Interfaces:
BaseLevelAlgorithm<org.uma.jmetal.solution.binarysolution.BinarySolution>
This class extends the base BaseNSGAII implementation to handle binary-encoded
solutions, providing specialized support for binary-specific operations and parameters.
Key features include:
- Support for binary-encoded solution spaces
- Configurable genetic operators through the parameter space
- Automatic handling of solution encoding/decoding
- Integration with JMetal's binary problem interface
Example usage:
// Create a binary problem instance
BinaryProblem problem = new MyBinaryProblem();
// Configure the algorithm
int populationSize = 100;
int maxEvaluations = 25000;
ParameterSpace parameterSpace = new ParameterSpace();
// Configure parameter space with desired operators and parameters
// Create and run the algorithm
BinaryNSGAII algorithm = new BinaryNSGAII(problem, populationSize, maxEvaluations, parameterSpace);
algorithm.run();
// Get results
List<BinarySolution> population = algorithm.result();
The algorithm automatically configures non-configurable parameters such as the number of bits in the solution based on the problem definition. For binary problems, the total number of bits is automatically determined from the problem instance.
- Since:
- version
- Author:
- Your Name (your.email@example.com)
- See Also:
-
Field Summary
Fields inherited from class org.uma.evolver.algorithm.base.nsgaii.BaseNSGAII
densityEstimator, externalArchive, maximumNumberOfEvaluations, offspringPopulationSize, parameterSpace, populationSize, problem, ranking, rankingAndCrowdingComparator -
Constructor Summary
ConstructorsConstructorDescriptionBinaryNSGAII(int populationSize, ParameterSpace parameterSpace) Constructs a new instance of BinaryNSGAII with the specified population size and parameter space.BinaryNSGAII(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.binarysolution.BinarySolution> problem, int populationSize, int maximumNumberOfEvaluations, ParameterSpace parameterSpace) Constructs a fully configured BinaryNSGAII instance ready for execution. -
Method Summary
Modifier and TypeMethodDescriptionBaseLevelAlgorithm<org.uma.jmetal.solution.binarysolution.BinarySolution> createInstance(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.binarysolution.BinarySolution> problem, int maximumNumberOfEvaluations) Creates and returns a new instance of BinaryNSGAII configured for the specified problem.protected voidConfigures non-configurable parameters based on the problem's characteristics.Methods inherited from class org.uma.evolver.algorithm.base.nsgaii.BaseNSGAII
build, createEvaluation, createExternalArchive, createInitialSolutions, createReplacement, createSelection, createTermination, createVariation, parameterSpaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.uma.evolver.algorithm.base.BaseLevelAlgorithm
parse
-
Constructor Details
-
BinaryNSGAII
Constructs a new instance of BinaryNSGAII with the specified population size and parameter space.Note: This creates a partially configured instance. The
createInstance(Problem, int)method must be called with a problem instance before the algorithm can be used.- Parameters:
populationSize- the size of the population to be used in the algorithm. Must be positive.parameterSpace- the parameter space containing configuration parameters for the algorithm. Must not be null.- Throws:
IllegalArgumentException- if populationSize is not positive or parameterSpace is null
-
BinaryNSGAII
public BinaryNSGAII(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.binarysolution.BinarySolution> problem, int populationSize, int maximumNumberOfEvaluations, ParameterSpace parameterSpace) Constructs a fully configured BinaryNSGAII instance ready for execution.- Parameters:
problem- the binary problem to be solved. Must implement the BinaryProblem interface.populationSize- the size of the population. Must be a positive integer.maximumNumberOfEvaluations- the evaluation budget for the algorithm. The algorithm will terminate once this number of evaluations is reached.parameterSpace- the parameter space containing configuration parameters for the algorithm.- Throws:
IllegalArgumentException- if any parameter is invalid (null or non-positive values where required)ClassCastException- if the provided problem does not implement BinaryProblem
-
-
Method Details
-
createInstance
public BaseLevelAlgorithm<org.uma.jmetal.solution.binarysolution.BinarySolution> createInstance(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.binarysolution.BinarySolution> problem, int maximumNumberOfEvaluations) Creates and returns a new instance of BinaryNSGAII configured for the specified problem.This method implements the factory method pattern, allowing the creation of algorithm instances with the same configuration but potentially different problems or evaluation limits.
- Parameters:
problem- the binary optimization problem to solve. Must not be null.maximumNumberOfEvaluations- the maximum number of evaluations allowed for the new instance. Must be positive.- Returns:
- a new, fully configured instance of BinaryNSGAII
- Throws:
IllegalArgumentException- if problem is null or maximumNumberOfEvaluations is not positive
-
setNonConfigurableParameters
protected void setNonConfigurableParameters()Configures non-configurable parameters based on the problem's characteristics.This method is automatically called during algorithm initialization to set up parameters that depend on the specific problem instance, such as the total number of bits in the solution. It configures mutation parameters based on the problem's binary encoding.
- Specified by:
setNonConfigurableParametersin classBaseNSGAII<org.uma.jmetal.solution.binarysolution.BinarySolution>
-