Class Variable

java.lang.Object
xal.extension.solver.Variable

public class Variable extends Object
Variable describes a parameter that may be varied by the solver. It specifies a name, an initial guess and upper and lower limits.
Author:
ky6, t6p
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
    the initial value/guess assigned to the variable
    protected double
    the lowest value that can be assigned to the variable
    protected final String
    the name of the variable
    protected double
    the highest value that can be assigned to the variable
  • Constructor Summary

    Constructors
    Constructor
    Description
    Variable(String name, double initialValue, double lowerLimit, double upperLimit)
    Creates a new instance of Variable.
  • Method Summary

    Modifier and Type
    Method
    Description
    copyWithInitialValue(double initialValue)
    Copy this variable but substitute the specified initial value for this variable's initial value.
    double
    Get the initial value (i.e. initial guess).
    double
    Get the lowest value that can be assigned to this variable.
    Get this variable's name.
    double
    Get the highest value that can be assigned to this variable.
    void
    setInitialValue(double initialValue)
     
    void
    setLowerLimit(double lowerLimit)
     
    void
    setUpperLimit(double upperLimit)
     
    A string for displaying a variable.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • name

      protected final String name
      the name of the variable
    • initialValue

      protected double initialValue
      the initial value/guess assigned to the variable
    • lowerLimit

      protected double lowerLimit
      the lowest value that can be assigned to the variable
    • upperLimit

      protected double upperLimit
      the highest value that can be assigned to the variable
  • Constructor Details

    • Variable

      public Variable(String name, double initialValue, double lowerLimit, double upperLimit)
      Creates a new instance of Variable.
      Parameters:
      initialValue - the initial first guess for the variable (e.g. starting point)
      name - the name to assign to the variable
      lowerLimit - the lowest value that should be assigned to the variable
      upperLimit - the highest value that should be assigned to the variable
  • Method Details

    • copyWithInitialValue

      public Variable copyWithInitialValue(double initialValue)
      Copy this variable but substitute the specified initial value for this variable's initial value.
      Parameters:
      initialValue - initial value to use for the new variable
      Returns:
      new variable with the same properties as this instance but substituting the specified initial value
    • getName

      public String getName()
      Get this variable's name.
      Returns:
      this variable's name
    • getInitialValue

      public double getInitialValue()
      Get the initial value (i.e. initial guess).
      Returns:
      the initial value
    • getLowerLimit

      public double getLowerLimit()
      Get the lowest value that can be assigned to this variable.
      Returns:
      the lower limit
    • getUpperLimit

      public double getUpperLimit()
      Get the highest value that can be assigned to this variable.
      Returns:
      the upper limit
    • setInitialValue

      public void setInitialValue(double initialValue)
    • setLowerLimit

      public void setLowerLimit(double lowerLimit)
    • setUpperLimit

      public void setUpperLimit(double upperLimit)
    • toString

      public String toString()
      A string for displaying a variable. The string consist of a title, an initial value, a lower limit and an upper limit.
      Overrides:
      toString in class Object
      Returns:
      The string representation of a variable.