44 #include "NLPInterfacePack_ExampleNLPBanded.hpp"
45 #include "MoochoPack_MoochoSolver.hpp"
46 #include "Teuchos_CommandLineProcessor.hpp"
47 #include "Teuchos_StandardCatchMacros.hpp"
48 #include "Teuchos_GlobalMPISession.hpp"
50 int main(
int argc,
char* argv[] )
52 namespace mp = MoochoPack;
53 namespace nlpip = NLPInterfacePack;
54 using mp::MoochoSolver;
56 using nlpip::ExampleNLPBanded;
58 typedef nlpip::value_type value_type;
72 bool show_options =
false;
78 bool nlp_selects_basis =
true;
79 double xDl = -NLP::infinite_bound();
80 double xDu = +NLP::infinite_bound();
81 double xIl = -NLP::infinite_bound();
82 double xIu = +NLP::infinite_bound();
89 double hl = -NLP::infinite_bound();
90 double hu = +NLP::infinite_bound();
91 double diag_scal = 1.0;
92 double diag_vary = 1.0;
93 bool sym_basis =
false;
94 double f_offset = 0.0;
96 bool ignore_constraints =
false;
98 CommandLineProcessor clp(
false);
100 solver.setup_commandline_processor(&clp);
102 clp.setOption(
"show-options",
"no-show-options", &show_options,
"Show the commandline options or not." );
103 clp.setOption(
"nD", &nD,
"Number of dependent variables" );
104 clp.setOption(
"nI", &nI,
"Number of independent variables" );
105 clp.setOption(
"bw", &bw,
"Band width of the basis matrix" );
106 clp.setOption(
"mI", &mI,
"Number of general inequality constriants" );
107 clp.setOption(
"xo", &xo,
"Initial guess for x" );
108 clp.setOption(
"xDl", &xDl,
"Lower bounds on xD" );
109 clp.setOption(
"xDu", &xDu,
"Upper bounds on xD" );
110 clp.setOption(
"xIl", &xIl,
"Lower bounds on xI" );
111 clp.setOption(
"xIu", &xIu,
"Upper bounds on xI" );
113 clp.setOption(
"hl", &hl,
"Lower bounds on general inequalities" );
114 clp.setOption(
"hu", &hu,
"Upper bounds on general inequalities" );
115 clp.setOption(
"diag-scal", &diag_scal,
"Scaling of the basis diagonal" );
116 clp.setOption(
"diag-vary", &diag_vary,
"Variation of the basis diagonal scaling" );
118 "nlp-selects-basis",
"no-nlp-selects-basis", &nlp_selects_basis
119 ,
"Determine if the NLP will select basis" );
121 "sym-basis",
"unsym-basis", &sym_basis
122 ,
"Determine if the basis is symmetric" );
123 clp.setOption(
"f_offset", &f_offset,
"Constant offset for objective function" );
124 clp.setOption(
"co", &co,
"Constant term in general equalities" );
126 "ignore-constraints",
"no-ignore-constraints", &ignore_constraints
127 ,
"Determine if constraints are ignored or not" );
129 CommandLineProcessor::EParseCommandLineReturn
130 parse_return = clp.parse(argc,argv,&std::cerr);
132 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
136 std::cout <<
"\nPrinting commandline options used (options used shown as (default: \?\?\?) ...\n\n";
137 clp.printHelpMessage(argv[0],std::cout);
145 nlp(nD,nI,bw,mU,mI,xo,xDl,xDu,xIl,xIu,hl,hu
146 ,nlp_selects_basis,diag_scal,diag_vary
147 ,sym_basis,f_offset,co,ignore_constraints
152 const MoochoSolver::ESolutionStatus
153 solution_status = solver.solve_nlp();
155 return solution_status;
160 return MoochoSolver::SOLVE_RETURN_EXCEPTION;
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)