42 #include "MoochoPack_MoochoThyraSolver.hpp"
43 #include "NLPInterfacePack_NLPDirectThyraModelEvaluator.hpp"
44 #include "NLPInterfacePack_NLPFirstOrderThyraModelEvaluator.hpp"
45 #include "Thyra_DefaultFiniteDifferenceModelEvaluator.hpp"
46 #include "Thyra_DefaultStateEliminationModelEvaluator.hpp"
47 #include "Thyra_DefaultEvaluationLoggerModelEvaluator.hpp"
48 #include "Thyra_DefaultInverseModelEvaluator.hpp"
49 #include "Thyra_DefaultLumpedParameterModelEvaluator.hpp"
50 #include "Thyra_DefaultSpmdMultiVectorFileIO.hpp"
51 #include "Thyra_DampenedNewtonNonlinearSolver.hpp"
52 #include "Thyra_ModelEvaluatorHelpers.hpp"
53 #include "Thyra_VectorStdOps.hpp"
54 #include "Teuchos_StandardParameterEntryValidators.hpp"
55 #include "Teuchos_XMLParameterListHelpers.hpp"
63 const std::string SolveMode_name =
"Solve Mode";
71 Teuchos::tuple<std::string>(
75 ,Teuchos::tuple<std::string>(
76 "Only solve state equaitons f(x,p)=0 for states x\n"
77 "given fixed parameters values p."
78 ,
"Solve the simulation constrained optimization problem\n"
81 "for the state varaibles x and parameters p."
83 ,Teuchos::tuple<MoochoPack::MoochoThyraSolver::ESolveMode>(
90 const std::string SolveMode_default =
"Optimize";
92 const std::string NLPType_name =
"NLP Type";
95 MoochoPack::MoochoThyraSolver::ENLPType
100 Teuchos::tuple<std::string>(
104 ,Teuchos::tuple<std::string>(
105 "Support the NLPInterfacePack::NLPFirstOrder interface which assumes\n"
106 "that full adjoints for the objective and constraint derivatives are\n"
108 ,
"Support the NLPInterfacePack::NLPDirect interface which only assumes\n"
109 "that forward or direct sensitivities and state solves are supported."
111 ,Teuchos::tuple<MoochoPack::MoochoThyraSolver::ENLPType>(
112 MoochoPack::MoochoThyraSolver::NLP_TYPE_FIRST_ORDER
113 ,MoochoPack::MoochoThyraSolver::NLP_TYPE_DIRECT
118 const std::string NLPType_default =
"First Order";
120 const std::string NonlinearlyEliminateStates_name =
"Nonlinearly Eliminate States";
121 const bool NonlinearlyEliminateStates_default =
false;
123 const std::string UseFiniteDifferencesForObjective_name =
"Use Finite Differences For Objective";
124 const bool UseFiniteDifferencesForObjective_default =
false;
126 const std::string ObjectiveFiniteDifferenceSettings_name =
"Objective Finite Difference Settings";
128 const std::string UseFiniteDifferencesForConstraints_name =
"Use Finite Differences For Constraints";
129 const bool UseFiniteDifferencesForConstraints_default =
false;
131 const std::string ConstraintsFiniteDifferenceSettings_name =
"Constraints Finite Difference Settings";
133 const std::string FwdNewtonTol_name =
"Forward Newton Tolerance";
134 const double FwdNewtonTol_default = -1.0;
136 const std::string FwdNewtonMaxIters_name =
"Forward Newton Max Iters";
137 const int FwdNewtonMaxIters_default = 20;
139 const std::string ForwardNewtonDampening_name =
"Forward Newton Dampening";
140 const bool ForwardNewtonDampening_default =
true;
142 const std::string FwdNewtonMaxLineSearchIters_name =
"Forward Newton Max Line Search Iters";
143 const int FwdNewtonMaxLineSearchIters_default = 20;
145 const std::string UseBuiltInInverseObjectiveFunction_name =
"Use Built-in Inverse Objective Function";
146 const bool UseBuiltInInverseObjectiveFunction_default =
false;
148 const std::string InverseObjectiveFunctionSettings_name =
"Inverse Objective Function Settings";
150 const std::string UseParameterLumping_name =
"Use Parameter Lumping";
151 const bool UseParameterLumping_default =
false;
153 const std::string LumpedParametersSettings_name =
"Lumped Parameters Settings";
155 const std::string OutputFileTag_name =
"Output File Tag";
156 const std::string OutputFileTag_default =
"";
158 const std::string OutputOnAllProcesses_name =
"Output On All Processes";
159 const bool OutputOnAllProcesses_default =
false;
161 const std::string ShowModelEvaluatorTrace_name =
"Show Model Evaluator Trace";
162 const bool ShowModelEvaluatorTrace_default =
"false";
164 const std::string StateGuess_name =
"State Guess";
166 const std::string ParamGuess_name =
"Parameter Guess";
168 const std::string ParamLowerBounds_name =
"Parameter Lower Bounds";
170 const std::string ParamUpperBounds_name =
"Parameter Upper Bounds";
172 const std::string StateSoluFileBaseName_name =
"State Solution File Base Name";
173 const std::string StateSoluFileBaseName_default =
"";
175 const std::string ParamSoluFileBaseName_name =
"Parameters Solution File Base Name";
176 const std::string ParamSoluFileBaseName_default =
"";
180 namespace MoochoPack {
185 const std::string ¶msXmlFileName
186 ,
const std::string &extraParamsXmlString
187 ,
const std::string ¶msUsedXmlOutFileName
188 ,
const std::string ¶msXmlFileNameOption
189 ,
const std::string &extraParamsXmlStringOption
190 ,
const std::string ¶msUsedXmlOutFileNameOption
192 :paramsXmlFileName_(paramsXmlFileName)
193 ,extraParamsXmlString_(extraParamsXmlString)
194 ,paramsUsedXmlOutFileName_(paramsUsedXmlOutFileName)
195 ,paramsXmlFileNameOption_(paramsXmlFileNameOption)
196 ,extraParamsXmlStringOption_(extraParamsXmlStringOption)
197 ,paramsUsedXmlOutFileNameOption_(paramsUsedXmlOutFileNameOption)
198 ,stateVectorIO_(Teuchos::
rcp(new Thyra::DefaultSpmdMultiVectorFileIO<value_type>))
199 ,parameterVectorIO_(Teuchos::
rcp(new Thyra::DefaultSpmdMultiVectorFileIO<value_type>))
200 ,solveMode_(SOLVE_MODE_OPTIMIZE)
201 ,nlpType_(NLP_TYPE_FIRST_ORDER)
202 ,nonlinearlyElimiateStates_(false)
203 ,use_finite_diff_for_obj_(false)
204 ,use_finite_diff_for_con_(false)
205 ,fwd_newton_tol_(-1.0)
206 ,fwd_newton_max_iters_(20)
207 ,fwd_newton_dampening_(false)
208 ,fwd_newton_max_ls_iters_(20)
209 ,useInvObjFunc_(false)
210 ,useParameterLumping_(false)
212 ,showModelEvaluatorTrace_(false)
213 ,stateSoluFileBase_(
"")
214 ,paramSoluFileBase_(
"")
227 paramsXmlFileNameOption().c_str(),¶msXmlFileName_
228 ,
"Name of an XML file containing parameters for linear solver options to be appended first."
231 extraParamsXmlStringOption().c_str(),&extraParamsXmlString_
232 ,
"An XML string containing linear solver parameters to be appended second."
235 paramsUsedXmlOutFileNameOption().c_str(),¶msUsedXmlOutFileName_
236 ,
"Name of an XML file that can be written with the parameter list after it has been used on completion of this program."
243 out = Teuchos::getFancyOStream(
Teuchos::rcp(out_arg,
false));
245 if(out.
get()) *out <<
"\nMoochoThyraSolver::readParameters(...):\n";
249 if(!paramList.
get()) {
250 if(out.
get()) *out <<
"\nCreating a new Teuchos::ParameterList ...\n";
253 if(paramsXmlFileName().length()) {
254 if(out.
get()) *out <<
"\nReading parameters from XML file \""<<paramsXmlFileName()<<
"\" ...\n";
255 Teuchos::updateParametersFromXmlFile(paramsXmlFileName(), paramList.
ptr());
257 if(extraParamsXmlString().length()) {
259 *out <<
"\nAppending extra parameters from the XML string \""<<extraParamsXmlString()<<
"\" ...\n";
260 Teuchos::updateParametersFromXmlString(extraParamsXmlString(), paramList.
ptr());
262 if( paramsXmlFileName().length() || extraParamsXmlString().length() ) {
265 *out <<
"\nUpdated parameter list:\n";
267 *out,PLPrintOptions().indent(2).showTypes(
true)
283 paramList_ = paramList;
284 solveMode_ = solveModeValidator->getIntegralValue(
285 *paramList_,SolveMode_name,SolveMode_default);
286 nlpType_ = nlpTypeValidator->getIntegralValue(
287 *paramList_,NLPType_name,NLPType_default);
288 nonlinearlyElimiateStates_ = paramList_->
get(
289 NonlinearlyEliminateStates_name,NonlinearlyEliminateStates_default);
290 use_finite_diff_for_obj_ = paramList_->
get(
291 UseFiniteDifferencesForObjective_name,UseFiniteDifferencesForObjective_default);
292 use_finite_diff_for_con_ = paramList_->
get(
293 UseFiniteDifferencesForConstraints_name,UseFiniteDifferencesForConstraints_default);
294 fwd_newton_tol_ = paramList_->
get(
295 FwdNewtonTol_name,FwdNewtonTol_default);
296 fwd_newton_max_iters_ = paramList_->
get(
297 FwdNewtonMaxIters_name,FwdNewtonMaxIters_default);
298 fwd_newton_dampening_ = paramList_->
get(
299 ForwardNewtonDampening_name,ForwardNewtonDampening_default);
300 fwd_newton_max_ls_iters_ = paramList_->
get(
301 FwdNewtonMaxLineSearchIters_name,FwdNewtonMaxLineSearchIters_default);
302 useInvObjFunc_ = paramList_->
get(
303 UseBuiltInInverseObjectiveFunction_name,UseBuiltInInverseObjectiveFunction_default);
304 useParameterLumping_ = paramList_->
get(
305 UseParameterLumping_name, UseParameterLumping_default);
306 outputFileTag_ = paramList->
get(
307 OutputFileTag_name,OutputFileTag_default);
310 paramList_->
get(OutputOnAllProcesses_name, OutputOnAllProcesses_default)
311 ? MS::OUTPUT_TO_BLACK_HOLE_FALSE
312 : MS::OUTPUT_TO_BLACK_HOLE_DEFAULT
314 showModelEvaluatorTrace_ = paramList->
get(
315 ShowModelEvaluatorTrace_name,ShowModelEvaluatorTrace_default);
317 sublist(paramList_,StateGuess_name)
320 sublist(paramList_,ParamGuess_name)
323 sublist(paramList_,ParamLowerBounds_name)
326 sublist(paramList_,ParamUpperBounds_name)
328 stateSoluFileBase_ = paramList_->
get(
329 StateSoluFileBaseName_name,StateSoluFileBaseName_default);
330 paramSoluFileBase_ = paramList_->
get(
331 ParamSoluFileBaseName_name,ParamSoluFileBaseName_default);
347 paramList_ = Teuchos::null;
364 SolveMode_name,SolveMode_default
365 ,
"The type of solve to perform."
369 NLPType_name,NLPType_default
370 ,
"The type of MOOCHO NLP subclass to use."
374 NonlinearlyEliminateStates_name,NonlinearlyEliminateStates_default
375 ,
"If true, then the model's state equations and state variables\n"
376 "are nonlinearlly eliminated using a forward solver."
379 UseFiniteDifferencesForObjective_name,UseFiniteDifferencesForObjective_default
380 ,
"Use finite differences for missing objective function derivatives (Direct NLP only).\n"
381 "See the options in the sublist \"" + ObjectiveFiniteDifferenceSettings_name +
"\"."
387 &fdSublist = pl->
sublist(ObjectiveFiniteDifferenceSettings_name);
391 UseFiniteDifferencesForConstraints_name,UseFiniteDifferencesForConstraints_default
392 ,
"Use finite differences for missing constraint derivatives (Direct NLP only).\n"
393 "See the options in the sublist \"" + ConstraintsFiniteDifferenceSettings_name +
"\"."
397 &fdSublist = pl->
sublist(ConstraintsFiniteDifferenceSettings_name);
402 FwdNewtonTol_name,FwdNewtonTol_default
403 ,
"Tolarance used for the forward state solver in eliminating\n"
404 "the state equations/variables."
407 FwdNewtonMaxIters_name,FwdNewtonMaxIters_default
408 ,
"Maximum number of iterations allowed for the forward state\n"
409 "solver in eliminating the state equations/variables."
412 ForwardNewtonDampening_name, ForwardNewtonDampening_default,
413 "If true, then the state elimination nonlinear solver will\n"
414 "use a dampened line search. Otherwise, it will just take fulls steps."
417 FwdNewtonMaxLineSearchIters_name, FwdNewtonMaxLineSearchIters_default,
418 "Maximum number of linea search iterations per newton iteration\n"
419 "allowed for the forward state solver in eliminating the state equations/variables."
422 UseBuiltInInverseObjectiveFunction_name,UseBuiltInInverseObjectiveFunction_default
423 ,
"Use a built-in form of a simple inverse objection function instead\n"
424 "of a a response function contained in the underlying model evaluator\n"
425 "object itself. The settings are contained in the sublist\n"
426 "\""+InverseObjectiveFunctionSettings_name+
"\".\n"
427 "Note that this feature allows the client to form a useful type\n"
428 "of optimization problem just with a model that supports only the\n"
429 "parameterized state function f(x,p)=0."
435 InverseObjectiveFunctionSettings_name,
false
436 ,
"Settings for the built-in inverse objective function.\n"
437 "See the outer parameter \""+UseBuiltInInverseObjectiveFunction_name+
"\"."
441 UseParameterLumping_name,UseParameterLumping_default,
442 "Use a reduced basis to lump optimization parameters as\n"
443 "p_orig = P_basis * p. If set to true, then the settings\n"
444 "in \""+LumpedParametersSettings_name+
"\" determine how the\n"
445 "parameter basis is set. This feature can be used to safely\n"
446 "regularize a problem if there are linearly dependent parameters\n"
447 "and will generally speed up the optimiztation algorithms."
453 LumpedParametersSettings_name,
false
454 ,
"Settings for parameter lumping.\n"
455 "See the outer parameter \""+UseParameterLumping_name+
"\"."
458 pl->
set(OutputFileTag_name,OutputFileTag_default,
459 "A tag that is attached to every output file that is created by the\n"
460 "solver. If empty \"\", then no tag is used. This option simply is\n"
461 "passed into the set_output_context(...) function on the underlying\n"
462 "MoochoPack::MoochoSolver object. Therefore, this same parameter\n"
463 "can be set in code as well without going through the parameter list.");
464 pl->
set(OutputOnAllProcesses_name, OutputOnAllProcesses_default,
465 "If set to true, then the console output and all MOOCHO files will be\n"
466 "written for every process. This helps in debugging very hard\n"
467 "parallel problems.");
468 pl->
set(ShowModelEvaluatorTrace_name,ShowModelEvaluatorTrace_default
469 ,
"Determine if a trace of the objective function will be shown or not\n"
470 "when the NLP is evaluated."
472 if(this->get_stateVectorIO().
get())
473 x_reader_.set_fileIO(this->get_stateVectorIO());
475 if(this->get_parameterVectorIO().get()) {
476 p_reader_.set_fileIO(this->get_parameterVectorIO());
477 p_l_reader_.set_fileIO(this->get_parameterVectorIO());
478 p_u_reader_.set_fileIO(this->get_parameterVectorIO());
484 StateSoluFileBaseName_name,StateSoluFileBaseName_default
485 ,
"If specified, a file with this basename will be written to with\n"
486 "the final value of the state variables. A different file for each\n"
487 "process will be created. Note that these files can be used for the\n"
488 "initial guess for the state variables."
491 ParamSoluFileBaseName_name,ParamSoluFileBaseName_default
492 ,
"If specified, a file with this basename will be written to with\n"
493 "the final value of the parameters. A different file for each\n"
494 "process will be created. Note that these files can be used for the\n"
495 "initial guess for the parameters."
505 solveMode_ = solveMode;
534 using Teuchos::sublist;
539 origModel_ = origModel;
550 outerModel_ = origModel_;
553 if (useInvObjFunc_) {
555 inverseModel = Thyra::defaultInverseModelEvaluator<Scalar>(outerModel_);
557 inverseModel->set_observationTargetIO(get_stateVectorIO());
558 inverseModel->set_parameterBaseIO(get_parameterVectorIO());
559 inverseModel->setParameterList(
560 Teuchos::sublist(paramList_,InverseObjectiveFunctionSettings_name) );
561 outerModel_ = inverseModel;
562 g_idx_ = inverseModel->Ng()-1;
567 modelEvalLogOut = Teuchos::fancyOStream(
574 outerModel_,modelEvalLogOut
577 outerModel_ = loggerThyraModel;
584 outerModel_ = nominalModel_;
591 outerModel_ = finalPointModel_;
594 if (useParameterLumping_) {
596 lumpedParamModel = Thyra::defaultLumpedParameterModelEvaluator<Scalar>(outerModel_);
598 lumpedParamModel->setParameterList(
599 sublist(paramList_,LumpedParametersSettings_name));
600 outerModel_ = lumpedParamModel;
616 new NLPFirstOrderThyraModelEvaluator(outerModel_,-1,-1)
618 nlpFirstOrder->showModelEvaluatorTrace(showModelEvaluatorTrace_);
625 if(use_finite_diff_for_obj_) {
628 objDirecFiniteDiffCalculator->setParameterList(
629 Teuchos::sublist(paramList_,ObjectiveFiniteDifferenceSettings_name)
633 if(use_finite_diff_for_con_) {
636 conDirecFiniteDiffCalculator->setParameterList(
637 Teuchos::sublist(paramList_,ConstraintsFiniteDifferenceSettings_name)
640 if( nonlinearlyElimiateStates_ ) {
645 stateSolver->defaultTol(fwd_newton_tol_);
646 stateSolver->defaultMaxNewtonIterations(fwd_newton_max_iters_);
647 stateSolver->useDampenedLineSearch(fwd_newton_dampening_);
648 stateSolver->maxLineSearchIterations(fwd_newton_max_ls_iters_);
653 finalReducedThyraModel;
654 if(use_finite_diff_for_obj_) {
657 fdReducedThyraModel = Thyra::defaultFiniteDifferenceModelEvaluator<Scalar>(
658 reducedThyraModel, objDirecFiniteDiffCalculator
660 finalReducedThyraModel = fdReducedThyraModel;
663 finalReducedThyraModel = reducedThyraModel;
668 new NLPFirstOrderThyraModelEvaluator(finalReducedThyraModel,p_idx_,g_idx_)
670 nlpFirstOrder->showModelEvaluatorTrace(showModelEvaluatorTrace_);
675 case NLP_TYPE_DIRECT: {
678 new NLPDirectThyraModelEvaluator(
679 outerModel_,p_idx_,g_idx_
680 ,objDirecFiniteDiffCalculator
681 ,conDirecFiniteDiffCalculator
684 nlpDirect->showModelEvaluatorTrace(showModelEvaluatorTrace_);
688 case NLP_TYPE_FIRST_ORDER: {
691 new NLPFirstOrderThyraModelEvaluator(outerModel_,p_idx_,g_idx_)
693 nlpFirstOrder->showModelEvaluatorTrace(showModelEvaluatorTrace_);
725 std::ostream *out_arg
734 out = Teuchos::getFancyOStream(
Teuchos::rcp(out_arg,
false));
736 initialGuess = clone(origModel_->getNominalValues()),
737 lowerBounds = clone(origModel_->getLowerBounds()),
738 upperBounds = clone(origModel_->getUpperBounds());
741 x_space = origModel_->get_x_space();
742 if( 0 != x_space.get() ) {
743 x_reader_.set_vecSpc(origModel_->get_x_space());
744 if(this->get_stateVectorIO().get())
745 x_reader_.set_fileIO(this->get_stateVectorIO());
750 x_reader_,
"initial guess for the state \'x\'",initialGuess->get_x()
754 if( origModel_->Np() > 0 ) {
755 p_reader_.set_vecSpc(origModel_->get_p_space(p_idx_));
756 p_l_reader_.set_vecSpc(p_reader_.get_vecSpc());
757 p_u_reader_.set_vecSpc(p_reader_.get_vecSpc());
758 if(this->get_parameterVectorIO().get()) {
759 p_reader_.set_fileIO(this->get_parameterVectorIO());
760 p_l_reader_.set_fileIO(p_reader_.get_fileIO());
761 p_u_reader_.set_fileIO(p_reader_.get_fileIO());
768 p_reader_,
"initial guess for the parameters \'p\'",
769 initialGuess->get_p(p_idx_)
775 p_l_reader_,
"lower bounds for the parameters \'p\'",lowerBounds->get_p(p_idx_)
781 p_u_reader_,
"upper bounds for the parameters \'p\'",upperBounds->get_p(p_idx_)
785 nominalModel_->setNominalValues(initialGuess);
786 nominalModel_->setLowerBounds(lowerBounds);
787 nominalModel_->setUpperBounds(upperBounds);
794 nominalModel_->setNominalValues(initialGuess);
801 nominalModel_->setNominalValues(
808 using Teuchos::RCP;
using Teuchos::null;
using Teuchos::describe;
810 std::ostringstream os;
812 <<
"\n**********************************"
813 <<
"\n*** MoochoThyraSolver::solve() ***"
814 <<
"\n**********************************\n";
816 x_space = outerModel_->get_x_space(),
818 ( p_idx_ >= 0 && outerModel_->Np() > 0 )
819 ? outerModel_->get_p_space(p_idx_)
829 outerModel_->setOStream(Teuchos::getFancyOStream(solver_.
get_journal_out()));
836 return finalPointModel_->getFinalPoint();
840 std::ostream *out_arg
845 out = Teuchos::getFancyOStream(
Teuchos::rcp(out_arg,
false));
846 if( stateSoluFileBase_ !=
"" && finalPointModel_->getFinalPoint().get_x().
get() ) {
848 *out <<
"\nWriting the state solution \'x\' to the file(s) with base name \""<<stateSoluFileBase_<<
"\" ...\n";
849 stateVectorIO().writeMultiVectorToFile(
850 *finalPointModel_->getFinalPoint().get_x(),stateSoluFileBase_
854 (
"" != paramSoluFileBase_ )
855 && ( origModel_->Np() > 0 )
856 && ( 0 != finalPointModel_->getFinalPoint().get_p(p_idx_).
get() )
860 *out <<
"\nWriting the parameter solution \'p\' to the file(s) with base name \""<<paramSoluFileBase_<<
"\" ...\n";
861 parameterVectorIO().writeMultiVectorToFile(
862 *finalPointModel_->getFinalPoint().get_p(p_idx_),paramSoluFileBase_
868 const std::string &outputXmlFileName
871 std::string xmlOutputFile
872 = ( outputXmlFileName.length() ? outputXmlFileName : paramsUsedXmlOutFileName() );
873 if( paramList_.
get() && xmlOutputFile.length() ) {
874 Teuchos::writeParameterListToXmlFile(*paramList_,xmlOutputFile);
const ostream_ptr_t & get_console_out() const
void setParameterList(RCP< Teuchos::ParameterList > const ¶mList)
void setup_commandline_processor(Teuchos::CommandLineProcessor *clp)
ESolveMode getSolveMode() const
bool is_null(const boost::shared_ptr< T > &p)
RCP< Teuchos::ParameterList > unsetParameterList()
const RCP< Thyra::ModelEvaluator< value_type > > getOrigModel() const
void readParameters(std::ostream *out)
Force the parameters to be read from a file or from the commandline arguments.
basic_OSTab< char > OSTab
void setupCLP(Teuchos::CommandLineProcessor *clp)
Sets up the commandline for reading in the parameter list for this object (minus the options for Mooc...
T & get(const std::string &name, T def_value)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
void set_output_context(const std::string &file_context_postfix, EOutputToBlackHole output_to_black_hole=OUTPUT_TO_BLACK_HOLE_DEFAULT, const int procRank=-1, const int numProcs=-1)
MoochoSolver & getSolver()
RCP< const Teuchos::ParameterList > getValidParameters() const
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.
void update_solver() const
const ostream_ptr_t & get_summary_out() const
MoochoSolver::ESolutionStatus solve()
const ostream_ptr_t & get_journal_out() const
RCP< const ParameterList > getValidParameters() const
const RCP< Thyra::ModelEvaluator< value_type > > getOuterModel() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
void writeFinalSolution(std::ostream *out=NULL) const
Write the final solution to a file specified by the parameter list option ???.
RCP< Teuchos::ParameterList > getNonconstParameterList()
Implement the NLPFirstOrder interface using a Thyra::ModelEvaluator object.
void setSolveMode(const ESolveMode solveMode)
Implement the NLPFirstOrder interface using a Thyra::ModelEvaluator object.
RCP< std::ostream > generate_output_file(const std::string &fileNameBase) const
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
ParameterList & setParameters(const ParameterList &source)
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 ...
Solve an optimization problem for states and parameters.
void setModel(const RCP< Thyra::ModelEvaluator< value_type > > &origModel, const int p_idx=0, const int g_idx=0)
const Thyra::ModelEvaluatorBase::InArgs< value_type > & getFinalPoint() const
Return the final point.
ESolutionStatus solve_nlp() const
void readInitialGuess(std::ostream *out=NULL)
RCP< const Teuchos::ParameterList > getParameterList() const
void set_nlp(const nlp_ptr_t &nlp)
void set_output_file_tag(const std::string &)
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
void setInitialGuess(const RCP< const Thyra::ModelEvaluatorBase::InArgs< value_type > > &initialGuess)
Do a forward solve for the states only.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)