Package org.moeaframework.problem
Class ProblemWrapper
java.lang.Object
org.moeaframework.problem.ProblemWrapper
- All Implemented Interfaces:
AutoCloseable
,Problem
- Direct Known Subclasses:
DistributedProblem
,RotatedProblem
,ScaledProblem
,ScriptedProblem
,TimingProblem
Wraps a problem instance to modify or extend its functionality.
All methods invoke the corresponding method on the inner problem. Subclasses need only override the methods they need to change.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
ProblemWrapper
(Problem problem) Constructs a new problem wrapper to modify or extend the functionality of the given problem. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes any underlying resources used by this problem.void
Evaluates the solution, updating the solution's objectives in place.getName()
Returns the user-friendly name for this problem.int
Returns the number of constraints defined by this problem.int
Returns the number of objectives defined by this problem.int
Returns the number of decision variables defined by this problem.Returns a new solution for this problem.
-
Field Details
-
problem
The original problem instance.
-
-
Constructor Details
-
ProblemWrapper
Constructs a new problem wrapper to modify or extend the functionality of the given problem.- Parameters:
problem
- the problem being modified or extended
-
-
Method Details
-
getName
Description copied from interface:Problem
Returns the user-friendly name for this problem. -
getNumberOfVariables
public int getNumberOfVariables()Description copied from interface:Problem
Returns the number of decision variables defined by this problem.- Specified by:
getNumberOfVariables
in interfaceProblem
- Returns:
- the number of decision variables defined by this problem
-
getNumberOfObjectives
public int getNumberOfObjectives()Description copied from interface:Problem
Returns the number of objectives defined by this problem.- Specified by:
getNumberOfObjectives
in interfaceProblem
- Returns:
- the number of objectives defined by this problem
-
getNumberOfConstraints
public int getNumberOfConstraints()Description copied from interface:Problem
Returns the number of constraints defined by this problem.- Specified by:
getNumberOfConstraints
in interfaceProblem
- Returns:
- the number of constraints defined by this problem
-
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. -
newSolution
Description copied from interface:Problem
Returns a new solution for this problem. Implementations must initialize the variables so that the valid range of values is defined, but typically leave the actual value at a default or undefined state.- Specified by:
newSolution
in interfaceProblem
- Returns:
- a new solution for this problem
-
close
public void close()Description copied from interface:Problem
Closes any underlying resources used by this problem. Once closed, further invocations of any methods on this problem may throw exceptions.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceProblem
-