Package org.moeaframework.problem
Interface Problem
- All Superinterfaces:
AutoCloseable,Named
- All Known Subinterfaces:
AnalyticalProblem
- All Known Implementing Classes:
AbstractProblem,Ackley,AttractiveSector,BBOBFunction,BBOBTransformation,Beale,Belegundu,Binh,Binh2,Binh3,Binh4,C1_DTLZ1,C1_DTLZ3,C2_DTLZ2,C3_DTLZ1,C3_DTLZ4,CF1,CF10,CF2,CF3,CF4,CF5,CF6,CF7,CF8,CF9,ConvexC2_DTLZ2,ConvexDTLZ2,DifferentPowers,DistributedProblem,DTLZ,DTLZ1,DTLZ2,DTLZ3,DTLZ4,DTLZ5,DTLZ6,DTLZ7,Ellipsoid,ExternalProblem,Fonseca,Fonseca2,Gallagher,Griewank,Himmelblau,InvertedDTLZ1,Jimenez,Kita,Kursawe,Laumanns,Lis,LSMOP,LSMOP1,LSMOP2,LSMOP3,LSMOP4,LSMOP5,LSMOP6,LSMOP7,LSMOP8,LSMOP9,LZ,LZ1,LZ2,LZ3,LZ4,LZ5,LZ6,LZ7,LZ8,LZ9,MaF1,MaF10,MaF11,MaF12,MaF13,MaF14,MaF15,MaF2,MaF3,MaF4,MaF5,MaF6,MaF7,MaF8,MaF9,Murata,Obayashi,OKA1,OKA2,Osyczka,Osyczka2,Poloni,ProblemStub,ProblemWrapper,Quagliarella,Rastrigin,Rastrigin,Rendon,Rendon2,Rosenbrock,Rosenbrock,RotatedProblem,ScaledProblem,Schaffer,Schaffer2,Schaffers,Schwefel,Schwefel,SharpRidge,Sphere,Sphere,Srinivas,StackedProblem,Tamaki,Tanaka,TransformObjectiveOscillate,TransformObjectivePenalize,TransformObjectivePower,TransformObjectiveShift,TransformVariablesAffine,TransformVariablesAsymmetric,TransformVariablesBrs,TransformVariablesConditioning,TransformVariablesOscillate,TransformVariablesScale,TransformVariablesShift,TransformVariablesXHat,TransformVariablesZHat,UF1,UF10,UF11,UF12,UF13,UF2,UF3,UF4,UF5,UF6,UF7,UF8,UF9,Viennet,Viennet2,Viennet3,Viennet4,WFG,WFG1,WFG2,WFG3,WFG4,WFG5,WFG6,WFG7,WFG8,WFG9,Zakharov,ZCAT,ZCAT1,ZCAT10,ZCAT11,ZCAT12,ZCAT13,ZCAT14,ZCAT15,ZCAT16,ZCAT17,ZCAT18,ZCAT19,ZCAT2,ZCAT20,ZCAT3,ZCAT4,ZCAT5,ZCAT6,ZCAT7,ZCAT8,ZCAT9,ZDT,ZDT1,ZDT2,ZDT3,ZDT4,ZDT5,ZDT6
Interface for defining optimization problems. All methods must be thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes any underlying resources used by this problem.voidEvaluates the solution, updating the solution's objectives in place.default StringgetName()Returns the name of this problem.intReturns the number of constraints defined by this problem.intReturns the number of objectives defined by this problem.intReturns the number of decision variables defined by this problem.default booleanReturnstrueif all decision variables used by this solution are the given type.Returns a new solution for this problem.
-
Method Details
-
getName
Returns the name of this problem. Whenever possible, this name should match the name recognized byProblemFactory. -
getNumberOfVariables
int getNumberOfVariables()Returns the number of decision variables defined by this problem.- Returns:
- the number of decision variables defined by this problem
-
getNumberOfObjectives
int getNumberOfObjectives()Returns the number of objectives defined by this problem.- Returns:
- the number of objectives defined by this problem
-
getNumberOfConstraints
int getNumberOfConstraints()Returns the number of constraints defined by this problem.- Returns:
- the number of constraints defined by this problem
-
evaluate
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.- Parameters:
solution- the solution to be evaluated
-
newSolution
Solution newSolution()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.- Returns:
- a new solution for this problem
-
close
void close()Closes any underlying resources used by this problem. Once closed, further invocations of any methods on this problem may throw exceptions.While most problems do not use any disposable resources and this method can simply no-op, the best practice is wrapping the constructed problem instance inside a try-with-resources block so it is automatically closed. Java may flag offending code with a warning. Implementations that do require closing should indicate this in any documentation.
- Specified by:
closein interfaceAutoCloseable
-
isType
Returnstrueif all decision variables used by this solution are the given type. This also considers if the given types are compatible. For example,BinaryIntegerVariableis compatible withBinaryVariable.- Parameters:
type- the type of decision variable- Returns:
trueif all decision variables are the given type;falseotherwise.
-