#include <MoochoPack_MoochoSolver.hpp>
[NOHEADER] | |
| typedef Teuchos::RefCountPtr< NLPInterfacePack::NLP > | nlp_ptr_t |
| | |
| typedef Teuchos::RefCountPtr< IterationPack::AlgorithmTracker > | track_ptr_t |
| | |
| typedef Teuchos::RefCountPtr< NLPAlgoConfig > | config_ptr_t |
| | |
| typedef Teuchos::RefCountPtr< OptionsFromStreamPack::OptionsFromStream > | options_ptr_t |
| | |
| typedef Teuchos::RefCountPtr< std::ostream > | ostream_ptr_t |
| | |
| enum | EOutputToBlackHole |
| More... | |
| enum | EConfigOptions |
| More... | |
| enum | ESolutionStatus |
| More... | |
Initialization and algorithm configuration | |
| MoochoSolver (const std::string &options_file_name="Moocho.opt", const std::string &extra_options_str="") | |
| Constructs to uninitialized. | |
| OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor & | commandLineOptionsFromStreamProcessor () |
| | |
| const OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor & | commandLineOptionsFromStreamProcessor () const |
| | |
| void | setup_commandline_processor (Teuchos::CommandLineProcessor *clp) |
| Setup the commandline processor to process commandline options. | |
| void | set_nlp (const nlp_ptr_t &nlp) |
| Set the NLP to be solved. | |
| const nlp_ptr_t & | get_nlp () const |
| Get the non-const smart pointer to the set NLP object. | |
| void | set_track (const track_ptr_t &track) |
| const track_ptr_t & | get_track () const |
Get the non-const smart pointer to the set AlgorithmTracker object. | |
| void | set_config (const config_ptr_t &config) |
| Set the algorithm configuration object. | |
| const config_ptr_t & | get_config () const |
| Return the configuration object being used. | |
| void | set_options (const options_ptr_t &options) |
| Set the various options to use. | |
| const options_ptr_t & | get_options () const |
Get the OptionsFromStream object being used to extract the options from. | |
Exception handling | |
| void | set_error_handling (bool throw_exceptions, const ostream_ptr_t &error_out) |
| Set the error output and whether exceptions will be thrown from these functions or not. | |
| bool | throw_exceptions () const |
Return if exceptions will be thrown out of this->solve_nlp(). | |
| const ostream_ptr_t & | error_out () const |
Return the std::ostream object used for error reporting on exceptions. | |
Collective outputting control | |
| 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) |
| Setup the context for outputting. | |
Individual outputting control | |
| void | do_console_outputting (bool) |
| Turn on and off console outputting. | |
| bool | do_console_outputting () const |
| Return if console outputting is performed or not. | |
| void | set_console_out (const ostream_ptr_t &console_out) |
Set the std::ostream object to use for console output by a MoochoTrackerConsoleStd object. | |
| const ostream_ptr_t & | get_console_out () const |
| Get the non-const smart pointer to the set output stream for console outputting. | |
| void | do_summary_outputting (bool) |
| Turn on and off summary outputting. | |
| bool | do_summary_outputting () const |
| Return if summary outputting is performed or not. | |
| void | set_summary_out (const ostream_ptr_t &summary_out) |
Set the std::ostream object to use for summary output. | |
| const ostream_ptr_t & | get_summary_out () const |
| Get the non-const smart pointer to the set output stream for summary outputting. | |
| void | do_journal_outputting (bool) |
| Turn on and off journal outputting. | |
| bool | do_journal_outputting () const |
| Return if journal outputting is performed or not. | |
| void | set_journal_out (const ostream_ptr_t &journal_out) |
Set the std::ostream object to use for journal output by the MOOCHO step objects. | |
| const ostream_ptr_t & | get_journal_out () const |
| Get the non-const smart pointer to the set output stream for journal outputting. | |
| void | do_algo_outputting (bool) |
| Turn on and off algo outputting. | |
| bool | do_algo_outputting () const |
| Return if algo outputting is performed or not. | |
| void | generate_stats_file (bool) |
| Turn on and off the generation of a statistics file. | |
| bool | generate_stats_file () const |
| Return if a statistics file will be generated or not. | |
| void | set_algo_out (const ostream_ptr_t &algo_out) |
Set the std::ostream object to use for algorithm output. | |
| const ostream_ptr_t & | get_algo_out () const |
| Get the non-const smart pointer to the set output stream for algo outputting. | |
Solve the NLP | |
| ESolutionStatus | solve_nlp () const |
| Solve the NLP. | |
Get the underlying solver object | |
| NLPSolverClientInterface & | get_solver () |
Get the underlying NLPSolverClientInterface object. | |
| const NLPSolverClientInterface & | get_solver () const |
| | |
This class is designed to act as a simple encapsulation to several other smaller components needed to solve an NLP. This class is an instance of the popular "Facade" design pattern (Design Patterns, 1995). This class has a defualt implementation based on NLPAlgoConfigMamaJama but the client can set different algorithm configuration objects (see the requirments/specifications section below).
There are two distinct activities associated with using a MoochoSolver object:
NLPAlgoClientInterface object with an NLP and other objects). NLPSolverClientInterface::find_min() on the encapuslaited solver object).
In the algorithm configuration phase, the client must, at a minimum, set the NLP object for the NLP to be solved using this->set_nlp(). The NLP object is needed so that the algorithm configuration object can adapt the MOOCHO algorithm to the NLP in the best way possible. The configuration phase can also include setting a user-defined track object(s) and a user-defined NLPAlgoConfig object. An NLP is solved by calling the method this->solve_nlp() which returns an enum stating what happended and reporting the final point to the NLP object.
This class encapsulates an NLPAlgoClientInterface object and takes over some of the drudgery of working with this interface. In most cases all the options that can be set to configuration object and other algorithmic objects can be set using an OptionsFromStreamPack::OptionsFromStream object by calling this->set_options().
Options specific to this class and the configuration object (down to the lower algorithmic objects that it creates) can be set through an OptionsFromStreamPack::OptionsFromStream object by passing it to this->set_options(). The files Moocho.opt.MoochoSolver, Moocho.opt.DecompositionSystemStateStepBuilderStd and Moocho.opt.NLPAlgoConfigMamaJama conatain the listing of these options as well as some documentation. An options file Moocho.opt can be generated automatically using the shell script generate_opt_file.pl.
Requirements / Specifications
The requirements and specifications for this class are stated below. More detailed scenarios are shown elsewhere (??? where ???).
NLPAlgoConfigMamaJama and require minimal effort to quickly solve an NLP. This includes setting up standard IterationPack::AlgorithmTracker objects and taking care of exceptions etc.this->set_config() or call this->set_config(NULL) which will result in the default configuration object being used. AlgorithmTracker object, in addition to the other standard track objects.this->set_extra_track() and can be unset using this->set_extra_track(NULL). Multiple track objects can be handled using the IterationPack::AlgorithmTrackerComposite subclass. summary_out, journal_out and console_out) at all times (i.e. between successive solves) or just use default output files.this->set_console_out(), this->set_summary_out() and this->set_journal_out(). The same output files can be appended to for successive NLP solves by doing nothing. The output files can be changed between NLP runs using this->set_console_out(), this->set_summary_out() and this->set_journal_out(). Default output files can be overwritten between successive NLP solves by calling this->set_console_out(NULL), this->set_summary_out(NULL) and this->set_journal_out(NULL). NLPAlgoConfigMamaJama beyond what can be set through the OptionsFromStream object (i.e. set a specialized BasisSystem object).NLPAlgoConfigMamaJama object itself and then configure it using the published interface before explicitly setting it using this->set_config(). NLPAlgoConfigMamaJama and between NLP solves.NLPAlgoConfig object. Clients can simply modify algorithms created by NLPAlgoConfigMamaJama using delegation or subclassing (delegation is to be prefered). this->get_nlp() (if needed to access the NLP that was set using this->set_nlp()), modifying the NLP object in some way (i.e. a new initial point) and then calling this->solve_nlp(). this->set_uninitialized() which is equivalent to setting the state of the object after the default constructor. In this case the client will have to go through the entire reinitialization phase again. Or, in order to use the same NLP, track and configuration objects but start off with a fresh algorithm configuration the client can just call this->set_nlp(). ToDo: Finish documentation!
Definition at line 144 of file MoochoPack_MoochoSolver.hpp.
|
|
Definition at line 152 of file MoochoPack_MoochoSolver.hpp. |
|
|
Definition at line 155 of file MoochoPack_MoochoSolver.hpp. |
|
|
Definition at line 157 of file MoochoPack_MoochoSolver.hpp. |
|
|
Definition at line 160 of file MoochoPack_MoochoSolver.hpp. |
|
|
Definition at line 162 of file MoochoPack_MoochoSolver.hpp. |
|
|
Definition at line 164 of file MoochoPack_MoochoSolver.hpp. |
|
|
Definition at line 170 of file MoochoPack_MoochoSolver.hpp. |
|
|
Definition at line 175 of file MoochoPack_MoochoSolver.hpp. |
|
||||||||||||
|
Constructs to uninitialized. Postconditions:
Definition at line 62 of file MoochoPack_MoochoSolver.cpp. |
|
|
Definition at line 108 of file MoochoPack_MoochoSolver.cpp. |
|
|
Definition at line 114 of file MoochoPack_MoochoSolver.cpp. |
|
|
Setup the commandline processor to process commandline options.
Definition at line 119 of file MoochoPack_MoochoSolver.cpp. |
|
|
Set the NLP to be solved. Preconditions:
Postconditions:
Definition at line 173 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the non-const smart pointer to the set NLP object.
Definition at line 180 of file MoochoPack_MoochoSolver.cpp. |
|
|
Set an extra user defined Postconditions:
Definition at line 185 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the non-const smart pointer to the set
Definition at line 192 of file MoochoPack_MoochoSolver.cpp. |
|
|
Set the algorithm configuration object.
Definition at line 197 of file MoochoPack_MoochoSolver.cpp. |
|
|
Return the configuration object being used.
Definition at line 205 of file MoochoPack_MoochoSolver.cpp. |
|
|
Set the various options to use.
Definition at line 210 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the ToDo: Finish documentation. Definition at line 223 of file MoochoPack_MoochoSolver.cpp. |
|
||||||||||||
|
Set the error output and whether exceptions will be thrown from these functions or not.
Definition at line 228 of file MoochoPack_MoochoSolver.cpp. |
|
|
Return if exceptions will be thrown out of
Definition at line 247 of file MoochoPack_MoochoSolver.cpp. |
|
|
Return the
If Definition at line 253 of file MoochoPack_MoochoSolver.cpp. |
|
||||||||||||||||||||
|
Setup the context for outputting.
Definition at line 126 of file MoochoPack_MoochoSolver.cpp. |
|
|
Turn on and off console outputting.
Definition at line 783 of file MoochoPack_MoochoSolver.hpp. |
|
|
Return if console outputting is performed or not.
Definition at line 789 of file MoochoPack_MoochoSolver.hpp. |
|
|
Set the
ToDo: Discuss exactly what is printed to this output stream. Definition at line 258 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the non-const smart pointer to the set output stream for console outputting.
Definition at line 266 of file MoochoPack_MoochoSolver.cpp. |
|
|
Turn on and off summary outputting.
Definition at line 795 of file MoochoPack_MoochoSolver.hpp. |
|
|
Return if summary outputting is performed or not.
Definition at line 801 of file MoochoPack_MoochoSolver.hpp. |
|
|
Set the
ToDo: Discuss exactly what is printed to this output stream. Definition at line 271 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the non-const smart pointer to the set output stream for summary outputting. Postconditions:
Definition at line 279 of file MoochoPack_MoochoSolver.cpp. |
|
|
Turn on and off journal outputting.
Definition at line 807 of file MoochoPack_MoochoSolver.hpp. |
|
|
Return if journal outputting is performed or not.
Definition at line 813 of file MoochoPack_MoochoSolver.hpp. |
|
|
Set the
NLPSolverClientInterface::journal_output_level == PRINT_NOTHING in the last call to this->set_options(options) then no output is sent to this stream at all.Postconditions:
Definition at line 284 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the non-const smart pointer to the set output stream for journal outputting. Postconditions:
Definition at line 292 of file MoochoPack_MoochoSolver.cpp. |
|
|
Turn on and off algo outputting.
Definition at line 819 of file MoochoPack_MoochoSolver.hpp. |
|
|
Return if algo outputting is performed or not.
Definition at line 825 of file MoochoPack_MoochoSolver.hpp. |
|
|
Turn on and off the generation of a statistics file.
Definition at line 831 of file MoochoPack_MoochoSolver.hpp. |
|
|
Return if a statistics file will be generated or not.
Definition at line 837 of file MoochoPack_MoochoSolver.hpp. |
|
|
Set the
Note that if the option ToDo: Discuss exactly what is printed to this output stream. Definition at line 297 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the non-const smart pointer to the set output stream for algo outputting. Postconditions:
Definition at line 304 of file MoochoPack_MoochoSolver.cpp. |
|
|
Solve the NLP. Preconditions:
Algorithm configuration:
Specifying options: Outputting to streams:
If
Even if no exception is thrown, then a short one-line summary message will be printed to ToDo: Finish documentation!
Definition at line 311 of file MoochoPack_MoochoSolver.cpp. |
|
|
Get the underlying
If the algorithm has not already been configured it will be here using whatever Preconditions:
Warning! Do not try to modify the underlying solver object using this returned reference to the solver object. Instead, use the above public interface functions. ToDo: Finish documentation! Definition at line 549 of file MoochoPack_MoochoSolver.cpp. |
|
|
Definition at line 555 of file MoochoPack_MoochoSolver.cpp. |
1.3.9.1