Class RandomRangeEvaluationsStrategy
java.lang.Object
org.uma.evolver.metaoptimizationproblem.evaluationbudgetstrategy.RandomRangeEvaluationsStrategy
- All Implemented Interfaces:
EvaluationBudgetStrategy
Implementation of EvaluationBudgetStrategy that generates random evaluation counts within a specified range.
Each call to getEvaluations() returns a random value between minEvaluations and maxEvaluations (inclusive).
- Author:
- Antonio J. Nebro
-
Constructor Summary
ConstructorsConstructorDescriptionRandomRangeEvaluationsStrategy(int minEvaluations, int maxEvaluations) Creates a new RandomRangeEvaluationsStrategy with the specified range.RandomRangeEvaluationsStrategy(int minEvaluations, int maxEvaluations, Random random) Creates a new RandomRangeEvaluationsStrategy with the specified range and random seed. -
Method Summary
Modifier and TypeMethodDescriptionintgetEvaluations(int problemIndex) Retrieves the number of evaluations to be performed for a specific problem.intReturns the maximum number of evaluations.intReturns the minimum number of evaluations.voidvalidate(int numberOfProblems) Validates the configuration of the evaluation budget strategy against the number of problems.
-
Constructor Details
-
RandomRangeEvaluationsStrategy
public RandomRangeEvaluationsStrategy(int minEvaluations, int maxEvaluations) Creates a new RandomRangeEvaluationsStrategy with the specified range.- Parameters:
minEvaluations- the minimum number of evaluations (inclusive)maxEvaluations- the maximum number of evaluations (inclusive)- Throws:
IllegalArgumentException- if minEvaluations is not positive or is greater than maxEvaluations
-
RandomRangeEvaluationsStrategy
Creates a new RandomRangeEvaluationsStrategy with the specified range and random seed. This constructor is primarily for testing purposes.- Parameters:
minEvaluations- the minimum number of evaluations (inclusive)maxEvaluations- the maximum number of evaluations (inclusive)random- the random number generator to use- Throws:
NullPointerException- if random is nullIllegalArgumentException- if minEvaluations is not positive or is greater than maxEvaluations
-
-
Method Details
-
getEvaluations
public int getEvaluations(int problemIndex) Description copied from interface:EvaluationBudgetStrategyRetrieves the number of evaluations to be performed for a specific problem. The implementation should handle the logic for determining the evaluation count, which could be fixed, random, or based on some other criterion.- Specified by:
getEvaluationsin interfaceEvaluationBudgetStrategy- Parameters:
problemIndex- the zero-based index of the problem in the problem list- Returns:
- the number of evaluations to perform for the specified problem
-
validate
public void validate(int numberOfProblems) Description copied from interface:EvaluationBudgetStrategyValidates the configuration of the evaluation budget strategy against the number of problems. Implementations should throw anIllegalArgumentExceptionif the configuration is invalid for the given number of problems.- Specified by:
validatein interfaceEvaluationBudgetStrategy- Parameters:
numberOfProblems- the total number of problems to be evaluated
-
getMinEvaluations
public int getMinEvaluations()Returns the minimum number of evaluations.- Returns:
- the minimum evaluations
-
getMaxEvaluations
public int getMaxEvaluations()Returns the maximum number of evaluations.- Returns:
- the maximum evaluations
-