00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <iostream>
00030
00031 #include "NLPInterfacePack_NLPWBCounterExample.hpp"
00032 #include "MoochoPack_MoochoSolver.hpp"
00033 #include "Teuchos_CommandLineProcessor.hpp"
00034 #include "Teuchos_StandardCatchMacros.hpp"
00035
00036 int main( int argc, char* argv[] )
00037 {
00038 using MoochoPack::MoochoSolver;
00039 using NLPInterfacePack::NLPWBCounterExample;
00040 using Teuchos::CommandLineProcessor;
00041 bool success = true;
00042
00043 try {
00044
00045 MoochoSolver solver;
00046
00047
00048
00049
00050
00051 double xinit[3] = { 0.0, 0.0, 0.0 };
00052 double a = 0.0;
00053 double b = 1.0;
00054 bool nlp_selects_basis = true;
00055 bool linear_obj = true;
00056
00057 CommandLineProcessor clp(false);
00058 solver.setup_commandline_processor(&clp);
00059 clp.setOption( "x1-init", &xinit[0], "Initail guess for x(1)" );
00060 clp.setOption( "x2-init", &xinit[1], "Initail guess for x(2)" );
00061 clp.setOption( "x3-init", &xinit[2], "Initail guess for x(3)" );
00062 clp.setOption( "a", &a, "Constant for c(1)" );
00063 clp.setOption( "b", &b, "Constant for c(2)" );
00064 clp.setOption(
00065 "nlp-selects-basis", "no-nlp-selects-basis", &nlp_selects_basis
00066 ,"Determine if NLP will select basis" );
00067 clp.setOption(
00068 "linear-obj", "nonlinear-obj", &linear_obj
00069 ,"Determine if objective is linear" );
00070 CommandLineProcessor::EParseCommandLineReturn
00071 parse_return = clp.parse(argc,argv,&std::cerr);
00072 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
00073 return parse_return;
00074
00075
00076
00077
00078
00079
00080 NLPWBCounterExample
00081 nlp(xinit,a,b,nlp_selects_basis,linear_obj);
00082
00083 solver.set_nlp( Teuchos::rcp(&nlp,false) );
00084
00085 const MoochoSolver::ESolutionStatus
00086 solution_status = solver.solve_nlp();
00087
00088
00089
00090
00091
00092 return solution_status;
00093
00094 }
00095 TEUCHOS_STANDARD_CATCH_STATEMENTS(true,std::cout,success)
00096
00097 return MoochoSolver::SOLVE_RETURN_EXCEPTION;
00098
00099 }