57 int main(
int argc,
char* argv[]) {
61 namespace mmp = MemMngPack;
65 namespace NLPIP = NLPInterfacePack;
66 namespace rsqp = MoochoPack;
67 using rsqp::MoochoSolver;
71 GlobalMPISession mpiSession(&argc, &argv);
74 const int proc_rank = GlobalMPISession::getRank();
79 PROG_NLP_TEST_ERR = -1,
81 PROG_MAX_ITER_EXEEDED = -3,
82 PROG_MAX_TIME_EXEEDED = -4;
84 int prog_return = PROG_SUCCESS;
87 std::ostream &
out = std::cout;
88 std::ostream &eout = std::cerr;
102 VectorSpace::space_ptr_t vec_space;
104 argc, argv,
MPI_COMM_WORLD, &vec_space, &n, &xo, &has_bounds, &dep_bounded);
109 const MoochoSolver::ESolutionStatus
111 *vec_space, xo, has_bounds, dep_bounded
112 ,proc_rank == 0 ? &out : &blackhole
113 ,proc_rank == 0 ? &eout : &blackhole
114 ,proc_rank == 0 ?
false :
true
115 ,proc_rank == 0 ? NULL : &blackhole
116 ,proc_rank == 0 ? NULL : &blackhole
117 ,proc_rank == 0 ? NULL : &blackhole
120 switch(solve_return) {
121 case MoochoSolver::SOLVE_RETURN_SOLVED:
122 prog_return = PROG_SUCCESS;
124 case MoochoSolver::SOLVE_RETURN_MAX_ITER:
125 prog_return = PROG_MAX_ITER_EXEEDED;
127 case MoochoSolver::SOLVE_RETURN_MAX_RUN_TIME:
128 prog_return = PROG_MAX_TIME_EXEEDED;
130 case MoochoSolver::SOLVE_RETURN_NLP_TEST_FAILED:
131 prog_return = PROG_NLP_TEST_ERR;
133 case MoochoSolver::SOLVE_RETURN_EXCEPTION:
134 prog_return = PROG_EXCEPTION;
141 catch(
const std::exception& excpt) {
142 eout <<
"\nCaught a std::exception on process " << proc_rank<<
": " << excpt.what() << endl;
143 prog_return = PROG_EXCEPTION;
146 eout <<
"\nCaught an unknown exception on process " << proc_rank<<
"\n";
147 prog_return = PROG_EXCEPTION;
AbstractLinAlgPack::size_type size_type
MoochoPack::MoochoSolver::ESolutionStatus ExampleNLPFirstOrderRun(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 main(int argc, char *argv[])
RTOp_value_type value_type
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)