Class AbstractProblem

java.lang.Object
org.moeaframework.problem.AbstractProblem
All Implemented Interfaces:
AutoCloseable, Problem
Direct Known Subclasses:
Ackley, BBOBFunction, Beale, Belegundu, Binh, Binh2, Binh3, Binh4, CF1, CF10, CF2, CF3, CF4, CF5, CF6, CF7, CF8, CF9, DTLZ, Fonseca, Fonseca2, Griewank, Himmelblau, Jimenez, Kita, Kursawe, Laumanns, Lis, LZ, MaF13, MaF8, MaF9, Murata, Obayashi, OKA1, OKA2, Osyczka, Osyczka2, Poloni, ProblemStub, Quagliarella, Rastrigin, Rendon, Rendon2, Rosenbrock, Schaffer, Schaffer2, Schwefel, Sphere, Srinivas, StackedProblem, Tamaki, Tanaka, UF1, UF10, UF11, UF12, UF2, UF3, UF4, UF5, UF6, UF7, UF8, UF9, Viennet, Viennet2, Viennet3, Viennet4, WFG, Zakharov, ZCAT, ZDT

public abstract class AbstractProblem extends Object implements Problem
Abstract class for a Problem. For simplicity, most problems should extend AbstractProblem rather than implement the Problem interface directly. At a minimum, only the Problem.newSolution() and Problem.evaluate(org.moeaframework.core.Solution) methods need to be defined.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
    The number of constraints defined by this problem.
    protected final int
    The number of objectives defined by this problem.
    protected final int
    The number of variables defined by this problem.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractProblem(int numberOfVariables, int numberOfObjectives)
    Constructs an unconstrained abstract problem with the specified number of decision variables and objectives.
    AbstractProblem(int numberOfVariables, int numberOfObjectives, int numberOfConstraints)
    Constructs an abstract problem with the specified number of decision variables, objectives and constraints.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes any underlying resources used by this problem.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.moeaframework.core.Problem

    evaluate, isType, newSolution
  • Field Details

    • numberOfVariables

      protected final int numberOfVariables
      The number of variables defined by this problem.
    • numberOfObjectives

      protected final int numberOfObjectives
      The number of objectives defined by this problem.
    • numberOfConstraints

      protected final int numberOfConstraints
      The number of constraints defined by this problem.
  • Constructor Details

    • AbstractProblem

      public AbstractProblem(int numberOfVariables, int numberOfObjectives)
      Constructs an unconstrained abstract problem with the specified number of decision variables and objectives.
      Parameters:
      numberOfVariables - the number of decision variables
      numberOfObjectives - the number of objectives
    • AbstractProblem

      public AbstractProblem(int numberOfVariables, int numberOfObjectives, int numberOfConstraints)
      Constructs an abstract problem with the specified number of decision variables, objectives and constraints.
      Parameters:
      numberOfVariables - the number of decision variables
      numberOfObjectives - the number of objectives
      numberOfConstraints - the number of constraints
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Problem
      Returns the user-friendly name for this problem.
      Specified by:
      getName in 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 interface Problem
      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 interface Problem
      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 interface Problem
      Returns:
      the number of constraints defined by 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 interface AutoCloseable
      Specified by:
      close in interface Problem