56 int main(
int argc,
char* argv[] ) {
60 namespace mmp = MemMngPack;
64 namespace NLPIP = NLPInterfacePack;
65 namespace rsqp = MoochoPack;
66 using rsqp::MoochoSolver;
84 int num_proc, proc_rank;
99 PROG_NLP_TEST_ERR = -1,
101 PROG_MAX_ITER_EXEEDED = -3,
102 PROG_MAX_TIME_EXEEDED = -4;
104 int prog_return = PROG_SUCCESS;
107 std::ostream &
out = std::cout;
108 std::ostream &eout = std::cerr;
122 VectorSpace::space_ptr_t vec_space;
127 const MoochoSolver::ESolutionStatus
129 *vec_space, xo, has_bounds, dep_bounded
130 ,proc_rank == 0 ? &out : &blackhole
131 ,proc_rank == 0 ? &eout : &blackhole
132 ,proc_rank == 0 ?
false :
true
133 ,proc_rank == 0 ? NULL : &blackhole
134 ,proc_rank == 0 ? NULL : &blackhole
135 ,proc_rank == 0 ? NULL : &blackhole
138 switch(solve_return) {
139 case MoochoSolver::SOLVE_RETURN_SOLVED:
140 prog_return = PROG_SUCCESS;
142 case MoochoSolver::SOLVE_RETURN_MAX_ITER:
143 prog_return = PROG_MAX_ITER_EXEEDED;
145 case MoochoSolver::SOLVE_RETURN_MAX_RUN_TIME:
146 prog_return = PROG_MAX_TIME_EXEEDED;
148 case MoochoSolver::SOLVE_RETURN_NLP_TEST_FAILED:
149 prog_return = PROG_NLP_TEST_ERR;
151 case MoochoSolver::SOLVE_RETURN_EXCEPTION:
152 prog_return = PROG_EXCEPTION;
159 catch(
const std::exception& excpt) {
160 eout <<
"\nCaught a std::exception on process " << proc_rank<<
": " << excpt.what() << endl;
161 prog_return = PROG_EXCEPTION;
164 eout <<
"\nCaught an unknown exception on process " << proc_rank<<
"\n";
165 prog_return = PROG_EXCEPTION;
AbstractLinAlgPack::size_type size_type
MoochoPack::MoochoSolver::ESolutionStatus ExampleNLPDirectRun(const VectorSpace &vec_space, value_type xo, bool has_bounds, bool dep_bounded, std::ostream *console_out, std::ostream *error_out, bool throw_solve_exception=false, std::ostream *algo_out=NULL, std::ostream *summary_out=NULL, std::ostream *journal_out=NULL)
Function accepts a VectorSpace object and then uses it to define an example NLP and run MoochoPack::M...
int MPI_Comm_size(MPI_Comm comm, int *size)
int MPI_Comm_rank(MPI_Comm comm, int *rank)
RTOp_value_type value_type
int MPI_Init(int *argc, char ***argv)
int main(int argc, char *argv[])
int exampleNLPDiagSetup(int argc, char *argv[], MPI_Comm comm, Teuchos::RCP< const VectorSpace > *vec_space, int *n, value_type *xo, bool *has_bounds, bool *dep_bounded)
Create a vector space given the input arguments argc, argv[] and an MPI communicator.
RTOp_index_type size_type
Abstract interface for objects that represent a space for mutable coordinate vectors.
AbstractLinAlgPack::value_type value_type
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()