Thyra::ModelEvaluator.
More...
#include <MoochoPack_MoochoThyraSolver.hpp>
Inheritance diagram for MoochoPack::MoochoThyraSolver:
Public types | |
| enum | ESolveMode { SOLVE_MODE_FORWARD, SOLVE_MODE_OPTIMIZE } |
| More... | |
Constructors/initialization. | |
| MoochoThyraSolver (const std::string ¶msXmlFileName="", const std::string &extraParamsXmlString="", const std::string ¶msUsedXmlOutFileName="", const std::string ¶msXmlFileNameOption="moocho-thyra-params-file", const std::string &extraParamsXmlStringOption="extra-moocho-thyra-params", const std::string ¶msUsedXmlOutFileNameOption="moocho-thyra-params-used-file") | |
| Construct with default settings. | |
| ~MoochoThyraSolver () | |
| | |
| STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsXmlFileName) | |
| The name an XML file that will be read to get XML parameters (if not ""). | |
| STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extraParamsXmlString) | |
| An XML string that will be used to update the parameters (if not ""). | |
| STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsUsedXmlOutFileName) | |
| The name of an XML file that will be written (if not "") for the parameters actually used. | |
| STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsXmlFileNameOption) | |
The name of the option that will be added the the commandline processor that will set paramsXmlFileName() . | |
| STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extraParamsXmlStringOption) | |
The name of the option that will be added the the commandline processor that will set extraParamsXmlString() . | |
| STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsUsedXmlOutFileNameOption) | |
The name of the option that will be added the the commandline processor that will set paramsUsedXmlOutFileName() . | |
| STANDARD_NONCONST_COMPOSITION_MEMBERS (Thyra::MultiVectorFileIOBase< value_type >, stateVectorIO) | |
| MultiVectorFileIOBase object used to read and write state vectors to and from files. | |
| STANDARD_NONCONST_COMPOSITION_MEMBERS (Thyra::MultiVectorFileIOBase< value_type >, parameterVectorIO) | |
| MultiVectorFileIOBase object used to read and write parameter vectors to and from files. | |
| void | setupCLP (Teuchos::CommandLineProcessor *clp) |
| Sets up the commandline for reading in the parameter list for this object (minus the options for MoochoSolver). | |
| void | readParameters (std::ostream *out) |
| Force the parameters to be read from a file or from the commandline arguments. | |
Overridden from ParameterListAcceptor | |
| void | setParameterList (RCP< Teuchos::ParameterList > const ¶mList) |
| | |
| RCP< Teuchos::ParameterList > | getNonconstParameterList () |
| | |
| RCP< Teuchos::ParameterList > | unsetParameterList () |
| | |
| RCP< const Teuchos::ParameterList > | getParameterList () const |
| | |
| RCP< const Teuchos::ParameterList > | getValidParameters () const |
| | |
Misc Access/Setup | |
| void | setSolveMode (const ESolveMode solveMode) |
| | |
| ESolveMode | getSolveMode () const |
| | |
| MoochoSolver & | getSolver () |
| | |
| const MoochoSolver & | getSolver () const |
| | |
Model specification, setup, solve, and solution extraction. | |
| void | setModel (const RCP< Thyra::ModelEvaluator< value_type > > &origModel, const int p_idx=0, const int g_idx=0) |
| | |
| const RCP< Thyra::ModelEvaluator< value_type > > | getOrigModel () const |
| | |
| const RCP< Thyra::ModelEvaluator< value_type > > | getOuterModel () const |
| | |
| void | readInitialGuess (std::ostream *out=NULL) |
| | |
| void | setInitialGuess (const RCP< const Thyra::ModelEvaluatorBase::InArgs< value_type > > &initialGuess) |
| | |
| void | setInitialGuess (const Thyra::ModelEvaluatorBase::InArgs< value_type > &initialGuess) |
| | |
| MoochoSolver::ESolutionStatus | solve () |
| | |
| const Thyra::ModelEvaluatorBase::InArgs< value_type > & | getFinalPoint () const |
| Return the final point. | |
| void | writeFinalSolution (std::ostream *out=NULL) const |
| Write the final solution to a file specified by the parameter list option ???. | |
| void | writeParamsFile (const std::string &outputXmlFileName="") const |
| Write the parameters list for a this object to a file after the parameters are read in order to show defaults and create a new list for input the next time. | |
Thyra::ModelEvaluator.
The parameters this class accepts are shown below in different format:
Human readable format (with documentation) for valid parameters accepted by this class
Forward Newton Max Iters : int = 20
# Maximum number of iterations allows for the forward state
# solver in eliminating the state equations/variables.
Forward Newton Tolerance : double = -1
# Tolarance used for the forward state solver in eliminating
# the state equations/variables.
NLP Type : string = First Order
# The type of MOOCHO NLP subclass to use.
# Valid string values:
# {
# "First Order"
# Support the NLPInterfacePack::NLPFirstOrder interface which assumes
# that full adjoints for the objective and constraint derivatives are
# available.
# "Direct"
# Support the NLPInterfacePack::NLPDirect interface which only assumes
# that forward or direct sensitivities and state solves are supported.
# }
Nonlinearly Eliminate States : bool = 0
# If true, then the model's state equations and state variables
# are nonlinearlly eliminated using a forward solver.
Parameters Solution File Base Name : string =
# If specified, a file with this basename will be written to with
# the final value of the parameters. A different file for each
# process will be created. Note that these files can be used for the
# initial guess for the parameters.
Show Model Evaluator Trace : bool = 1
# Determine if a trace of the objective function will be shown or not
# when the NLP is evaluated.
Solve Mode : string = Optimize
# The type of solve to perform.
# Valid string values:
# {
# "Forward Solve"
# Only solve state equaitons f(x,p)=0 for states x
# given fixed parameters values p.
# "Optimize"
# Solve the simulation constrained optimization problem
# min g(x,p)
# s.t. f(x,p)=0
# for the state varaibles x and parameters p.
# }
State Solution File Base Name : string =
# If specified, a file with this basename will be written to with
# the final value of the state variables. A different file for each
# process will be created. Note that these files can be used for the
# initial guess for the state variables.
Use Built-in Inverse Objective Function : bool = 0
# Use a built-in form of a simple inverse objection function instead
# of a a response function contained in the underlying model evaluator
# object itself. The settings are contained in the sublist
# "Inverse Objective Function Settings".
# Note that this feature allows the client to form a useful type
# of optimization problem just with a model that supports only the
# parameterized state function f(x,p)=0.
Use Finite Differences For Constraints : bool = 0
# Use finite differences for missing constraint derivatives (Direct NLP only).
# See the options in the sublist "Constraints Finite Difference Settings".
Use Finite Differences For Objective : bool = 0
# Use finite differences for missing objective function derivatives (Direct NLP only).
# See the options in the sublist "Objective Finite Difference Settings".
Constraints Finite Difference Settings ->
FD Method : string = order-one
# The method used to compute the finite differences.
# Valid string values:
# {
# "order-one"
# Use O(eps) one sided finite differences (cramped bounds)
# "order-two"
# Use O(eps^2) one sided finite differences (cramped bounds)
# "order-two-central"
# Use O(eps^2) two sided central finite differences
# "order-two-auto"
# Use "order-two-central" when not cramped by bounds, otherwise use "order-two"
# "order-four"
# Use O(eps^4) one sided finite differences (cramped bounds)
# "order-four-central"
# Use O(eps^4) two sided central finite differences
# "order-four-auto"
# Use "order-four-central" when not cramped by bounds, otherwise use "order-four"
# }
FD Step Length : double = -1
# The length of the finite difference step to take.
# A value of < 0.0 means that the step length will be determined automatically.
FD Step Select Type : string = Absolute
# Method used to select the finite difference step length.
# Valid string values:
# {
# "Absolute"
# Use absolute step size "FD Step Length"
# "Relative"
# Use relative step size "FD Step Length"*||xo||inf
# }
Inverse Objective Function Settings ->
# Settings for the built-in inverse objective function.
# See the outer parameter "Use Built-in Inverse Objective Function".
Observation Index : int = -1
# The index of the observation function, obs_idx.
# If obs_idx < 0, then the observation will be the state vector x.
# If obs_idx >= 0, then the observation will be the response function g(obs_idx).
Observation Multiplier : double = 1
# observationMultiplier
Parameter Multiplier : double = 1e-06
# parameterMultiplier
Parameter Subvector Index : int = 0
# The index of the parameter subvector that will be used in the
# regularization term.
Observation Target Vector ->
Explicit Array : string = {}
# The vector specified explicitly as a string interpreted as a Teuchos::Array
# object. If this array is set, it will override the vector specified
# by the above "File Name Base" parameter.
# Note that a VectorSpaceBase object
# must be set internally for this to work.
File Name Base : string =
# Base-name of file(s) that will be used to read in the vector.
# If this parameter is empty "", no file(s) will be read.
# Note that a MultiVectorFileIOBase object and a VectorSpaceBase object
# must be set internally for this to work.
Scale By : double = 1
# A factor by which the read in vector will be scaled by.
Parameter Base Vector ->
Explicit Array : string = {}
# The vector specified explicitly as a string interpreted as a Teuchos::Array
# object. If this array is set, it will override the vector specified
# by the above "File Name Base" parameter.
# Note that a VectorSpaceBase object
# must be set internally for this to work.
File Name Base : string =
# Base-name of file(s) that will be used to read in the vector.
# If this parameter is empty "", no file(s) will be read.
# Note that a MultiVectorFileIOBase object and a VectorSpaceBase object
# must be set internally for this to work.
Scale By : double = 1
# A factor by which the read in vector will be scaled by.
Objective Finite Difference Settings ->
FD Method : string = order-one
# The method used to compute the finite differences.
# Valid string values:
# {
# "order-one"
# Use O(eps) one sided finite differences (cramped bounds)
# "order-two"
# Use O(eps^2) one sided finite differences (cramped bounds)
# "order-two-central"
# Use O(eps^2) two sided central finite differences
# "order-two-auto"
# Use "order-two-central" when not cramped by bounds, otherwise use "order-two"
# "order-four"
# Use O(eps^4) one sided finite differences (cramped bounds)
# "order-four-central"
# Use O(eps^4) two sided central finite differences
# "order-four-auto"
# Use "order-four-central" when not cramped by bounds, otherwise use "order-four"
# }
FD Step Length : double = -1
# The length of the finite difference step to take.
# A value of < 0.0 means that the step length will be determined automatically.
FD Step Select Type : string = Absolute
# Method used to select the finite difference step length.
# Valid string values:
# {
# "Absolute"
# Use absolute step size "FD Step Length"
# "Relative"
# Use relative step size "FD Step Length"*||xo||inf
# }
Parameter Guess ->
Explicit Array : string = {}
# The vector specified explicitly as a string interpreted as a Teuchos::Array
# object. If this array is set, it will override the vector specified
# by the above "File Name Base" parameter.
# Note that a VectorSpaceBase object
# must be set internally for this to work.
File Name Base : string =
# Base-name of file(s) that will be used to read in the vector.
# If this parameter is empty "", no file(s) will be read.
# Note that a MultiVectorFileIOBase object and a VectorSpaceBase object
# must be set internally for this to work.
Scale By : double = 1
# A factor by which the read in vector will be scaled by.
State Guess ->
Explicit Array : string = {}
# The vector specified explicitly as a string interpreted as a Teuchos::Array
# object. If this array is set, it will override the vector specified
# by the above "File Name Base" parameter.
# Note that a VectorSpaceBase object
# must be set internally for this to work.
File Name Base : string =
# Base-name of file(s) that will be used to read in the vector.
# If this parameter is empty "", no file(s) will be read.
# Note that a MultiVectorFileIOBase object and a VectorSpaceBase object
# must be set internally for this to work.
Scale By : double = 1
# A factor by which the read in vector will be scaled by.
Human readable format (without documentation) for valid parameters accepted by this class
Forward Newton Max Iters : int = 20
Forward Newton Tolerance : double = -1
NLP Type : string = First Order
Nonlinearly Eliminate States : bool = 0
Parameters Solution File Base Name : string =
Show Model Evaluator Trace : bool = 1
Solve Mode : string = Optimize
State Solution File Base Name : string =
Use Built-in Inverse Objective Function : bool = 0
Use Finite Differences For Constraints : bool = 0
Use Finite Differences For Objective : bool = 0
Constraints Finite Difference Settings ->
FD Method : string = order-one
FD Step Length : double = -1
FD Step Select Type : string = Absolute
Inverse Objective Function Settings ->
Observation Index : int = -1
Observation Multiplier : double = 1
Parameter Multiplier : double = 1e-06
Parameter Subvector Index : int = 0
Observation Target Vector ->
Explicit Array : string = {}
File Name Base : string =
Scale By : double = 1
Parameter Base Vector ->
Explicit Array : string = {}
File Name Base : string =
Scale By : double = 1
Objective Finite Difference Settings ->
FD Method : string = order-one
FD Step Length : double = -1
FD Step Select Type : string = Absolute
Parameter Guess ->
Explicit Array : string = {}
File Name Base : string =
Scale By : double = 1
State Guess ->
Explicit Array : string = {}
File Name Base : string =
Scale By : double = 1
XML format for valid parameters accepted by this class
Teuchos::GlobalMPISession::GlobalMPISession(): started serial run
<ParameterList>
<ParameterList name="Constraints Finite Difference Settings">
<Parameter name="FD Method" type="string" value="order-one"/>
<Parameter name="FD Step Length" type="double" value="-1"/>
<Parameter name="FD Step Select Type" type="string" value="Absolute"/>
</ParameterList>
<Parameter name="Forward Newton Max Iters" type="int" value="20"/>
<Parameter name="Forward Newton Tolerance" type="double" value="-1"/>
<ParameterList name="Inverse Objective Function Settings">
<Parameter name="Observation Index" type="int" value="-1"/>
<Parameter name="Observation Multiplier" type="double" value="1"/>
<ParameterList name="Observation Target Vector">
<Parameter name="Explicit Array" type="string" value="{}"/>
<Parameter name="File Name Base" type="string" value=""/>
<Parameter name="Scale By" type="double" value="1"/>
</ParameterList>
<ParameterList name="Parameter Base Vector">
<Parameter name="Explicit Array" type="string" value="{}"/>
<Parameter name="File Name Base" type="string" value=""/>
<Parameter name="Scale By" type="double" value="1"/>
</ParameterList>
<Parameter name="Parameter Multiplier" type="double" value="1e-06"/>
<Parameter name="Parameter Subvector Index" type="int" value="0"/>
</ParameterList>
<Parameter name="NLP Type" type="string" value="First Order"/>
<Parameter name="Nonlinearly Eliminate States" type="bool" value="0"/>
<ParameterList name="Objective Finite Difference Settings">
<Parameter name="FD Method" type="string" value="order-one"/>
<Parameter name="FD Step Length" type="double" value="-1"/>
<Parameter name="FD Step Select Type" type="string" value="Absolute"/>
</ParameterList>
<ParameterList name="Parameter Guess">
<Parameter name="Explicit Array" type="string" value="{}"/>
<Parameter name="File Name Base" type="string" value=""/>
<Parameter name="Scale By" type="double" value="1"/>
</ParameterList>
<Parameter name="Parameters Solution File Base Name" type="string" value=""/>
<Parameter name="Show Model Evaluator Trace" type="bool" value="1"/>
<Parameter name="Solve Mode" type="string" value="Optimize"/>
<ParameterList name="State Guess">
<Parameter name="Explicit Array" type="string" value="{}"/>
<Parameter name="File Name Base" type="string" value=""/>
<Parameter name="Scale By" type="double" value="1"/>
</ParameterList>
<Parameter name="State Solution File Base Name" type="string" value=""/>
<Parameter name="Use Built-in Inverse Objective Function" type="bool" value="0"/>
<Parameter name="Use Finite Differences For Constraints" type="bool" value="0"/>
<Parameter name="Use Finite Differences For Objective" type="bool" value="0"/>
</ParameterList>
ToDo: Finish documetation!
|
|
|
|
||||||||||||||||||||||||||||
|
Construct with default settings.
Warning! Do not change the defaults by passing then into this constructor. Instead, use the member functions to set them after |
|
|
|
|
||||||||||||
|
The name an XML file that will be read to get XML parameters (if not "").
|
|
||||||||||||
|
An XML string that will be used to update the parameters (if not "").
|
|
||||||||||||
|
The name of an XML file that will be written (if not "") for the parameters actually used.
|
|
||||||||||||
|
The name of the option that will be added the the commandline processor that will set
|
|
||||||||||||
|
The name of the option that will be added the the commandline processor that will set
|
|
||||||||||||
|
The name of the option that will be added the the commandline processor that will set
|
|
||||||||||||
|
MultiVectorFileIOBase object used to read and write state vectors to and from files.
The default implementation used is |
|
||||||||||||
|
MultiVectorFileIOBase object used to read and write parameter vectors to and from files.
The default implementation used is ToDo: You may need to change this to set different the MultiVectorFileIOBase objects for each parameter subvector for each index l=0...Np-1! |
|
|
Sets up the commandline for reading in the parameter list for this object (minus the options for MoochoSolver).
The commandline arguments |
|
|
Force the parameters to be read from a file or from the commandline arguments. If no parameter XML file name or parameters XML string was specified on the commandline, then this function will exist immediately and do nothing. If an XML file name or XML parameter list string was specified on the commandline.
If Postconditions:
|
|
|
|
|
|
Implements Teuchos::ParameterListAcceptor. |
|
|
Implements Teuchos::ParameterListAcceptor. |
|
|
Reimplemented from Teuchos::ParameterListAcceptor. |
|
|
Reimplemented from Teuchos::ParameterListAcceptor. |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return the final point.
|
|
|
Write the final solution to a file specified by the parameter list option ???.
|
|
|
Write the parameters list for a this object to a file after the parameters are read in order to show defaults and create a new list for input the next time.
If |
1.3.9.1