Class FutureSolution

java.lang.Object
org.moeaframework.core.Solution
org.moeaframework.util.distributed.FutureSolution
All Implemented Interfaces:
Serializable, Displayable, Formattable<Solution>

public class FutureSolution extends Solution
Represents a Solution evaluated asynchronously. Calls to will block until the asynchronous evaluation completes. This behavior is achieved by assigning a Future through the setFuture(Future) method prior to submitting this solution for evaluation.
See Also:
  • Method Details

    • getDistributedEvaluationID

      public long getDistributedEvaluationID()
      Returns the unique identifier for this solution. This can be used to:
      1. Configure the random number generator (RNG) seed on stochastic problems, allowing reproducible results.
      2. Tracking files or other resources associated with the solution, such as writing program inputs to disk.
      Returns:
      the unique identifier that was associated with this solution
    • copy

      public FutureSolution copy()
      Description copied from class: Solution
      Returns an independent copy of this solution. It is required that x.copy() is completely independent from x . This means any method invoked on x.copy() in no way alters the state of x and vice versa. It is typically the case that x.copy().getClass() == x.getClass() and x.copy().equals(x)

      Note that a solution's attributes are not copied, as the attributes are generally specific to each instance.

      Overrides:
      copy in class Solution
      Returns:
      an independent copy of this solution
    • getObjectives

      public double[] getObjectives()
      Description copied from class: Solution
      Returns an array containing the objectives of this solution. Modifying the returned array will not modify the internal state of this solution.
      Overrides:
      getObjectives in class Solution
      Returns:
      an array containing the objectives of this solution
    • getConstraints

      public double[] getConstraints()
      Description copied from class: Solution
      Returns an array containing the constraints of this solution. Modifying the returned array will not modify the internal state of this solution.
      Overrides:
      getConstraints in class Solution
      Returns:
      an array containing the constraints of this solution
    • getObjective

      public double getObjective(int index)
      Description copied from class: Solution
      Returns the objective at the specified index.
      Overrides:
      getObjective in class Solution
      Parameters:
      index - index of the objective to return
      Returns:
      the objective at the specified index
    • getConstraint

      public double getConstraint(int index)
      Description copied from class: Solution
      Returns the constraint at the specified index.
      Overrides:
      getConstraint in class Solution
      Parameters:
      index - index of the variable to be returned
      Returns:
      the constraint at the specified index
    • violatesConstraints

      public boolean violatesConstraints()
      Description copied from class: Solution
      Returns true if any of the constraints are violated; false otherwise.
      Overrides:
      violatesConstraints in class Solution
      Returns:
      true if any of the constraints are violated; false otherwise
    • getAttribute

      public Object getAttribute(String key)
      Description copied from class: Solution
      Returns the value of the attribute that is associated with the specified key, or null if no value has been associated with the key.
      Overrides:
      getAttribute in class Solution
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the value associated with the specified key, or null if no value has been associated with the key
    • hasAttribute

      public boolean hasAttribute(String key)
      Description copied from class: Solution
      Returns true if the specified key exists in this solution's attributes; false otherwise.
      Overrides:
      hasAttribute in class Solution
      Parameters:
      key - the key whose presence is being tested
      Returns:
      true if the specified key exists in this solution's attributes; false otherwise
    • getAttributes

      public Map<String,Serializable> getAttributes()
      Description copied from class: Solution
      Returns the Map containing this solution's attributes.
      Overrides:
      getAttributes in class Solution
      Returns:
      the Map containing this solution's attributes