MoochoPack::MoochoSolver Class Reference

Universal interface to a MOOCHO solver. More...

#include <MoochoPack_MoochoSolver.hpp>

List of all members.

Private Types

typedef RCP
< NLPSolverClientInterface
solver_ptr_t
 

Private Member Functions

void generate_output_streams () const
 

Private Attributes

OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor commandLineOptionsFromStreamProcessor_
NLPAlgoContainer solver
bool reconfig_solver_
value_type workspace_MB_
value_type obj_scale_
bool test_nlp_
bool print_algo_
bool algo_timing_
bool generate_stats_file_
bool print_opt_grp_not_accessed_
bool throw_exceptions_
std::string output_file_tag_
bool do_console_outputting_
bool do_summary_outputting_
bool do_journal_outputting_
bool do_algo_outputting_
int configuration_



enum  EOutputToBlackHole { OUTPUT_TO_BLACK_HOLE_DEFAULT, OUTPUT_TO_BLACK_HOLE_TRUE, OUTPUT_TO_BLACK_HOLE_FALSE }
  More...
enum  EConfigOptions { MAMA_JAMA, INTERIOR_POINT }
  More...
enum  ESolutionStatus {
  SOLVE_RETURN_SOLVED = 0, SOLVE_RETURN_NLP_TEST_FAILED = 1, SOLVE_RETURN_MAX_ITER = 2, SOLVE_RETURN_MAX_RUN_TIME = 3,
  SOLVE_RETURN_EXCEPTION = 4
}
  More...
typedef RCP
< NLPInterfacePack::NLP
nlp_ptr_t
 
typedef RCP
< IterationPack::AlgorithmTracker
track_ptr_t
 
typedef RCP< NLPAlgoConfigconfig_ptr_t
 
typedef RCP
< OptionsFromStreamPack::OptionsFromStream
options_ptr_t
 
typedef RCP< std::ostream > ostream_ptr_t
 

Initialization and algorithm configuration



 MoochoSolver (const std::string &options_file_name="Moocho.opt", const std::string &extra_options_str="")
 Constructs to uninitialized.
OptionsFromStreamPack::CommandLineOptionsFromStreamProcessorcommandLineOptionsFromStreamProcessor ()
 
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_tget_nlp () const
 Get the non-const smart pointer to the set NLP object.
void set_track (const track_ptr_t &track)
const track_ptr_tget_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_tget_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_tget_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_terror_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_tget_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_tget_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_tget_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_tget_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
 Solve the NLP.

Get the underlying solver object



NLPSolverClientInterfaceget_solver ()
 Get the underlying NLPSolverClientInterface object.
const NLPSolverClientInterfaceget_solver () const
 

Detailed Description

Universal interface to a MOOCHO solver.

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:

  1. Algorithm configuration (i.e. configure an encapsulated NLPAlgoClientInterface object with an NLP and other objects).
  2. NLP solution (i.e. call 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 ???).

  1. Base default implementation on NLPAlgoConfigMamaJama and require minimal effort to quickly solve an NLP. This includes setting up standard IterationPack::AlgorithmTracker objects and taking care of exceptions etc.
    Enabler: The client can simply not call this->set_config() or call this->set_config(NULL) which will result in the default configuration object being used.
  2. Allow clients the ability to insert a customized AlgorithmTracker object, in addition to the other standard track objects.
    Enabler: An extra user defined track object can be set using 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.
  3. Allow clients to set the targets for standard output streams (i.e. summary_out, journal_out and console_out) at all times (i.e. between successive solves) or just use default output files.
    Enabler: Default output targets can be used by doing nothing. User specified output streams can be set using 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).
  4. Allow clients to set any special options in NLPAlgoConfigMamaJama beyond what can be set through the OptionsFromStream object (i.e. set a specialized BasisSystem object).
    Enabler: This can be accomplished by having the client create a NLPAlgoConfigMamaJama object itself and then configure it using the published interface before explicitly setting it using this->set_config().
  5. Allow clients to precisly control how an algorithm is configured and initialized beyond NLPAlgoConfigMamaJama and between NLP solves.
    Enabler: This can be accomplised by allowing the client to set a customized NLPAlgoConfig object. Clients can simply modify algorithms created by NLPAlgoConfigMamaJama using delegation or subclassing (delegation is to be prefered).
  6. Allow clients to solve the same NLP (i.e. same dimensions, same structure etc) multiple times with the same configured MOOCHO algorithm.
    Enabler: This can be done By simply calling 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().
  7. Allow clients to configure a new MOOCHO algorithm with a potentially new NLP object (i.e. different dimensions, different structure etc).
    Enabler: The client can just call 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.


Member Typedef Documentation

Public types

Definition at line 151 of file MoochoPack_MoochoSolver.hpp.

Definition at line 153 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 159 of file MoochoPack_MoochoSolver.hpp.

Definition at line 704 of file MoochoPack_MoochoSolver.hpp.


Member Enumeration Documentation

Enumerator:
OUTPUT_TO_BLACK_HOLE_DEFAULT 
OUTPUT_TO_BLACK_HOLE_TRUE 
OUTPUT_TO_BLACK_HOLE_FALSE 

Definition at line 165 of file MoochoPack_MoochoSolver.hpp.

Enumerator:
MAMA_JAMA 
INTERIOR_POINT 

Definition at line 171 of file MoochoPack_MoochoSolver.hpp.

Enumerator:
SOLVE_RETURN_SOLVED 
SOLVE_RETURN_NLP_TEST_FAILED 
SOLVE_RETURN_MAX_ITER 
SOLVE_RETURN_MAX_RUN_TIME 
SOLVE_RETURN_EXCEPTION 

Definition at line 176 of file MoochoPack_MoochoSolver.hpp.


Constructor & Destructor Documentation

MoochoPack::MoochoSolver::MoochoSolver ( const std::string &  options_file_name = "Moocho.opt",
const std::string &  extra_options_str = "" 
)

Constructs to uninitialized.

Postconditions:

Definition at line 34 of file MoochoPack_MoochoSolver.cpp.


Member Function Documentation

OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor & MoochoPack::MoochoSolver::commandLineOptionsFromStreamProcessor (  ) 

Definition at line 81 of file MoochoPack_MoochoSolver.cpp.

const OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor & MoochoPack::MoochoSolver::commandLineOptionsFromStreamProcessor (  )  const

Definition at line 87 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::setup_commandline_processor ( Teuchos::CommandLineProcessor clp  ) 

Setup the commandline processor to process commandline options.

Definition at line 92 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::set_nlp ( const nlp_ptr_t nlp  ) 

Set the NLP to be solved.

Preconditions:

  • nlp.get() != NULL (throw std::invalid_argument).
  • This NLP object must be ready to have nlp->initialize() called but nlp->is_initialized() can be false.

Postconditions:

  • this->get_nlp().get() == nlp.get()
  • This will cause the MOOCHO algorithm to be reconfigured before the NLP is solved again.

Definition at line 150 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::nlp_ptr_t & MoochoPack::MoochoSolver::get_nlp (  )  const

Get the non-const smart pointer to the set NLP object.

Returns:
Returns the nlp object pointer set by this->set_nlp().

Definition at line 157 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::set_track ( const track_ptr_t track  ) 

Set an extra user defined AlgorithmTracker object to monitor the algorithm.

Postconditions:

Definition at line 162 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::track_ptr_t & MoochoPack::MoochoSolver::get_track (  )  const

Get the non-const smart pointer to the set AlgorithmTracker object.

Returns:
Returns the track object pointer set by this->set_track().

Definition at line 169 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::set_config ( const config_ptr_t config  ) 

Set the algorithm configuration object.

Parameters:
config [in] The algorithm configuration object to use the next time this->do_config_algo() or this->solve_nlp() are called.

Postconditions:

  • [config.get() == NULL] A NLPAlgoConfigMamaJama object will be used to configure the MOOCHO algorithm the next time that this->do_config_algo() or this->solve_nlp() are called.
  • [config.get() != NULL] The object *config will be used to configure the MOOCHO algorithm the next time that this->do_config_algo() or this->solve_nlp() are called.
  • A reconfiguration of the MOOCHO algorithm will be forced the next time that this->do_config_algo() or this->solve_nlp() are called.
  • this->get_config().get() == config.get()

Definition at line 174 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::config_ptr_t & MoochoPack::MoochoSolver::get_config (  )  const

Return the configuration object being used.

Returns:
Returns return.get() == config.get() passed to the last call to this->set_config(config).

Definition at line 182 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::set_options ( const options_ptr_t options  ) 

Set the various options to use.

Parameters:
options [in] Smart pointer to the OptionsFromStream object to extract the options for this as well as for the configuration object from. If options.get() != NULL then this object must not be destoryed until this->set_options(NULL) is called or this is destroyed.

Postconditions:

  • [options.get() == NULL] The file "Moocho.opt" will be looked for and opened in the current directory. If this file does not exist, then a default set of options will be used. If this file does exist then the options will be read from this file.
  • [options.get() != NULL] The options will be read from *options.
  • A reconfiguration of the MOOCHO algorithm will be forced the next time that this->do_config_algo() or this->solve_nlp() are called.
  • this->get_options().get() == options.get()

Definition at line 187 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::options_ptr_t & MoochoPack::MoochoSolver::get_options (  )  const

Get the OptionsFromStream object being used to extract the options from.

ToDo: Finish documentation.

Definition at line 200 of file MoochoPack_MoochoSolver.cpp.

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

Parameters:
throw_exceptions [in] If true, then after printing the error message (see error_out) the exception will be rethrown out of this->solve_nlp().
error_out [in] If error_out.get() != NULL, then the error messages from any thrown std::exception will be printed to *error_out. Otherwise, they will be printed to std::cerr.

Postconditions:

Definition at line 205 of file MoochoPack_MoochoSolver.cpp.

bool MoochoPack::MoochoSolver::throw_exceptions (  )  const

Return if exceptions will be thrown out of this->solve_nlp().

Definition at line 224 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::ostream_ptr_t & MoochoPack::MoochoSolver::error_out (  )  const

Return the std::ostream object used for error reporting on exceptions.

If return.get() == NULL then this means that std::cerr wil be written to.

Definition at line 230 of file MoochoPack_MoochoSolver.cpp.

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

Parameters:
file_context_postfix [in] Prefix to attach to every file name for default output files.
output_to_black_hole [in] Determines if output will be sent to black-hole streams or not.
procRank [in] If procRank >= 0 then this this will be considered to be the rank of this process. Otherwise, procRank will be extracted from Teuchos::GlobalMPISession::getRank(). This integer is used to build file names for output streams that get created.
numProcs [in] If numProcs > 0 then this this will be considered to be the number of processes. Otherwise, numProcs will be extracted from Teuchos::GlobalMPISession::getNProc(). This integer is used to build file names for output streams that get created.

Note that this function will wipe out all storage for all of the output streams that are set. Therefore, you should call this function before you set any streams manually.

This information affects the file names created by the generate_output_file() function which is used both by external clients and also internally to create various output files.

Definition at line 99 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::set_output_file_tag ( const std::string &  output_file_tag  )  [inline]

Set a tag for output file names for all file names that are created internally.

Definition at line 822 of file MoochoPack_MoochoSolver.hpp.

void MoochoPack::MoochoSolver::do_console_outputting ( bool  do_console_outputting  )  [inline]

Turn on and off console outputting.

Definition at line 828 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::do_console_outputting (  )  const [inline]

Return if console outputting is performed or not.

Definition at line 834 of file MoochoPack_MoochoSolver.hpp.

void MoochoPack::MoochoSolver::set_console_out ( const ostream_ptr_t console_out  ) 

Set the std::ostream object to use for console output by a MoochoTrackerConsoleStd object.

Parameters:
console_out [in] Smart pointer to an std::ostream object that output appropriate for the console is sent to. An obvious choice for this output stream is std::cout can can be set using this->set_console_out(rcp(&std::cout,false)).

Postconditions:

ToDo: Discuss exactly what is printed to this output stream.

Definition at line 235 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::ostream_ptr_t & MoochoPack::MoochoSolver::get_console_out (  )  const

Get the non-const smart pointer to the set output stream for console outputting.

Returns:
Returns the console_out smart pointer object pointer set by the last call to this->set_console_out(). Not that if console_out.get() == NULL on in the last call to this->set_console_out(console_out) this this method returns return.get() == NULL which is a flag that the stream std::cout is being written to and this function does not provide access to that std::ofstream object (the client can access that stream themselves).

Definition at line 243 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::do_summary_outputting ( bool  do_summary_outputting  )  [inline]

Turn on and off summary outputting.

Definition at line 840 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::do_summary_outputting (  )  const [inline]

Return if summary outputting is performed or not.

Definition at line 846 of file MoochoPack_MoochoSolver.hpp.

void MoochoPack::MoochoSolver::set_summary_out ( const ostream_ptr_t summary_out  ) 

Set the std::ostream object to use for summary output.

Parameters:
summay_out [in] Smart pointer to std::ostream object that summary output is sent to.

Postconditions:

ToDo: Discuss exactly what is printed to this output stream.

Definition at line 248 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::ostream_ptr_t & MoochoPack::MoochoSolver::get_summary_out (  )  const

Get the non-const smart pointer to the set output stream for summary outputting.

Postconditions:

  • return.get() == summary_out.get() where summary_out was the value last sent to this->set_summary_out(summary_out).
Returns:
Returns the summary_out smart pointer object pointer set by the last call to this->set_summary_out(). Not that if summary_out.get() == NULL on in the last call to this->set_summary_out(summary_out) this this method returns return.get() == NULL which is a flag that the file "MoochoSummary.out" is being written to and this function does not provide access to that std::ofstream object.

Definition at line 256 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::do_journal_outputting ( bool  do_journal_outputting  )  [inline]

Turn on and off journal outputting.

Definition at line 852 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::do_journal_outputting (  )  const [inline]

Return if journal outputting is performed or not.

Definition at line 858 of file MoochoPack_MoochoSolver.hpp.

void MoochoPack::MoochoSolver::set_journal_out ( const ostream_ptr_t journal_out  ) 

Set the std::ostream object to use for journal output by the MOOCHO step objects.

Parameters:
journal_out [in] Smart pointer to an std::ostream object that journal output will be set to.

Note that if the option 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:

  • [journal_out.get() == NULL] The file "MoochoJournal.out" will be overwritten with journal output. object the next time this->solve_nlp() is called.
  • [journal_out.get() != NULL] The stream *journal_out will be written to with journal output the next time this->solve_nlp() is called.
  • this->get_journal_out().get() == journal_out.get()

Definition at line 261 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::ostream_ptr_t & MoochoPack::MoochoSolver::get_journal_out (  )  const

Get the non-const smart pointer to the set output stream for journal outputting.

Postconditions:

  • return.get() == journal_out.get() where journal_out was the value last sent to this->set_journal_out(journal_out).
Returns:
Returns the journal_out smart pointer object pointer set by the last call to this->set_journal_out(). Not that if journal_out.get() == NULL on in the last call to this->set_journal_out(journal_out) this this method returns return.get() == NULL which is a flag that the file "MoochoJournal.out" is being written to and this function does not provide access to that std::ofstream object.

Definition at line 269 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::do_algo_outputting ( bool  do_algo_outputting  )  [inline]

Turn on and off algo outputting.

Definition at line 864 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::do_algo_outputting (  )  const [inline]

Return if algo outputting is performed or not.

Definition at line 870 of file MoochoPack_MoochoSolver.hpp.

void MoochoPack::MoochoSolver::generate_stats_file ( bool  generate_stats_file  )  [inline]

Turn on and off the generation of a statistics file.

Definition at line 876 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::generate_stats_file (  )  const [inline]

Return if a statistics file will be generated or not.

Definition at line 882 of file MoochoPack_MoochoSolver.hpp.

void MoochoPack::MoochoSolver::set_algo_out ( const ostream_ptr_t algo_out  ) 

Set the std::ostream object to use for algorithm output.

Parameters:
algo_out [in] Smart pointer to an std::ostream object that static algorithm output will be set to.

Postconditions:

  • [algo_out.get() == NULL] The file "MoochoAlgo.out" will be overwritten with algorithm info. object the next time this->solve_nlp() is called.
  • [algo_out.get() != NULL] The stream *algo_out will be written to with algorithm info the next time this->solve_nlp() is called.
  • this->get_algo_out().get() == algo_out.get()

Note that if the option NLPSolverClientInterface::print_algo == false in the last call to this->set_options(options) then no output is sent to this stream at all.

ToDo: Discuss exactly what is printed to this output stream.

Definition at line 274 of file MoochoPack_MoochoSolver.cpp.

const MoochoSolver::ostream_ptr_t & MoochoPack::MoochoSolver::get_algo_out (  )  const

Get the non-const smart pointer to the set output stream for algo outputting.

Postconditions:

  • return.get() == algo_out.get() where algo_out was the value last sent to this->set_algo_out(algo_out).
Returns:
Returns the algo_out smart pointer object pointer set by the last call to this->set_algo_out(). Not that if algo_out.get() == NULL on in the last call to this->set_algo_out(algo_out) this this method returns return.get() == NULL which is a flag that the file "MoochoAlgo.out" is being written to and this function does not provide access to that std::ofstream object.

Definition at line 281 of file MoochoPack_MoochoSolver.cpp.

Teuchos::RCP< std::ostream > MoochoPack::MoochoSolver::generate_output_file ( const std::string &  fileNameBase  )  const

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.

Definition at line 287 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::update_solver (  )  const

Setup the state of the solver and get ready for a solve.

This function gets called already by solve_nlp() so it does not have to be called manually. However, after calling this function all stream objects will be set up in order to be used prior to calling solve_nlp().

Definition at line 304 of file MoochoPack_MoochoSolver.cpp.

MoochoSolver::ESolutionStatus MoochoPack::MoochoSolver::solve_nlp (  )  const

Solve the NLP.

Preconditions:

  • this->get_nlp() != NULL (throw std::logic_error)

Algorithm configuration:
The NLPAlgoConfig object used to configure an optimization algorithm is specified by *this->get_config(). If this->get_config().get() == NULL then the default configuratiion class NLPAlgoConfigMamaJama is used. This default configuration class is full featured and should have a good shot at solving any NLP thrown at it.

Specifying options:
The options used by the configuration object to configure the optimization algorithm as well as solver tolerances, maximum number of iterations etc are taken from the OptionsFromStreamPack::OptionsFromStream object returned from *this->get_options(). If this->get_options().get() == NULL then an attempt is made to open the file 'Moocho.opt' in the current directory. If this file does not exist, then a default set of options is used which will be acceptable for most NLPs. The files Moocho.opt.MoochoSolver, Moocho.opt.DecompositionSystemStateStepBuilderStd and Moocho.opt.NLPAlgoConfigMamaJama show which options can be used with this solver interface and a NLPAlgoConfigMamaJama configuration object respectively. Other configuration classes will use a different set of options. See the documentation for those configuration classes for details.

Outputting to streams:

If this->throw_exceptions() == false then any exceptions that may be thown internally will be caught, std::exception::what() will be printed to *this->error_out() (or std::cerr if this->error_out().get() == NULL) and this method will return SOLVE_RETURN_EXCEPTION. If this->throw_exceptions() == true, then after the error has been reported, the exception will be rethrown out for the caller to deal with!

Even if no exception is thrown, then a short one-line summary message will be printed to *this->error_out() (or std::cerr if this->error_out().get() == NULL) stating whether the NLP was solved or not.

ToDo: Finish documentation!

Returns:
The solution status:
  • ToDo: Fill these in and discuss them!

Definition at line 627 of file MoochoPack_MoochoSolver.cpp.

NLPSolverClientInterface & MoochoPack::MoochoSolver::get_solver (  ) 

Get the underlying NLPSolverClientInterface object.

If the algorithm has not already been configured it will be here using whatever NLPAlgoConfig object that it has (set using this->set_config*() or using the default). Whatever options where set (i.e. using this->set_options()) will be used when this algorithm is configured and the NLP is solved.

Preconditions:

  • this->get_nlp() != NULL (throw std::logic_error)

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 877 of file MoochoPack_MoochoSolver.cpp.

const NLPSolverClientInterface & MoochoPack::MoochoSolver::get_solver (  )  const

Definition at line 883 of file MoochoPack_MoochoSolver.cpp.

void MoochoPack::MoochoSolver::generate_output_streams (  )  const [private]

Definition at line 891 of file MoochoPack_MoochoSolver.cpp.


Member Data Documentation

Definition at line 709 of file MoochoPack_MoochoSolver.hpp.

Definition at line 713 of file MoochoPack_MoochoSolver.hpp.

Definition at line 715 of file MoochoPack_MoochoSolver.hpp.

value_type MoochoPack::MoochoSolver::workspace_MB_ [mutable, private]

Definition at line 716 of file MoochoPack_MoochoSolver.hpp.

value_type MoochoPack::MoochoSolver::obj_scale_ [mutable, private]

Definition at line 717 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::test_nlp_ [mutable, private]

Definition at line 718 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::print_algo_ [mutable, private]

Definition at line 719 of file MoochoPack_MoochoSolver.hpp.

bool MoochoPack::MoochoSolver::algo_timing_ [mutable, private]

Definition at line 720 of file MoochoPack_MoochoSolver.hpp.

Definition at line 721 of file MoochoPack_MoochoSolver.hpp.

Definition at line 722 of file MoochoPack_MoochoSolver.hpp.

Definition at line 723 of file MoochoPack_MoochoSolver.hpp.

std::string MoochoPack::MoochoSolver::output_file_tag_ [mutable, private]

Definition at line 724 of file MoochoPack_MoochoSolver.hpp.

Definition at line 725 of file MoochoPack_MoochoSolver.hpp.

Definition at line 726 of file MoochoPack_MoochoSolver.hpp.

Definition at line 727 of file MoochoPack_MoochoSolver.hpp.

Definition at line 728 of file MoochoPack_MoochoSolver.hpp.

Definition at line 729 of file MoochoPack_MoochoSolver.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:17:40 2011 for MOOCHO (Single Doxygen Collection) by  doxygen 1.6.3