Class ParameterDriver
- java.lang.Object
-
- org.orekit.utils.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 aParameterObserverfor 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 Summary
Constructors Constructor Description ParameterDriver(String name, double referenceValue, double scale, double minValue, double maxValue)Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(ParameterObserver observer)Add an observer for this driver.doublegetMaxValue()Get maximum parameter value.doublegetMinValue()Get minimum parameter value.StringgetName()Get name.doublegetNormalizedValue()Get normalized value.List<ParameterObserver>getObservers()Get the observers for this driver.AbsoluteDategetReferenceDate()Get current reference date.doublegetReferenceValue()Get reference parameter value.doublegetScale()Get scale.doublegetValue()Get current parameter value.org.hipparchus.analysis.differentiation.DerivativeStructuregetValue(org.hipparchus.analysis.differentiation.DSFactory factory, Map<String,Integer> indices)Get the value as a derivative structure.booleanisSelected()Check if parameter is selected.voidremoveObserver(ParameterObserver observer)Remove an observer.voidsetMaxValue(double maxValue)Set maximum parameter value.voidsetMinValue(double minValue)Set minimum parameter value.voidsetName(String name)Change the name of this parameter driver.voidsetNormalizedValue(double normalized)Set normalized value.voidsetReferenceDate(AbsoluteDate newReferenceDate)Set reference date.voidsetReferenceValue(double referenceValue)Set reference parameter value.voidsetScale(double scale)Set scale.voidsetSelected(boolean selected)Configure a parameter selection status.voidsetValue(double newValue)Set parameter value.StringtoString()Get a text representation of the parameter.
-
-
-
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
nulland the value is set to thereferenceValue.- Parameters:
name- name of the parameterreferenceValue- reference value of the parameterscale- scaling factor to convert the parameters value to non-dimensional (typically set to the expected standard deviation of the parameter), it must be non-zerominValue- minimum valuemaxValue- maximum value
-
-
Method Detail
-
addObserver
public void addObserver(ParameterObserver observer)
Add an observer for this driver.The observer
valueChangedmethod 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 derivativesindices- 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
newValueis belowgetMinValue(), it will be silently set togetMinValue(). IfnewValueis abovegetMaxValue(), it will be silently set togetMaxValue().- 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
-
-