MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Private Types | Private Attributes | List of all members
MoochoPack::MoochoThyraSolver Class Reference

MOOCHO NLP Solver class for models represented through Thyra::ModelEvaluator. More...

#include <MoochoPack_MoochoThyraSolver.hpp>

Inheritance diagram for MoochoPack::MoochoThyraSolver:
Inheritance graph
[legend]

Public Types

enum  ENLPType { NLP_TYPE_FIRST_ORDER, NLP_TYPE_DIRECT }
 

Private Types

typedef value_type Scalar
 

Private Attributes

MoochoSolver solver_
 
RCP< Thyra::ModelEvaluator
< value_type > > 
origModel_
 
int p_idx_
 
int g_idx_
 
Thyra::ParameterDrivenMultiVectorInput
< value_type > 
x_reader_
 
Thyra::ParameterDrivenMultiVectorInput
< value_type > 
p_reader_
 
Thyra::ParameterDrivenMultiVectorInput
< value_type > 
p_l_reader_
 
Thyra::ParameterDrivenMultiVectorInput
< value_type > 
p_u_reader_
 
RCP< Teuchos::ParameterListparamList_
 
RCP
< Thyra::DefaultNominalBoundsOverrideModelEvaluator
< value_type > > 
nominalModel_
 
RCP
< Thyra::DefaultFinalPointCaptureModelEvaluator
< value_type > > 
finalPointModel_
 
RCP< Thyra::ModelEvaluator
< value_type > > 
outerModel_
 
ESolveMode solveMode_
 
ENLPType nlpType_
 
bool nonlinearlyElimiateStates_
 
bool use_finite_diff_for_obj_
 
bool use_finite_diff_for_con_
 
double fwd_newton_tol_
 
int fwd_newton_max_iters_
 
bool fwd_newton_dampening_
 
int fwd_newton_max_ls_iters_
 
bool useInvObjFunc_
 
bool useParameterLumping_
 
std::string outputFileTag_
 
bool showModelEvaluatorTrace_
 
std::string stateSoluFileBase_
 
std::string paramSoluFileBase_
 

Public types

enum  ESolveMode { SOLVE_MODE_FORWARD, SOLVE_MODE_OPTIMIZE }
 

Constructors/initialization.

 MoochoThyraSolver (const std::string &paramsXmlFileName="", const std::string &extraParamsXmlString="", const std::string &paramsUsedXmlOutFileName="", const std::string &paramsXmlFileNameOption="moocho-thyra-params-file", const std::string &extraParamsXmlStringOption="extra-moocho-thyra-params", const std::string &paramsUsedXmlOutFileNameOption="moocho-thyra-params-used-file")
 Construct with default settings. More...
 
 ~MoochoThyraSolver ()
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsXmlFileName)
 The name an XML file that will be read to get XML parameters (if not ""). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extraParamsXmlString)
 An XML string that will be used to update the parameters (if not ""). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsUsedXmlOutFileName)
 The name of an XML file that will be written (if not "") for the parameters actually used. More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsXmlFileNameOption)
 The name of the option that will be added the the commandline processor that will set paramsXmlFileName() . More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extraParamsXmlStringOption)
 The name of the option that will be added the the commandline processor that will set extraParamsXmlString() . More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, paramsUsedXmlOutFileNameOption)
 The name of the option that will be added the the commandline processor that will set paramsUsedXmlOutFileName() . More...
 
 STANDARD_NONCONST_COMPOSITION_MEMBERS (Thyra::MultiVectorFileIOBase< value_type >, stateVectorIO)
 MultiVectorFileIOBase object used to read and write state vectors to and from files. More...
 
 STANDARD_NONCONST_COMPOSITION_MEMBERS (Thyra::MultiVectorFileIOBase< value_type >, parameterVectorIO)
 MultiVectorFileIOBase object used to read and write parameter vectors to and from files. More...
 
void setupCLP (Teuchos::CommandLineProcessor *clp)
 Sets up the commandline for reading in the parameter list for this object (minus the options for MoochoSolver). More...
 
void readParameters (std::ostream *out)
 Force the parameters to be read from a file or from the commandline arguments. More...
 

Overridden from ParameterListAcceptor

void setParameterList (RCP< Teuchos::ParameterList > const &paramList)
 
RCP< Teuchos::ParameterListgetNonconstParameterList ()
 
RCP< Teuchos::ParameterListunsetParameterList ()
 
RCP< const Teuchos::ParameterListgetParameterList () const
 
RCP< const Teuchos::ParameterListgetValidParameters () const
 

Misc Access/Setup

void setSolveMode (const ESolveMode solveMode)
 
ESolveMode getSolveMode () const
 
MoochoSolvergetSolver ()
 
const MoochoSolvergetSolver () 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. More...
 
void writeFinalSolution (std::ostream *out=NULL) const
 Write the final solution to a file specified by the parameter list option ???. More...
 
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. More...
 

Additional Inherited Members

Detailed Description

MOOCHO NLP Solver class for models represented through 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

Human readable format (without documentation) for valid parameters accepted by this class

XML format for valid parameters accepted by this class

ToDo: Finish documetation!

Definition at line 83 of file MoochoPack_MoochoThyraSolver.hpp.

Member Typedef Documentation

typedef value_type MoochoPack::MoochoThyraSolver::Scalar
private

Definition at line 317 of file MoochoPack_MoochoThyraSolver.hpp.

Member Enumeration Documentation

Enumerator
SOLVE_MODE_FORWARD 

Do a forward solve for the states only.

SOLVE_MODE_OPTIMIZE 

Solve an optimization problem for states and parameters.

Definition at line 92 of file MoochoPack_MoochoThyraSolver.hpp.

Enumerator
NLP_TYPE_FIRST_ORDER 
NLP_TYPE_DIRECT 

Definition at line 313 of file MoochoPack_MoochoThyraSolver.hpp.

Constructor & Destructor Documentation

MoochoPack::MoochoThyraSolver::MoochoThyraSolver ( const std::string &  paramsXmlFileName = "",
const std::string &  extraParamsXmlString = "",
const std::string &  paramsUsedXmlOutFileName = "",
const std::string &  paramsXmlFileNameOption = "moocho-thyra-params-file",
const std::string &  extraParamsXmlStringOption = "extra-moocho-thyra-params",
const std::string &  paramsUsedXmlOutFileNameOption = "moocho-thyra-params-used-file" 
)

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 *this is constructed. This will help to avoid problems with updates to the ordering of the arguments.

Definition at line 184 of file MoochoPack_MoochoThyraSolver.cpp.

MoochoPack::MoochoThyraSolver::~MoochoThyraSolver ( )

Definition at line 217 of file MoochoPack_MoochoThyraSolver.cpp.

Member Function Documentation

MoochoPack::MoochoThyraSolver::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsXmlFileName   
)

The name an XML file that will be read to get XML parameters (if not "").

MoochoPack::MoochoThyraSolver::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extraParamsXmlString   
)

An XML string that will be used to update the parameters (if not "").

MoochoPack::MoochoThyraSolver::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsUsedXmlOutFileName   
)

The name of an XML file that will be written (if not "") for the parameters actually used.

MoochoPack::MoochoThyraSolver::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsXmlFileNameOption   
)

The name of the option that will be added the the commandline processor that will set paramsXmlFileName() .

MoochoPack::MoochoThyraSolver::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extraParamsXmlStringOption   
)

The name of the option that will be added the the commandline processor that will set extraParamsXmlString() .

MoochoPack::MoochoThyraSolver::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
paramsUsedXmlOutFileNameOption   
)

The name of the option that will be added the the commandline processor that will set paramsUsedXmlOutFileName() .

MoochoPack::MoochoThyraSolver::STANDARD_NONCONST_COMPOSITION_MEMBERS ( Thyra::MultiVectorFileIOBase< value_type >  ,
stateVectorIO   
)

MultiVectorFileIOBase object used to read and write state vectors to and from files.

The default implementation used is Thyra::DefaultSpmdMultiVectorFileIO. See Thyra::DefaultSpmdMultiVectorFileIO::DefaultSpmdMultiVectorFileIO() for the default conditions of such an object.

MoochoPack::MoochoThyraSolver::STANDARD_NONCONST_COMPOSITION_MEMBERS ( Thyra::MultiVectorFileIOBase< value_type >  ,
parameterVectorIO   
)

MultiVectorFileIOBase object used to read and write parameter vectors to and from files.

The default implementation used is Thyra::DefaultSpmdMultiVectorFileIO. See Thyra::DefaultSpmdMultiVectorFileIO::DefaultSpmdMultiVectorFileIO() for the default conditions.

ToDo: You may need to change this to set different the MultiVectorFileIOBase objects for each parameter subvector for each index l=0...Np-1!

void MoochoPack::MoochoThyraSolver::setupCLP ( Teuchos::CommandLineProcessor clp)

Sets up the commandline for reading in the parameter list for this object (minus the options for MoochoSolver).

The commandline arguments –moocho-thyra-params-file and –moocho-thyra-extra-params will be added to *clp that will allow the parameters to be read from a file or from the commandline itself in XML format.

Definition at line 220 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::readParameters ( std::ostream *  out)

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 this->getParameterList().get()==0 before this function is called then

Postconditions:

  • If the parameters were read from a file or a commandline argument string then this->getParameterList() will be non-NULL and will contain the updated parameters.

Definition at line 240 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::setParameterList ( RCP< Teuchos::ParameterList > const &  paramList)
virtual

Implements Teuchos::ParameterListAcceptor.

Definition at line 276 of file MoochoPack_MoochoThyraSolver.cpp.

Teuchos::RCP< Teuchos::ParameterList > MoochoPack::MoochoThyraSolver::getNonconstParameterList ( )
virtual

Implements Teuchos::ParameterListAcceptor.

Definition at line 338 of file MoochoPack_MoochoThyraSolver.cpp.

Teuchos::RCP< Teuchos::ParameterList > MoochoPack::MoochoThyraSolver::unsetParameterList ( )
virtual

Implements Teuchos::ParameterListAcceptor.

Definition at line 344 of file MoochoPack_MoochoThyraSolver.cpp.

Teuchos::RCP< const Teuchos::ParameterList > MoochoPack::MoochoThyraSolver::getParameterList ( ) const
virtual

Reimplemented from Teuchos::ParameterListAcceptor.

Definition at line 352 of file MoochoPack_MoochoThyraSolver.cpp.

Teuchos::RCP< const Teuchos::ParameterList > MoochoPack::MoochoThyraSolver::getValidParameters ( ) const
virtual

Reimplemented from Teuchos::ParameterListAcceptor.

Definition at line 358 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::setSolveMode ( const ESolveMode  solveMode)

Definition at line 503 of file MoochoPack_MoochoThyraSolver.cpp.

MoochoThyraSolver::ESolveMode MoochoPack::MoochoThyraSolver::getSolveMode ( ) const

Definition at line 509 of file MoochoPack_MoochoThyraSolver.cpp.

MoochoSolver & MoochoPack::MoochoThyraSolver::getSolver ( )

Definition at line 514 of file MoochoPack_MoochoThyraSolver.cpp.

const MoochoSolver & MoochoPack::MoochoThyraSolver::getSolver ( ) const

Definition at line 519 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::setModel ( const RCP< Thyra::ModelEvaluator< value_type > > &  origModel,
const int  p_idx = 0,
const int  g_idx = 0 
)

Definition at line 526 of file MoochoPack_MoochoThyraSolver.cpp.

const Teuchos::RCP< Thyra::ModelEvaluator< value_type > > MoochoPack::MoochoThyraSolver::getOrigModel ( ) const

Definition at line 713 of file MoochoPack_MoochoThyraSolver.cpp.

const Teuchos::RCP< Thyra::ModelEvaluator< value_type > > MoochoPack::MoochoThyraSolver::getOuterModel ( ) const

Definition at line 719 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::readInitialGuess ( std::ostream *  out = NULL)

Definition at line 724 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::setInitialGuess ( const RCP< const Thyra::ModelEvaluatorBase::InArgs< value_type > > &  initialGuess)

Definition at line 790 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::setInitialGuess ( const Thyra::ModelEvaluatorBase::InArgs< value_type > &  initialGuess)

Definition at line 797 of file MoochoPack_MoochoThyraSolver.cpp.

MoochoSolver::ESolutionStatus MoochoPack::MoochoThyraSolver::solve ( )

Definition at line 806 of file MoochoPack_MoochoThyraSolver.cpp.

const Thyra::ModelEvaluatorBase::InArgs< value_type > & MoochoPack::MoochoThyraSolver::getFinalPoint ( ) const

Return the final point.

Definition at line 834 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::writeFinalSolution ( std::ostream *  out = NULL) const

Write the final solution to a file specified by the parameter list option ???.

Definition at line 839 of file MoochoPack_MoochoThyraSolver.cpp.

void MoochoPack::MoochoThyraSolver::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.

If outputXmlFileName!="" then the parameter list with be written to the file outputXmlFileName in XML format. If outputXmlFileName=="", but this->paramsUsedXmlOutFileNameOption()!="" then the parameter list will be written to the file this->paramsUsedXmlOutFileNameOption(). If both outputXmlFileName=="" and this->paramsUsedXmlOutFileNameOption()=="" then no file is written.

Definition at line 867 of file MoochoPack_MoochoThyraSolver.cpp.

Member Data Documentation

MoochoSolver MoochoPack::MoochoThyraSolver::solver_
private

Definition at line 319 of file MoochoPack_MoochoThyraSolver.hpp.

RCP<Thyra::ModelEvaluator<value_type> > MoochoPack::MoochoThyraSolver::origModel_
private

Definition at line 321 of file MoochoPack_MoochoThyraSolver.hpp.

int MoochoPack::MoochoThyraSolver::p_idx_
private

Definition at line 322 of file MoochoPack_MoochoThyraSolver.hpp.

int MoochoPack::MoochoThyraSolver::g_idx_
private

Definition at line 323 of file MoochoPack_MoochoThyraSolver.hpp.

Thyra::ParameterDrivenMultiVectorInput<value_type> MoochoPack::MoochoThyraSolver::x_reader_
mutableprivate

Definition at line 325 of file MoochoPack_MoochoThyraSolver.hpp.

Thyra::ParameterDrivenMultiVectorInput<value_type> MoochoPack::MoochoThyraSolver::p_reader_
mutableprivate

Definition at line 326 of file MoochoPack_MoochoThyraSolver.hpp.

Thyra::ParameterDrivenMultiVectorInput<value_type> MoochoPack::MoochoThyraSolver::p_l_reader_
mutableprivate

Definition at line 327 of file MoochoPack_MoochoThyraSolver.hpp.

Thyra::ParameterDrivenMultiVectorInput<value_type> MoochoPack::MoochoThyraSolver::p_u_reader_
mutableprivate

Definition at line 328 of file MoochoPack_MoochoThyraSolver.hpp.

RCP<Teuchos::ParameterList> MoochoPack::MoochoThyraSolver::paramList_
private

Definition at line 330 of file MoochoPack_MoochoThyraSolver.hpp.

RCP<Thyra::DefaultNominalBoundsOverrideModelEvaluator<value_type> > MoochoPack::MoochoThyraSolver::nominalModel_
private

Definition at line 333 of file MoochoPack_MoochoThyraSolver.hpp.

RCP<Thyra::DefaultFinalPointCaptureModelEvaluator<value_type> > MoochoPack::MoochoThyraSolver::finalPointModel_
private

Definition at line 336 of file MoochoPack_MoochoThyraSolver.hpp.

RCP<Thyra::ModelEvaluator<value_type> > MoochoPack::MoochoThyraSolver::outerModel_
private

Definition at line 338 of file MoochoPack_MoochoThyraSolver.hpp.

ESolveMode MoochoPack::MoochoThyraSolver::solveMode_
private

Definition at line 340 of file MoochoPack_MoochoThyraSolver.hpp.

ENLPType MoochoPack::MoochoThyraSolver::nlpType_
private

Definition at line 341 of file MoochoPack_MoochoThyraSolver.hpp.

bool MoochoPack::MoochoThyraSolver::nonlinearlyElimiateStates_
private

Definition at line 342 of file MoochoPack_MoochoThyraSolver.hpp.

bool MoochoPack::MoochoThyraSolver::use_finite_diff_for_obj_
private

Definition at line 343 of file MoochoPack_MoochoThyraSolver.hpp.

bool MoochoPack::MoochoThyraSolver::use_finite_diff_for_con_
private

Definition at line 344 of file MoochoPack_MoochoThyraSolver.hpp.

double MoochoPack::MoochoThyraSolver::fwd_newton_tol_
private

Definition at line 345 of file MoochoPack_MoochoThyraSolver.hpp.

int MoochoPack::MoochoThyraSolver::fwd_newton_max_iters_
private

Definition at line 346 of file MoochoPack_MoochoThyraSolver.hpp.

bool MoochoPack::MoochoThyraSolver::fwd_newton_dampening_
private

Definition at line 347 of file MoochoPack_MoochoThyraSolver.hpp.

int MoochoPack::MoochoThyraSolver::fwd_newton_max_ls_iters_
private

Definition at line 348 of file MoochoPack_MoochoThyraSolver.hpp.

bool MoochoPack::MoochoThyraSolver::useInvObjFunc_
private

Definition at line 349 of file MoochoPack_MoochoThyraSolver.hpp.

bool MoochoPack::MoochoThyraSolver::useParameterLumping_
private

Definition at line 350 of file MoochoPack_MoochoThyraSolver.hpp.

std::string MoochoPack::MoochoThyraSolver::outputFileTag_
private

Definition at line 351 of file MoochoPack_MoochoThyraSolver.hpp.

bool MoochoPack::MoochoThyraSolver::showModelEvaluatorTrace_
private

Definition at line 352 of file MoochoPack_MoochoThyraSolver.hpp.

std::string MoochoPack::MoochoThyraSolver::stateSoluFileBase_
private

Definition at line 353 of file MoochoPack_MoochoThyraSolver.hpp.

std::string MoochoPack::MoochoThyraSolver::paramSoluFileBase_
private

Definition at line 354 of file MoochoPack_MoochoThyraSolver.hpp.


The documentation for this class was generated from the following files: