ReFRACtor
|
The state for a parametrized mathematical model (a vector function) and its Jacobian. More...
#include <model_state.h>
Public Member Functions | |
ModelState () | |
Default constructor. More... | |
ModelState (const ModelState &s) | |
Copy constructor. More... | |
virtual | ~ModelState () |
virtual void | assert_parameter_correct (const blitz::Array< double, 1 > &x) const |
Checks that the new input parameters are correct. More... | |
virtual void | assert_parameter_set_correctly () const |
Checks that the parameters are set correctly. More... | |
virtual void | clear () |
Deletes data contents. More... | |
virtual int | expected_parameter_size () const |
Returns the expected size of the parameters. More... | |
virtual int | parameter_size () const |
Returns the size of the parameters. More... | |
virtual void | parameters (const blitz::Array< double, 1 > &x) |
Sets the problem at a new point in the parameter space. More... | |
virtual blitz::Array< double, 1 > | parameters () const |
Returns the current parameters. More... | |
virtual bool | parameters_different (const blitz::Array< double, 1 > &x) const |
Checks whether or not new input parameters are different from the current ones. More... | |
virtual void | print (std::ostream &Os) const |
Prints description of object. More... | |
std::string | print_to_string () const |
Print to string. More... | |
virtual void | set (const ModelState &s) |
Makes self a copy of the input state. More... | |
virtual void | set (const ProblemState &s) |
Makes self a copy of the input state. More... | |
Protected Attributes | |
blitz::Array< double, 2 > | K |
blitz::Array< double, 1 > | M |
blitz::Array< double, 1 > | X |
The state for a parametrized mathematical model (a vector function) and its Jacobian.
This class is used as a state for a mathematical model and not an optimization problem.
Given NLLSProblemState class it appears thath ModelState is redundant. After all, both classes just are designed to maintain a vector function and its Jacobian. Then why do we have two similar classes that are only different in their names or the names of some of their members?
A parametrized mathematical model is not an optimization problem by itself; however, it is a component of an optimization problem when we try to fit the model to measured data.
When a parametrized mathematical model appears in an optimization problem in the form of a Nonlinear Least Squares problem, the vector model function and its Jacobian are not the same as the vector residual function of the NLLS problem and its Jacobian. They are different, and they are very different when we use some statistical analysis method to fit the model to the measured data. In my judgment, emphasizing the differences and avoiding confusion are more important than redundancy in this case; therefore, I implemented ModelState as well as NLLSProblemState.
Definition at line 36 of file model_state.h.
|
inline |
Default constructor.
Definition at line 46 of file model_state.h.
|
inline |
|
inlinevirtual |
Definition at line 60 of file model_state.h.
|
virtualinherited |
Checks that the new input parameters are correct.
This method checks to see whether or not the new input parameters are correct. If the parameters are not correct then it throws an exception.
Definition at line 44 of file problem_state.cc.
|
inlinevirtualinherited |
Checks that the parameters are set correctly.
This method checks to see whether or not the parameters are set correctly. If the parameters are not set correctly then it throws an exception.
Definition at line 197 of file problem_state.h.
|
inlinevirtual |
Deletes data contents.
This method deletes state. If needed, it must be reimplemented by other classes derived from this class to delete other saved components associated with the state as well.
Reimplemented from FullPhysics::ProblemState.
Definition at line 84 of file model_state.h.
|
inlinevirtualinherited |
Returns the expected size of the parameters.
This method must be reimplemented by the problem class the inherits ProblemState. It is only in the context of an optimization problem that one knows what the size of the parameters (number of the dimensions of the parameter space) is.
This method is intentionally implemented here instead of being left as a pure virtual method. The intention is that the user to be able to create an object of this class or its derived classes for the purpose of preserving an older state of a problem if needed.
Reimplemented in FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, FullPhysics::NLLSProblemScaled, FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, FullPhysics::ModelMeasureMeyer, FullPhysics::FmNLLSProblem, FullPhysics::BardNLLSProblem, FullPhysics::BrownNLLSProblem, FullPhysics::FreudensteinRothNLLSProblem, FullPhysics::HelicalValleyNLLSProblem, FullPhysics::JennrichSampsonNLLSProblem, FullPhysics::MeyerNLLSProblem, FullPhysics::PowellNLLSProblem, FullPhysics::PowellSingularNLLSProblem, and FullPhysics::Rosenbrock2NLLSProblem.
Definition at line 185 of file problem_state.h.
|
inlinevirtualinherited |
Returns the size of the parameters.
Definition at line 163 of file problem_state.h.
|
virtualinherited |
Sets the problem at a new point in the parameter space.
The method calls parameters_different() to determine whether or not the new parameters are different:
[in] | x | New set of parameters |
Reimplemented in FullPhysics::NLLSProblemScaled, FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, and FullPhysics::ModelMeasureStandard.
Definition at line 36 of file problem_state.cc.
|
inlinevirtualinherited |
Returns the current parameters.
Reimplemented in FullPhysics::NLLSProblemScaled, FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, and FullPhysics::ModelMeasureStandard.
Definition at line 153 of file problem_state.h.
|
virtualinherited |
Checks whether or not new input parameters are different from the current ones.
The methods checks to see whether or not the new input parameters (point in the parameter space) are different from the parameters maintained by the object for which the method is called.
If the size of the input parameters is not equal to the expected size of the parameters (check comments on expected_parameter_size), then the method will throw an exception.
If the object for which the method is called has currently no parameters set, then the method returns true. Otherwise, the method uses some algorithm to figure out when the difference is "big enough" to be considered different. If the method determines that the new input parameters are different from the current parameters, then it returns true, otherwise, it returns false.
[in] | x | New set of parameters |
Definition at line 9 of file problem_state.cc.
|
inlinevirtual |
Prints description of object.
Reimplemented from FullPhysics::ProblemState.
Reimplemented in FullPhysics::ModelMeasure, FullPhysics::MaxAPosteriori, FullPhysics::ModelMeasureStandard, FullPhysics::MaxLikelihood, FullPhysics::MaxAPosterioriStandard, FullPhysics::ModelMeasureBard, FullPhysics::ModelMeasureMeyer, FullPhysics::BardMLProblem, and FullPhysics::MeyerMLProblem.
Definition at line 92 of file model_state.h.
|
inlineinherited |
Print to string.
This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.
Definition at line 31 of file printable.h.
|
virtual |
Makes self a copy of the input state.
This method makes the object, for which it is called, a copy of the input state.
[in] | s | another ModelState |
Definition at line 7 of file model_state.cc.
|
inlinevirtualinherited |
Makes self a copy of the input state.
This method makes the object, for which it is called, a copy of the input state.
[in] | s | another ProblemState |
Definition at line 88 of file problem_state.h.
|
protected |
Definition at line 99 of file model_state.h.
|
protected |
Definition at line 98 of file model_state.h.
|
protectedinherited |
Definition at line 222 of file problem_state.h.