NLPInterfacePack_ExampleNLPFirstOrderRun.cpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifdef _INTEL_CXX
00030 // disable Intel C++ 5.0 warnings about debugger limitations
00031 #pragma warning(disable : 985)
00032 #endif
00033 
00034 #include <assert.h>
00035 
00036 #include <fstream>
00037 #include <fstream>
00038 #include <iostream>
00039 #include <iomanip>
00040 #include <typeinfo>
00041 
00042 #include "NLPInterfacePack_ExampleNLPFirstOrderRun.hpp"
00043 #include "NLPInterfacePack_ExampleNLPFirstOrder.hpp"
00044 #include "NLPInterfacePack_ExampleBasisSystem.hpp"
00045 #include "MoochoPack_NLPAlgoConfigMamaJama.hpp"
00046 #include "IterationPack_AlgorithmTracker.hpp"
00047 #include "AbstractLinAlgPack_VectorSpace.hpp"
00048 #include "AbstractLinAlgPack_BasisSystem.hpp"
00049 #include "OptionsFromStreamPack_OptionsFromStream.hpp"
00050 
00051 MoochoPack::MoochoSolver::ESolutionStatus
00052 NLPInterfacePack::ExampleNLPFirstOrderRun(
00053   const VectorSpace&   vec_space
00054   ,value_type          xo
00055   ,bool                has_bounds
00056   ,bool                dep_bounded
00057   ,std::ostream*       console_out
00058   ,std::ostream*       error_out
00059   ,bool                throw_solve_exception
00060   ,std::ostream*       algo_out
00061   ,std::ostream*       summary_out
00062   ,std::ostream*       journal_out
00063   )
00064 {
00065   using std::endl;
00066   using std::setw;
00067   namespace rcp = MemMngPack;
00068   using Teuchos::RefCountPtr;
00069   namespace ofsp = OptionsFromStreamPack;
00070   using ofsp::OptionsFromStream;
00071   namespace rsqp = MoochoPack;
00072   using rsqp::MoochoSolver;
00073   using rsqp::NLPAlgoConfigMamaJama;
00074 
00075   MoochoSolver::ESolutionStatus
00076     solve_return = MoochoSolver::SOLVE_RETURN_EXCEPTION;
00077 
00078   int prec = 8;
00079 
00080   if(console_out)
00081     *console_out
00082       << std::setprecision(prec)
00083       << std::scientific
00084       << "*************************************************\n"
00085       << "*** Running Tests on ExampleNLPFirstOrder ***\n"
00086       << "*************************************************\n"
00087       << "\nUsing a vector space of type \'" << typeid(vec_space).name() << "\'"
00088       << "\nwith a dimension of vec_space.dim() = " << vec_space.dim()
00089       << std::endl;
00090 
00091   // Create the nlp
00092   ExampleNLPFirstOrder
00093     nlp(VectorSpace::space_ptr_t(&vec_space,false),xo,has_bounds,dep_bounded);
00094 
00095   // Create the solver object and set it up
00096   MoochoSolver solver;
00097   solver.set_nlp(Teuchos::rcp(&nlp,false));                  // Set nlp
00098   // set up outputting
00099   solver.set_error_handling(
00100     throw_solve_exception
00101     ,Teuchos::rcp(error_out,false)
00102     );
00103   solver.set_console_out(Teuchos::rcp(console_out,false));
00104   solver.set_summary_out(Teuchos::rcp(summary_out,false));
00105   solver.set_journal_out(Teuchos::rcp(journal_out,false));
00106   solver.set_algo_out(   Teuchos::rcp(algo_out,false)   );
00107 
00108   // Run MOOCHO using the MamaJama configuration
00109   solve_return = solver.solve_nlp();
00110 
00111   return solve_return;
00112 }

Generated on Thu Sep 18 12:36:38 2008 for MOOCHO by doxygen 1.3.9.1