Class ParameterDriver

  • Direct Known Subclasses:
    ParameterDriversList.DelegatingDriver

    public class ParameterDriver
    extends Object
    Class allowing to drive the value of a parameter.

    This class is typically used as a bridge between an estimation algorithm (typically orbit determination or optimizer) and an internal parameter in a physical model that needs to be tuned, or a bridge between a finite differences algorithm and an internal parameter in a physical model that needs to be slightly offset. The physical model will expose to the algorithm a set of instances of this class so the algorithm can call the setValue(double) method to update the parameter value. Each time the value is set, the physical model will be notified as it will register a ParameterObserver for this purpose.

    This design has two major goals. First, it allows an external algorithm to drive internal parameters almost anonymously, as it only needs to get a list of instances of this class, without knowing what they really drive. Second, it allows the physical model to not expose directly setters methods for its parameters. In order to be able to modify the parameter value, the algorithm must retrieve a parameter driver.

    Since:
    8.0
    Author:
    Luc Maisonobe
    See Also:
    ParameterObserver
    • Constructor Detail

      • ParameterDriver

        public ParameterDriver​(String name,
                               double referenceValue,
                               double scale,
                               double minValue,
                               double maxValue)
        Simple constructor.

        At construction, the parameter is configured as not selected, the reference date is set to null and the value is set to the referenceValue.

        Parameters:
        name - name of the parameter
        referenceValue - reference value of the parameter
        scale - scaling factor to convert the parameters value to non-dimensional (typically set to the expected standard deviation of the parameter), it must be non-zero
        minValue - minimum value
        maxValue - maximum value
    • Method Detail

      • addObserver

        public void addObserver​(ParameterObserver observer)
        Add an observer for this driver.

        The observer valueChanged method is called once automatically when the observer is added, and then called at each value change.

        Parameters:
        observer - observer to add while being updated
      • removeObserver

        public void removeObserver​(ParameterObserver observer)
        Remove an observer.
        Parameters:
        observer - observer to remove
        Since:
        9.1
      • getObservers

        public List<ParameterObserver> getObservers()
        Get the observers for this driver.
        Returns:
        an unmodifiable view of the observers for this driver
        Since:
        9.1
      • setName

        public void setName​(String name)
        Change the name of this parameter driver.
        Parameters:
        name - new name
      • getName

        public String getName()
        Get name.
        Returns:
        name
      • getReferenceValue

        public double getReferenceValue()
        Get reference parameter value.
        Returns:
        reference parameter value
      • setReferenceValue

        public void setReferenceValue​(double referenceValue)
        Set reference parameter value.
        Parameters:
        referenceValue - the reference value to set.
        Since:
        9.3
      • getMinValue

        public double getMinValue()
        Get minimum parameter value.
        Returns:
        minimum parameter value
      • setMinValue

        public void setMinValue​(double minValue)
        Set minimum parameter value.
        Parameters:
        minValue - the minimum value to set.
        Since:
        9.3
      • getMaxValue

        public double getMaxValue()
        Get maximum parameter value.
        Returns:
        maximum parameter value
      • setMaxValue

        public void setMaxValue​(double maxValue)
        Set maximum parameter value.
        Parameters:
        maxValue - the maximum value to set.
        Since:
        9.3
      • getScale

        public double getScale()
        Get scale.
        Returns:
        scale
      • setScale

        public void setScale​(double scale)
        Set scale.
        Parameters:
        scale - the scale to set.
        Since:
        9.3
      • getNormalizedValue

        public double getNormalizedValue()
        Get normalized value.

        The normalized value is a non-dimensional value suitable for use as part of a vector in an optimization process. It is computed as (current - reference)/scale.

        Returns:
        normalized value
      • setNormalizedValue

        public void setNormalizedValue​(double normalized)
        Set normalized value.

        The normalized value is a non-dimensional value suitable for use as part of a vector in an optimization process. It is computed as (current - reference)/scale.

        Parameters:
        normalized - value
      • getReferenceDate

        public AbsoluteDate getReferenceDate()
        Get current reference date.
        Returns:
        current reference date (null if it was never set)
        Since:
        9.0
      • setReferenceDate

        public void setReferenceDate​(AbsoluteDate newReferenceDate)
        Set reference date.
        Parameters:
        newReferenceDate - new reference date
        Since:
        9.0
      • getValue

        public double getValue()
        Get current parameter value.
        Returns:
        current parameter value
      • getValue

        public org.hipparchus.analysis.differentiation.DerivativeStructure getValue​(org.hipparchus.analysis.differentiation.DSFactory factory,
                                                                                    Map<String,​Integer> indices)
        Get the value as a derivative structure.
        Parameters:
        factory - factory for the derivatives
        indices - indices of the differentiation parameters in derivatives computations
        Returns:
        value with derivatives
        Since:
        9.3
      • setValue

        public void setValue​(double newValue)
        Set parameter value.

        If newValue is below getMinValue(), it will be silently set to getMinValue(). If newValue is above getMaxValue(), it will be silently set to getMaxValue().

        Parameters:
        newValue - new value
      • setSelected

        public void setSelected​(boolean selected)
        Configure a parameter selection status.

        Selection is used for estimated parameters in orbit determination, or to compute the Jacobian matrix in partial derivatives computation.

        Parameters:
        selected - if true the parameter is selected, otherwise it will be fixed
      • isSelected

        public boolean isSelected()
        Check if parameter is selected.

        Selection is used for estimated parameters in orbit determination, or to compute the Jacobian matrix in partial derivatives computation.

        Returns:
        true if parameter is selected, false if it is not
      • toString

        public String toString()
        Get a text representation of the parameter.
        Overrides:
        toString in class Object
        Returns:
        text representation of the parameter, in the form name = value.