ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
ConstrainedOptPack_QPSolverRelaxedQPKWIK.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_QPKWIK_H
00043 #define QP_SOLVER_RELAXED_QPKWIK_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 #include "Teuchos_F77_wrappers.h"
00052 
00053 namespace ConstrainedOptPack {
00054 
00061 class QPSolverRelaxedQPKWIK : public QPSolverRelaxed
00062 {
00063 public:
00064 
00067 
00069   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, max_qp_iter_frac );
00070 
00072   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, infinite_bound );
00073 
00075   QPSolverRelaxedQPKWIK(
00076       value_type        max_qp_iter_frac  = 10.0
00077       ,value_type       infinite_bound      = 1e+20
00078     );
00079 
00081   ~QPSolverRelaxedQPKWIK();
00082 
00084 
00087 
00089   QPSolverStats get_qp_stats() const;
00091   void release_memory();
00092 
00094 
00095 protected:
00096 
00099 
00101   QPSolverStats::ESolutionType imp_solve_qp(
00102     std::ostream* out, EOutputLevel olevel, ERunTests test_what
00103     ,const Vector& g, const MatrixSymOp& G
00104     ,value_type etaL
00105     ,const Vector* dL, const Vector* dU
00106     ,const MatrixOp* E, BLAS_Cpp::Transp trans_E, const Vector* b
00107     ,const Vector* eL, const Vector* eU
00108     ,const MatrixOp* F, BLAS_Cpp::Transp trans_F, const Vector* f
00109     ,value_type* obj_d
00110     ,value_type* eta, VectorMutable* d
00111     ,VectorMutable* nu
00112     ,VectorMutable* mu, VectorMutable* Ed
00113     ,VectorMutable* lambda, VectorMutable* Fd
00114     );
00115 
00117 
00118 private:
00119 
00120   // //////////////////////////////////////////////////////////////
00121   // Private types
00122 
00124   typedef FortranTypes::f_int f_int;
00126   typedef std::vector<f_int>  IBND_t;
00128   typedef std::vector<f_int>  IACTSTORE_t;
00130   typedef std::vector<f_int>  IACT_t;
00132   typedef std::vector<f_int>  ISTATE_t;
00133 
00134   // //////////////////////////////////////////////////////////////
00135   // Private Data Members.
00136 
00137   QPSolverStats   qp_stats_;
00138 
00139   // Inverse mapping for IBND_INV(j) == k <-> IBND(k) == j
00140   IBND_t          IBND_INV_;
00141 
00142   // Parameters to QPKWIK
00143 
00145   f_int      N_;
00147   f_int      M1_;
00149   f_int      M2_;
00151   f_int      M3_;
00153   DVector          GRAD_;
00155   DMatrix       UINV_AUG_;
00157   f_int      LDUINV_AUG_;
00159   IBND_t          IBND_;
00161   DVector          BL_;
00163   DVector          BU_;
00165   DMatrix       A_;
00167   f_int   LDA_;
00169   DVector          YPY_;
00171   f_int      IYPY_;
00173   f_int      WARM_;
00175   value_type      NUMPARAM_[3];
00177   f_int      MAX_ITER_;
00178 
00179   // Input / Output
00180 
00182   DVector          X_;
00184   f_int      NACTSTORE_;
00186   IACTSTORE_t     IACTSTORE_;
00188   f_int      INF_;
00189   
00190   // Output
00191 
00193   f_int      NACT_;
00195   IACT_t          IACT_;
00197   DVector          UR_;
00199   value_type      EXTRA_;
00201   f_int      ITER_;
00203   f_int      NUM_ADDS_;
00205   f_int      NUM_DROPS_;
00206   
00207   // Internal state
00208 
00210   ISTATE_t        ISTATE_;
00211 
00212   // Workspace
00213 
00215   f_int      LRW_;
00217   DVector          RW_;
00218 
00219 }; // end class QPSolverRelaxedQPKWIK
00220 
00221 } // end namespace ConstrainedOptimizationPackTypes
00222 
00223 #endif // QP_SOLVER_RELAXED_QPKWIK_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends