Package org.moeaframework.problem
Class TimingProblem
java.lang.Object
org.moeaframework.problem.ProblemWrapper
org.moeaframework.problem.TimingProblem
- All Implemented Interfaces:
AutoCloseable
,Problem
Wraps a problem to collect objective function evaluation timing data. Precision and accuracy of the timing data
is dependent on
System.nanoTime()
.-
Field Summary
Fields inherited from class org.moeaframework.problem.ProblemWrapper
problem
-
Constructor Summary
ConstructorDescriptionTimingProblem
(Problem problem) Decorates the specified problem to collecting objective function evaluation timing data. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears any timing data collected.void
Evaluates the solution, updating the solution's objectives in place.long
Returns the time, in nanoseconds, expended on objective function evaluation.int
getNFE()
Returns the number of times the objective function was evaluated.double
Returns the time, in seconds, expended on objective function evaluation.Methods inherited from class org.moeaframework.problem.ProblemWrapper
close, getName, getNumberOfConstraints, getNumberOfObjectives, getNumberOfVariables, newSolution
-
Constructor Details
-
TimingProblem
Decorates the specified problem to collecting objective function evaluation timing data.- Parameters:
problem
- the problem to decorate
-
-
Method Details
-
evaluate
Description copied from interface:Problem
Evaluates the solution, updating the solution's objectives in place. Algorithms must explicitly call this method when appropriate to evaluate new solutions or reevaluate modified solutions.- Specified by:
evaluate
in interfaceProblem
- Overrides:
evaluate
in classProblemWrapper
- Parameters:
solution
- the solution to be evaluated
-
clear
public void clear()Clears any timing data collected. -
getNanoseconds
public long getNanoseconds()Returns the time, in nanoseconds, expended on objective function evaluation.- Returns:
- the time, in nanoseconds, expended on objective function evaluation
-
getSeconds
public double getSeconds()Returns the time, in seconds, expended on objective function evaluation.- Returns:
- the time, in seconds, expended on objective function evaluation
-
getNFE
public int getNFE()Returns the number of times the objective function was evaluated.- Returns:
- the number of times the objective function was evaluated
-