ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ConstrainedOptPack_QPSolverRelaxedQPKWIK.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef QP_SOLVER_RELAXED_QPKWIK_H
43 #define QP_SOLVER_RELAXED_QPKWIK_H
44 
45 #include <vector>
46 
47 #include "ConstrainedOptPack_QPSolverRelaxed.hpp"
48 #include "DenseLinAlgPack_DVectorClass.hpp"
49 #include "DenseLinAlgPack_DMatrixClass.hpp"
51 #include "Teuchos_F77_wrappers.h"
52 
53 namespace ConstrainedOptPack {
54 
62 {
63 public:
64 
67 
69  STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, max_qp_iter_frac );
70 
72  STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, infinite_bound );
73 
76  value_type max_qp_iter_frac = 10.0
77  ,value_type infinite_bound = 1e+20
78  );
79 
82 
84 
87 
91  void release_memory();
92 
94 
95 protected:
96 
99 
102  std::ostream* out, EOutputLevel olevel, ERunTests test_what
103  ,const Vector& g, const MatrixSymOp& G
104  ,value_type etaL
105  ,const Vector* dL, const Vector* dU
106  ,const MatrixOp* E, BLAS_Cpp::Transp trans_E, const Vector* b
107  ,const Vector* eL, const Vector* eU
108  ,const MatrixOp* F, BLAS_Cpp::Transp trans_F, const Vector* f
109  ,value_type* obj_d
110  ,value_type* eta, VectorMutable* d
111  ,VectorMutable* nu
112  ,VectorMutable* mu, VectorMutable* Ed
113  ,VectorMutable* lambda, VectorMutable* Fd
114  );
115 
117 
118 private:
119 
120  // //////////////////////////////////////////////////////////////
121  // Private types
122 
124  typedef FortranTypes::f_int f_int;
126  typedef std::vector<f_int> IBND_t;
128  typedef std::vector<f_int> IACTSTORE_t;
130  typedef std::vector<f_int> IACT_t;
132  typedef std::vector<f_int> ISTATE_t;
133 
134  // //////////////////////////////////////////////////////////////
135  // Private Data Members.
136 
137  QPSolverStats qp_stats_;
138 
139  // Inverse mapping for IBND_INV(j) == k <-> IBND(k) == j
140  IBND_t IBND_INV_;
141 
142  // Parameters to QPKWIK
143 
145  f_int N_;
147  f_int M1_;
149  f_int M2_;
151  f_int M3_;
153  DVector GRAD_;
155  DMatrix UINV_AUG_;
157  f_int LDUINV_AUG_;
159  IBND_t IBND_;
161  DVector BL_;
163  DVector BU_;
165  DMatrix A_;
167  f_int LDA_;
169  DVector YPY_;
171  f_int IYPY_;
173  f_int WARM_;
175  value_type NUMPARAM_[3];
177  f_int MAX_ITER_;
178 
179  // Input / Output
180 
182  DVector X_;
184  f_int NACTSTORE_;
186  IACTSTORE_t IACTSTORE_;
188  f_int INF_;
189 
190  // Output
191 
193  f_int NACT_;
195  IACT_t IACT_;
197  DVector UR_;
199  value_type EXTRA_;
201  f_int ITER_;
203  f_int NUM_ADDS_;
205  f_int NUM_DROPS_;
206 
207  // Internal state
208 
210  ISTATE_t ISTATE_;
211 
212  // Workspace
213 
215  f_int LRW_;
217  DVector RW_;
218 
219 }; // end class QPSolverRelaxedQPKWIK
220 
221 } // end namespace ConstrainedOptimizationPackTypes
222 
223 #endif // QP_SOLVER_RELAXED_QPKWIK_H
Solves Quadratic Programming (QP) problem using the primal-dual active-set solver QPKWIK...
ERunTests
Enumeration for if to run internal tests or not.
Solves Quadratic Programs (QPs) of several different forms while allowing a relaxation of the constra...
QPSolverStats::ESolutionType imp_solve_qp(std::ostream *out, EOutputLevel olevel, ERunTests test_what, const Vector &g, const MatrixSymOp &G, value_type etaL, const Vector *dL, const Vector *dU, const MatrixOp *E, BLAS_Cpp::Transp trans_E, const Vector *b, const Vector *eL, const Vector *eU, const MatrixOp *F, BLAS_Cpp::Transp trans_F, const Vector *f, value_type *obj_d, value_type *eta, VectorMutable *d, VectorMutable *nu, VectorMutable *mu, VectorMutable *Ed, VectorMutable *lambda, VectorMutable *Fd)
STANDARD_MEMBER_COMPOSITION_MEMBERS(value_type, max_qp_iter_frac)
Set the maximum number of QP iterations as max_itr = max_qp_iter_frac * n.
Class for storing statistics about a run of a (active set?) QP solver.
QPSolverRelaxedQPKWIK(value_type max_qp_iter_frac=10.0, value_type infinite_bound=1e+20)
EOutputLevel
Enumeration for the amount of output to create from solve_qp().
Transp
ESolutionType
Enumeration for the type of point returned from solve_qp(...).