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_GlobalMPISession.hpp"
00034 #include "Teuchos_CommandLineProcessor.hpp"
00035 #include "Teuchos_StandardCatchMacros.hpp"
00036
00037 int main( int argc, char* argv[] )
00038 {
00039 using MoochoPack::MoochoSolver;
00040 using NLPInterfacePack::NLPWBCounterExample;
00041 using Teuchos::CommandLineProcessor;
00042 bool success = true;
00043
00044 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
00045
00046 try {
00047
00048 MoochoSolver solver;
00049
00050
00051
00052
00053
00054 double xinit[3] = { 0.0, 0.0, 0.0 };
00055 double a = 0.0;
00056 double b = 1.0;
00057 bool nlp_selects_basis = true;
00058 bool linear_obj = true;
00059
00060 CommandLineProcessor clp(false);
00061 solver.setup_commandline_processor(&clp);
00062 clp.setOption( "x1-init", &xinit[0], "Initail guess for x(1)" );
00063 clp.setOption( "x2-init", &xinit[1], "Initail guess for x(2)" );
00064 clp.setOption( "x3-init", &xinit[2], "Initail guess for x(3)" );
00065 clp.setOption( "a", &a, "Constant for c(1)" );
00066 clp.setOption( "b", &b, "Constant for c(2)" );
00067 clp.setOption(
00068 "nlp-selects-basis", "no-nlp-selects-basis", &nlp_selects_basis
00069 ,"Determine if NLP will select basis" );
00070 clp.setOption(
00071 "linear-obj", "nonlinear-obj", &linear_obj
00072 ,"Determine if objective is linear" );
00073 CommandLineProcessor::EParseCommandLineReturn
00074 parse_return = clp.parse(argc,argv,&std::cerr);
00075 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
00076 return parse_return;
00077
00078
00079
00080
00081
00082
00083 NLPWBCounterExample
00084 nlp(xinit,a,b,nlp_selects_basis,linear_obj);
00085
00086 solver.set_nlp( Teuchos::rcp(&nlp,false) );
00087
00088 const MoochoSolver::ESolutionStatus
00089 solution_status = solver.solve_nlp();
00090
00091
00092
00093
00094
00095 return solution_status;
00096
00097 }
00098 TEUCHOS_STANDARD_CATCH_STATEMENTS(true,std::cout,success)
00099
00100 return MoochoSolver::SOLVE_RETURN_EXCEPTION;
00101
00102 }