NLPInterfacePack: C++ Interfaces and Implementation for Non-Linear Programs  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
NLPInterfacePack::NLPTester Class Reference

Testing class for base NLP interface. More...

#include <NLPInterfacePack_NLPTester.hpp>

Public Member Functions

 STANDARD_MEMBER_COMPOSITION_MEMBERS (bool, print_all)
 Members for option print_all() (see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (bool, throw_exception)
 Members for option throw_exception() (see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 NLPTester (bool print_all=false, bool throw_exception=true)
 Constructor (default options) More...
 
bool test_interface (NLP *nlp, const Vector &xo, bool print_all_warnings, std::ostream *out)
 Test the NLP interface as the given base point xo. More...
 

Detailed Description

Testing class for base NLP interface.

This class is little more than a unit tester for the NLP base interface. This class will call all of the NLP methods and print out quanities if asked to. This class simply validates the pre and post conditions for all of the methods. In that this class is useful.

Definition at line 60 of file NLPInterfacePack_NLPTester.hpp.

Constructor & Destructor Documentation

NLPInterfacePack::NLPTester::NLPTester ( bool  print_all = false,
bool  throw_exception = true 
)

Constructor (default options)

Definition at line 59 of file NLPInterfacePack_NLPTester.cpp.

Member Function Documentation

NLPInterfacePack::NLPTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( bool  ,
print_all   
)

Members for option print_all() (see Teuchos_StandardMemberCompositionMacros.hpp).

NLPInterfacePack::NLPTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( bool  ,
throw_exception   
)

Members for option throw_exception() (see Teuchos_StandardMemberCompositionMacros.hpp).

bool NLPInterfacePack::NLPTester::test_interface ( NLP nlp,
const Vector &  xo,
bool  print_all_warnings,
std::ostream *  out 
)

Test the NLP interface as the given base point xo.

Parameters
nlp[in/out] The NLP object being tested. The pointers returned by nlp->get_f(), nlp->get_c() and nlp->get_h() will be preserved on output and will not be modified by this function.. The NLP must be initialized before input.
xo[in] Base point for the unknown variables to test the calcuation methods at.
print_all_warnings[in] Determines if warnings for all of the comparison tests are printed or not. Warning: may cause as much as O(this->n()) output.
out [in/out] If out != NULL any and all output will be sent here. If out == NULL then no output will be produced.
Returns
Returns true if all of the tests checked out and no unexpected exceptions were thrown.

The behavior of this method depends on the options print_all() and throw_exception() and the input arguments print_all_warnings and out.

  • throw_exception(bool): If throw_exception() == true, then if any of the objects within this function throw exceptions, these exceptions will be be thrown clean out of this function for the caller to handle. If throw_exception() == false, then if any object throws an exception, the exception is caught and this this function will return false. In any case an error message will be printed to *out (if out != NULL</tt) before leaving the function (by return or throw).
  • print_all(bool): If print_all() == true then all of the computed quantities will but dumped to out. Note that this is a useful option for initial debugging of small NLPs but not a good idea for larger NLPs as it will result in an excessive amount of output.

Definition at line 66 of file NLPInterfacePack_NLPTester.cpp.


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