Class Problem

java.lang.Object
xal.extension.solver.Problem

public class Problem extends Object
Problem is the primary class for holding the user's problem information.
Author:
ky6, t6p
  • Field Details

    • objectives

      protected List<Objective> objectives
      The objectives we are trying to optimize.
    • variables

      protected final List<Variable> variables
      The variables which identify the controls for optimizing the solution.
    • constraints

      protected List<Constraint> constraints
      Constraints which identify unacceptable solutions.
    • hints

      protected Map<String,Hint> hints
      A table of hints the algorithms may use to adjust their search.
    • evaluator

      protected Evaluator evaluator
      The user provided object which evaluates the trial solutions.
    • valueRefs

      protected Map<Variable,ValueRef> valueRefs
      A table of reference values keyed by variable
  • Constructor Details

    • Problem

      public Problem(List<Objective> objectives, List<Variable> variables, Evaluator evaluator, List<Constraint> constraints, List<Hint> hints)
      Construct a problem using an objective list, variable list, constraint list, hint list, and an evaluator.
    • Problem

      public Problem(List<Objective> objectives, List<Variable> variables, Evaluator evaluator)
      Construct a problem using an objective list, variable list, and an evaluator.
    • Problem

      public Problem()
      Construct a problem where everything is null.
  • Method Details

    • addObjective

      public void addObjective(Objective anObjective)
      Adds an Objective to objectiveList.
      Parameters:
      anObjective - The objective of the problem.
    • setObjectives

      public void setObjectives(List<? extends Objective> objectives)
      Set the objectives.
      Parameters:
      objectives - The new objectives value
    • getObjectives

      public List<Objective> getObjectives()
      Get the list of objectives.
      Returns:
      objectiveList.
    • addVariable

      public void addVariable(Variable variable)
      Adds a Variable object to variableList.
      Parameters:
      variable - The feature to be added to the Variable attribute
    • setVariables

      public void setVariables(List<Variable> variables)
      Set the variables.
      Parameters:
      variables - The new variables value
    • getValueReference

      public ValueRef getValueReference(Variable variable)
      Get the value reference which is mapped to a variable.
      Parameters:
      variable - Description of the Parameter
      Returns:
      A double representing the value.
    • getVariables

      public final List<Variable> getVariables()
      Get the list of variables.
      Returns:
      The list of variables.
    • addConstraint

      public void addConstraint(Constraint aConstraint)
      Add a Constraint object to constraintList.
      Parameters:
      aConstraint - One constraint of the problem.
    • setConstraints

      public void setConstraints(List<Constraint> constraints)
      Set the constraints.
      Parameters:
      constraints - The new constraints value
    • getConstraints

      public List<Constraint> getConstraints()
      Get the list of constraints.
      Returns:
      constraintList The list of constraints.
    • addHint

      public void addHint(Hint aHint)
      Add a Hint object to the hintList.
      Parameters:
      aHint - One hint for the problem.
    • addHints

      public void addHints(List<Hint> hints)
      Add to this problem, the list of hints.
      Parameters:
      hints - the list of hints to add to this problem.
    • setHints

      public void setHints(List<Hint> hints)
      Set this problem's hints to the ones specified.
      Parameters:
      hints - The new hints to set for this problem.
    • getHint

      public Hint getHint(String type)
      Get the hint corresponding to the specified type.
      Parameters:
      type - the type identifier for which to fetch a hint.
      Returns:
      The hint corresponding to the specified type.
    • setEvaluator

      public void setEvaluator(Evaluator anEvaluator)
      Set the evaluator to use in scoring the trial points. The evaluator defines the problem we are trying to optimize.
      Parameters:
      anEvaluator - The new evaluator value
    • getEvaluator

      public Evaluator getEvaluator()
      Get the evaluator.
      Returns:
      The evaluator.
    • generateInitialTrialPoint

      public TrialPoint generateInitialTrialPoint()
      Generate a new trial point based on the initial values of the variables.
      Returns:
      a new trial point
    • validate

      protected TrialVeto validate(Trial trial)
      Validate the trial.
      Parameters:
      trial - The trial to be validated.
      Returns:
      A trial veto if any of the constraints vetoes the trial or null if there is no veto.
    • evaluateInitialPoint

      public Trial evaluateInitialPoint()
      Evaluate the initial point as specified by the initial values of the variables
      Returns:
      the evaluated trial
    • evaluate

      public boolean evaluate(Trial trial)
      Evaluate the trial
      Parameters:
      trial - the trial to evaluate
      Returns:
      true if the evaluation was successful and false if it was vetoed