#include <MoochoPack_MoochoSolver.hpp>
[NOHEADER] | |
| typedef RCP< NLPInterfacePack::NLP > | nlp_ptr_t |
| | |
| typedef RCP< IterationPack::AlgorithmTracker > | track_ptr_t |
| | |
| typedef RCP< NLPAlgoConfig > | config_ptr_t |
| | |
| typedef RCP< OptionsFromStreamPack::OptionsFromStream > | options_ptr_t |
| | |
| typedef RCP< 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 | set_output_file_tag (const std::string &) |
| Set a tag for output file names for all file names that are created internally. | |
| 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. | |
| RCP< std::ostream > | generate_output_file (const std::string &fileNameBase) const |
| Generate an output file given a base file name. | |
Solve the NLP | |
| void | update_solver () const |
| Setup the state of the solver and get ready for a solve. | |
| ESolutionStatus | solve_nlp () const |
| | |
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!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Constructs to uninitialized. Postconditions:
|
|
|
|
|
|
|
|
|
Setup the commandline processor to process commandline options.
|
|
|
Set the NLP to be solved. Preconditions:
Postconditions:
|
|
|
Get the non-const smart pointer to the set NLP object.
|
|
|
Set an extra user defined Postconditions:
|
|
|
Get the non-const smart pointer to the set
|
|
|
Set the algorithm configuration object.
|
|
|
Return the configuration object being used.
|
|
|
Set the various options to use.
|
|
|
Get the ToDo: Finish documentation. |
|
||||||||||||
|
Set the error output and whether exceptions will be thrown from these functions or not.
|
|
|
Return if exceptions will be thrown out of
|
|
|
Return the
If |
|
||||||||||||||||||||
|
Setup the context for outputting.
This information affects the file names created by the |
|
|
Set a tag for output file names for all file names that are created internally.
|
|
|
Turn on and off console outputting.
|
|
|
Return if console outputting is performed or not.
|
|
|
Set the
ToDo: Discuss exactly what is printed to this output stream. |
|
|
Get the non-const smart pointer to the set output stream for console outputting.
|
|
|
Turn on and off summary outputting.
|
|
|
Return if summary outputting is performed or not.
|
|
|
Set the
ToDo: Discuss exactly what is printed to this output stream. |
|
|
Get the non-const smart pointer to the set output stream for summary outputting. Postconditions:
|
|
|
Turn on and off journal outputting.
|
|
|
Return if journal outputting is performed or not.
|
|
|
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:
|
|
|
Get the non-const smart pointer to the set output stream for journal outputting. Postconditions:
|
|
|
Turn on and off algo outputting.
|
|
|
Return if algo outputting is performed or not.
|
|
|
Turn on and off the generation of a statistics file.
|
|
|
Return if a statistics file will be generated or not.
|
|
|
Set the
Note that if the option ToDo: Discuss exactly what is printed to this output stream. |
|
|
Get the non-const smart pointer to the set output stream for algo outputting. Postconditions:
|
|
|
Generate an output file given a base file name. Note that this will typically only create a ofsteam object on the root process and a oblackholestream object on all other processes. |
|
|
Setup the state of the solver and get ready for a solve.
This function gets called already by |
|
|
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!
|
|
|
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! |
|
|
|
1.3.9.1