ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
ConstrainedOptPack_QPSolverRelaxedQPOPTSOL.hpp
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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef QP_SOLVER_RELAXED_QPOPTSOL_H
00043 #define QP_SOLVER_RELAXED_QPOPTSOL_H
00044 
00045 #include <vector>
00046 
00047 #include "ConstrainedOptPack_QPSolverRelaxed.hpp"
00048 #include "DenseLinAlgPack_DVectorClass.hpp"
00049 #include "DenseLinAlgPack_DMatrixClass.hpp"
00050 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00051 
00052 namespace ConstrainedOptPack {
00053 
00060 class QPSolverRelaxedQPOPTSOL : public QPSolverRelaxed
00061 {
00062 public:
00063 
00064   // /////////////////////////////////////
00067 
00069   typedef FortranTypes::f_int       f_int;
00071   typedef FortranTypes::f_dbl_prec  f_dbl_prec;
00073   typedef FortranTypes::f_logical   f_logical;
00074 
00076 
00078   QPSolverRelaxedQPOPTSOL();
00079 
00081   ~QPSolverRelaxedQPOPTSOL();
00082 
00084   virtual const MatrixOp* G() const;
00085 
00087   virtual value_type use_as_bigM() const;
00088 
00089   // /////////////////////////////////
00090   // Overridden from QPSolverRelaxed
00091 
00093   QPSolverStats get_qp_stats() const;
00094 
00096   void release_memory();
00097 
00098 protected:
00099 
00100   // /////////////////////////////////
00101   // Overridden from QPSolverRelaxed
00102 
00104   QPSolverStats::ESolutionType imp_solve_qp(
00105     std::ostream* out, EOutputLevel olevel, ERunTests test_what
00106     ,const Vector& g, const MatrixSymOp& G
00107     ,value_type etaL
00108     ,const Vector* dL, const Vector* dU
00109     ,const MatrixOp* E, BLAS_Cpp::Transp trans_E, const Vector* b
00110     ,const Vector* eL, const Vector* eU
00111     ,const MatrixOp* F, BLAS_Cpp::Transp trans_F, const Vector* f
00112     ,value_type* obj_d
00113     ,value_type* eta, VectorMutable* d
00114     ,VectorMutable* nu
00115     ,VectorMutable* mu, VectorMutable* Ed
00116     ,VectorMutable* lambda, VectorMutable* Fd
00117     );
00118 
00119   // //////////////////////////////////////////////////////////////
00120   // Protected types
00121 
00123   typedef std::vector<f_int>      ISTATE_t;
00125   typedef std::vector<f_int>      IWORK_t;
00127   typedef std::vector<f_dbl_prec>   WORK_t;
00128 public: // RAB: 2001/05/03: MS VC++ 6.0 must have this public ???
00130   enum EInform {
00131     STRONG_LOCAL_MIN,
00132     WEAK_LOCAL_MIN,
00133     MAX_ITER_EXCEEDED,
00134     OTHER_ERROR
00135   };
00136 
00137 protected:
00138 
00139   // //////////////////////////////////////////////////////////////
00140   // Protected Data Members.
00141 
00142   QPSolverStats     qp_stats_;
00143 
00150 
00152   f_int   N_;
00154   f_int   NCLIN_;
00156   DMatrix A_;
00158   DVector   BL_;
00160   DVector   BU_;
00162   DVector   CVEC_;
00164   ISTATE_t  ISTATE_;
00166   DVector   X_;
00168   DVector   AX_;
00170   DVector   CLAMDA_;
00172   f_int   ITER_;
00174   f_dbl_prec  OBJ_;
00176   f_int   LIWORK_;
00178   IWORK_t   IWORK_;
00180   f_int   LWORK_;
00182   WORK_t    WORK_;
00183 
00185 
00186   // /////////////////////////////////////////////////////////////
00187   // Template method primatives to be overridden.
00188 
00190   virtual f_int liwork(f_int N, f_int NCLIN) const = 0;
00191 
00193   virtual f_int lrwork(f_int N, f_int NCLIN) const = 0;
00194 
00198   virtual EInform call_qp_solver(bool warm_start) = 0;
00199 
00200 private:
00201 
00202   // /////////////////////////
00203   // Private types
00204 
00205   typedef std::vector<f_int>  ibnds_t;
00206 
00207   // ///////////////////////////
00208   // Private data members
00209 
00210   size_type     n_inequ_bnds_;    // Used to record the number of bounds with at least
00211                       // one bound existing in eL and eU.
00212   ibnds_t       i_inequ_bnds_;    // size(nbounds_). Remembers which bounds in
00213                       // eL, eU had at least one bound present.  This is
00214                       // needed to map from CLAMDA_ to mu.
00215   value_type      bigM_;        // Big M value used to construct relaxation.
00216   value_type      use_as_bigM_;   // Big M value used in QPHESS.
00217   const MatrixOp* G_;         // used to compute HESS * x = [ G, 0; 0, bigM ] * x products.
00218 
00219   // ///////////////////////////
00220   // Private member functions
00221 
00222   // not defined and not to be called.
00223   QPSolverRelaxedQPOPTSOL(const QPSolverRelaxedQPOPTSOL&);
00224   QPSolverRelaxedQPOPTSOL& operator=(const QPSolverRelaxedQPOPTSOL&);
00225 
00226 };  // end class QPSolverRelaxedQPOPTSOL
00227 
00228 } // end namespace ConstrainedOptimizationPackTypes
00229 
00230 #endif  // QP_SOLVER_RELAXED_QPOPTSOL_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends