Class BaseMOPSO
- All Implemented Interfaces:
BaseLevelAlgorithm<org.uma.jmetal.solution.doublesolution.DoubleSolution>
This class provides a configurable implementation of the MOPSO algorithm, supporting various components and strategies through a flexible parameter space. It serves as a foundation for different MOPSO variants and configurations.
Key features include:
- Configurable swarm initialization and evaluation
- Flexible velocity and position update strategies
- Support for different inertia weight computation methods
- Optional external archive for storing non-dominated solutions
- Customizable perturbation operators
- Extensible architecture for different MOPSO variants
Example usage:
// Create a problem instance
DoubleProblem problem = new MyDoubleProblem();
// Configure the algorithm
int leaderArchiveSize = 100;
int maxEvaluations = 25000;
ParameterSpace parameterSpace = new ParameterSpace();
// Configure parameter space with desired components and parameters
// Create and run the algorithm
BaseMOPSO mopso = new BaseMOPSO(problem, leaderArchiveSize, maxEvaluations, parameterSpace);
mopso.run();
// Get results
List<DoubleSolution> population = mopso.result();
- Since:
- version
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.uma.jmetal.util.archive.Archive<org.uma.jmetal.solution.doublesolution.DoubleSolution> Optional external archive for storing additional solutions.protected org.uma.jmetal.util.archive.BoundedArchive<org.uma.jmetal.solution.doublesolution.DoubleSolution> Archive storing the best solutions found (leaders).protected intThe size of the leader archive storing non-dominated solutions.protected intThe maximum number of evaluations allowed for the algorithm.protected org.uma.jmetal.problem.doubleproblem.DoubleProblemThe optimization problem to be solved.protected intThe size of the particle swarm. -
Constructor Summary
ConstructorsConstructorDescriptionBaseMOPSO(int leaderArchiveSize, ParameterSpace parameterSpace) Constructs a new BaseMOPSO instance with the specified leader archive size and parameter space.BaseMOPSO(org.uma.jmetal.problem.doubleproblem.DoubleProblem problem, int leaderArchiveSize, int maximumNumberOfEvaluations, ParameterSpace parameterSpace) Constructs a fully configured BaseMOPSO instance ready for execution. -
Method Summary
Modifier and TypeMethodDescriptionorg.uma.jmetal.component.algorithm.ParticleSwarmOptimizationAlgorithmbuild()Builds and configures the MOPSO algorithm based on the current parameter space.protected org.uma.jmetal.component.catalogue.common.evaluation.Evaluation<org.uma.jmetal.solution.doublesolution.DoubleSolution> Creates the evaluation component for the algorithm.protected org.uma.jmetal.util.archive.Archive<org.uma.jmetal.solution.doublesolution.DoubleSolution> Creates and configures the external archive based on the parameter space settings.protected org.uma.jmetal.component.catalogue.pso.globalbestinitialization.GlobalBestInitializationCreates the strategy for initializing global best solutions.protected org.uma.jmetal.component.catalogue.pso.globalbestselection.GlobalBestSelectionCreates the strategy for selecting the global best solution.protected org.uma.jmetal.component.catalogue.pso.globalbestupdate.GlobalBestUpdateCreates the strategy for updating the global best solution.protected org.uma.jmetal.component.catalogue.pso.inertiaweightcomputingstrategy.InertiaWeightComputingStrategyCreates the strategy for computing inertia weight during the search.protected org.uma.jmetal.component.catalogue.common.solutionscreation.SolutionsCreation<org.uma.jmetal.solution.doublesolution.DoubleSolution> Creates the component responsible for generating the initial population of solutions.BaseLevelAlgorithm<org.uma.jmetal.solution.doublesolution.DoubleSolution> createInstance(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.doublesolution.DoubleSolution> problem, int maximumNumberOfEvaluations) Creates a new instance of BaseMOPSO configured for the specified problem and evaluation limit.protected org.uma.jmetal.component.catalogue.pso.localbestinitialization.LocalBestInitializationCreates the strategy for initializing local best solutions.protected org.uma.jmetal.component.catalogue.pso.localbestupdate.LocalBestUpdateCreates the strategy for updating local best solutions.protected org.uma.jmetal.component.catalogue.pso.perturbation.PerturbationCreates the operator for applying perturbations to solutions.protected org.uma.jmetal.component.catalogue.pso.positionupdate.PositionUpdateCreates the operator for updating particle positions.protected org.uma.jmetal.component.catalogue.common.termination.TerminationCreates the termination condition for the algorithm.protected org.uma.jmetal.component.catalogue.pso.velocityinitialization.VelocityInitializationCreates the strategy for initializing particle velocities.protected org.uma.jmetal.component.catalogue.pso.velocityupdate.VelocityUpdateCreates the operator for updating particle velocities.Returns the parameter space used by this algorithm.protected voidConfigures non-configurable parameters based on the problem's characteristics.Methods 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
-
Field Details
-
leaderArchiveSize
protected int leaderArchiveSizeThe size of the leader archive storing non-dominated solutions. -
problem
protected org.uma.jmetal.problem.doubleproblem.DoubleProblem problemThe optimization problem to be solved. -
maximumNumberOfEvaluations
protected int maximumNumberOfEvaluationsThe maximum number of evaluations allowed for the algorithm. -
swarmSize
protected int swarmSizeThe size of the particle swarm. -
leaderArchive
protected org.uma.jmetal.util.archive.BoundedArchive<org.uma.jmetal.solution.doublesolution.DoubleSolution> leaderArchiveArchive storing the best solutions found (leaders). -
externalArchive
protected org.uma.jmetal.util.archive.Archive<org.uma.jmetal.solution.doublesolution.DoubleSolution> externalArchiveOptional external archive for storing additional solutions.
-
-
Constructor Details
-
BaseMOPSO
Constructs a new BaseMOPSO instance with the specified leader archive 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:
leaderArchiveSize- the size of the leader archive. Must be positive.parameterSpace- the parameter space containing configuration parameters for the algorithm. Must not be null.- Throws:
IllegalArgumentException- if leaderArchiveSize is not positive or parameterSpace is null
-
BaseMOPSO
public BaseMOPSO(org.uma.jmetal.problem.doubleproblem.DoubleProblem problem, int leaderArchiveSize, int maximumNumberOfEvaluations, ParameterSpace parameterSpace) Constructs a fully configured BaseMOPSO instance ready for execution.- Parameters:
problem- the double optimization problem to be solved. Must implement the DoubleProblem interface.leaderArchiveSize- the size of the leader archive. Must be positive.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 DoubleProblem
-
-
Method Details
-
parameterSpace
Returns the parameter space used by this algorithm.- Specified by:
parameterSpacein interfaceBaseLevelAlgorithm<org.uma.jmetal.solution.doublesolution.DoubleSolution>- Returns:
- the parameter space containing all configurable components and parameters
-
build
public org.uma.jmetal.component.algorithm.ParticleSwarmOptimizationAlgorithm build()Builds and configures the MOPSO algorithm based on the current parameter space.This method initializes all necessary components for the MOPSO algorithm, including:
- Termination condition
- Evaluation strategy
- Swarm initialization
- Velocity and position update strategies
- Best solution tracking (local and global)
- Perturbation operators
- Archiving mechanisms
- Specified by:
buildin interfaceBaseLevelAlgorithm<org.uma.jmetal.solution.doublesolution.DoubleSolution>- Returns:
- a fully configured ParticleSwarmOptimizationAlgorithm instance
- Throws:
IllegalStateException- if required parameters are not properly configured
-
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:
- Swarm size
- Leader archive configuration
- Velocity update parameters
- Inertia weight computation
- Mutation parameters
- Position update bounds
-
createExternalArchive
protected org.uma.jmetal.util.archive.Archive<org.uma.jmetal.solution.doublesolution.DoubleSolution> createExternalArchive()Creates and configures the external archive based on the parameter space settings.The external archive stores additional non-dominated solutions found during the search. The size of the archive is set according to the leader archive size specified during construction.
- Returns:
- the configured external archive instance
- Throws:
IllegalStateException- if the external archive cannot be created or configured- See Also:
-
createInstance
public BaseLevelAlgorithm<org.uma.jmetal.solution.doublesolution.DoubleSolution> createInstance(org.uma.jmetal.problem.Problem<org.uma.jmetal.solution.doublesolution.DoubleSolution> problem, int maximumNumberOfEvaluations) Creates a new instance of BaseMOPSO configured for the specified problem and evaluation limit.This method implements the factory method pattern, allowing the creation of algorithm instances with the same configuration but potentially different problems or evaluation limits. The new instance will have its own parameter space configuration.
- Specified by:
createInstancein interfaceBaseLevelAlgorithm<org.uma.jmetal.solution.doublesolution.DoubleSolution>- Parameters:
problem- the 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 BaseMOPSO
- Throws:
IllegalArgumentException- if problem is null or maximumNumberOfEvaluations is not positiveClassCastException- if the provided problem does not implement DoubleProblem
-
createEvaluation
protected org.uma.jmetal.component.catalogue.common.evaluation.Evaluation<org.uma.jmetal.solution.doublesolution.DoubleSolution> createEvaluation()Creates the evaluation component for the algorithm.This method determines whether to use a basic sequential evaluation or an evaluation with an external archive based on the current configuration. If an external archive is being used, the evaluation will automatically update it with new non-dominated solutions.
- Returns:
- the configured evaluation component
- See Also:
-
createTermination
protected org.uma.jmetal.component.catalogue.common.termination.Termination createTermination()Creates the termination condition for the algorithm.This implementation creates a termination condition based on the maximum number of evaluations specified during construction. The algorithm will stop once this number of solution evaluations is reached.
- Returns:
- the termination condition based on evaluation count
- See Also:
-
createInitialSolutionsCreation
protected org.uma.jmetal.component.catalogue.common.solutionscreation.SolutionsCreation<org.uma.jmetal.solution.doublesolution.DoubleSolution> createInitialSolutionsCreation()Creates the component responsible for generating the initial population of solutions.- Returns:
- the solutions creation component
-
createVelocityInitialization
protected org.uma.jmetal.component.catalogue.pso.velocityinitialization.VelocityInitialization createVelocityInitialization()Creates the strategy for initializing particle velocities.- Returns:
- the velocity initialization strategy
-
createLocalBestInitialization
protected org.uma.jmetal.component.catalogue.pso.localbestinitialization.LocalBestInitialization createLocalBestInitialization()Creates the strategy for initializing local best solutions.- Returns:
- the local best initialization strategy
-
createGlobalBestInitialization
protected org.uma.jmetal.component.catalogue.pso.globalbestinitialization.GlobalBestInitialization createGlobalBestInitialization()Creates the strategy for initializing global best solutions.- Returns:
- the global best initialization strategy
-
createInertiaWeightStrategy
protected org.uma.jmetal.component.catalogue.pso.inertiaweightcomputingstrategy.InertiaWeightComputingStrategy createInertiaWeightStrategy()Creates the strategy for computing inertia weight during the search.- Returns:
- the inertia weight computing strategy
-
createVelocityUpdate
protected org.uma.jmetal.component.catalogue.pso.velocityupdate.VelocityUpdate createVelocityUpdate()Creates the operator for updating particle velocities.- Returns:
- the velocity update operator
-
createPositionUpdate
protected org.uma.jmetal.component.catalogue.pso.positionupdate.PositionUpdate createPositionUpdate()Creates the operator for updating particle positions.- Returns:
- the position update operator
-
createPerturbation
protected org.uma.jmetal.component.catalogue.pso.perturbation.Perturbation createPerturbation()Creates the operator for applying perturbations to solutions.- Returns:
- the perturbation operator
-
createGlobalBestUpdate
protected org.uma.jmetal.component.catalogue.pso.globalbestupdate.GlobalBestUpdate createGlobalBestUpdate()Creates the strategy for updating the global best solution.- Returns:
- the global best update strategy
-
createLocalBestUpdate
protected org.uma.jmetal.component.catalogue.pso.localbestupdate.LocalBestUpdate createLocalBestUpdate()Creates the strategy for updating local best solutions.- Returns:
- the local best update strategy
-
createGlobalBestSelection
protected org.uma.jmetal.component.catalogue.pso.globalbestselection.GlobalBestSelection createGlobalBestSelection()Creates the strategy for selecting the global best solution.- Returns:
- the global best selection strategy
-