46 #include "ConstrainedOptPack_QPSolverRelaxedQPOPTSOL.hpp"
47 #include "AbstractLinAlgPack_SpVectorOp.hpp"
48 #include "AbstractLinAlgPack_MatrixSymOp.hpp"
49 #include "AbstractLinAlgPack_EtaVector.hpp"
50 #include "AbstractLinAlgPack_VectorAuxiliaryOps.hpp"
51 #include "AbstractLinAlgPack_SortByDescendingAbsValue.hpp"
52 #include "AbstractLinAlgPack_sparse_bounds.hpp"
53 #include "AbstractLinAlgPack_VectorDenseEncap.hpp"
54 #include "DenseLinAlgPack_LinAlgOpPack.hpp"
55 #include "ProfileHackPack_profile_hack.hpp"
104 namespace LinAlgOpPack {
113 namespace ConstrainedOptPack {
153 ,
const Vector& g,
const MatrixSymOp& G
155 ,
const Vector* dL,
const Vector* dU
157 ,
const Vector* eL,
const Vector* eU
160 ,value_type* eta, VectorMutable* d
162 ,VectorMutable* mu, VectorMutable* Ed
163 ,VectorMutable* lambda, VectorMutable* Fd
170 #ifdef PROFILE_HACK_ENABLED
175 const value_type inf = this->infinite_bound();
186 NCLIN_ = n_inequ_bnds_ + (F ? f->dim() : 0);
193 VectorDenseEncap dL_de(*dL);
200 VectorDenseEncap dU_de(*dU);
209 E!=NULL, std::logic_error
210 ,
"Error, the QPOPT/QPSOL wrapper has not been updated for general inequalities yet!"
273 F!=NULL, std::logic_error
274 ,
"Error, the QPOPT/QPSOL wrapper has not been updated for general equalities yet!"
291 CVEC_(1,n) = VectorDenseEncap(g)();
304 X_(1,n) = VectorDenseEncap(*d)();
323 bool warm_start =
false;
324 if( (nu && nu->nz()) || (mu && mu->nz() ) ) {
327 VectorDenseEncap nu_de(*nu);
328 for(
int i = 1; i <= n; ++i ) {
329 if( nu_de()(i) < 0.0 )
331 else if( nu_de()(i) > 0.0 )
336 mu!=NULL, std::logic_error
337 ,
"Error, the QPOPT/QPSOL wrapper has not been updated for general inequalities yet!"
365 VectorDenseMutableEncap d_de(*d);
374 *obj_d =
OBJ_ - (*eta) * bigM_ - 0.5 * (*eta)*(*eta) * use_as_bigM_;
378 VectorDenseMutableEncap nu_de(*nu);
380 ISTATE_t::const_iterator
381 istate_itr = ISTATE_.begin();
382 DVector::const_iterator
384 for(
size_type i = 1; i <= n; ++i, ++istate_itr, ++clamda_itr ) {
385 const f_int state = *istate_itr;
396 nu_de()(i) = -(*clamda_itr);
409 n_inequ_bnds_!=0, std::logic_error
410 ,
"Error, the QPOPT/QPSOL wrapper has not been updated for general inequalities yet!"
453 F!=NULL, std::logic_error
454 ,
"Error, the QPOPT/QPSOL wrapper has not been updated for general equalities yet!"
497 switch(inform_return) {
498 case STRONG_LOCAL_MIN:
499 solution_type = QPSolverStats::OPTIMAL_SOLUTION;
500 convexity_type = QPSolverStats::CONVEX;
503 solution_type = QPSolverStats::OPTIMAL_SOLUTION;
504 convexity_type = QPSolverStats::NONCONVEX;
506 case MAX_ITER_EXCEEDED:
507 solution_type = QPSolverStats::PRIMAL_FEASIBLE_POINT;
508 convexity_type = QPSolverStats::CONVEXITY_NOT_KNOWN;
511 solution_type = QPSolverStats::SUBOPTIMAL_POINT;
512 convexity_type = QPSolverStats::CONVEXITY_NOT_KNOWN;
516 solution_type, convexity_type
517 ,
ITER_, QPSolverStats::NOT_KNOWN, QPSolverStats::NOT_KNOWN
518 ,warm_start, *eta > 0.0 );
void set_stats(ESolutionType solution_type, EConvexity convexity, int num_qp_iter, int num_adds, int num_drops, bool warm_start, bool infeasible_qp)
Initialize the statistics.
virtual f_int lrwork(f_int N, f_int NCLIN) const =0
Length of real workspace.
ERunTests
Enumeration for if to run internal tests or not.
virtual const MatrixOp * G() const
Return a pointer to the matrix G to be used in the calculation of H*x by QPOPT and QPSOL...
virtual f_int liwork(f_int N, f_int NCLIN) const =0
Length of integer workspace.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
QPSolverRelaxedQPOPTSOL()
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
EConvexity
Enumeration for the type of projected QP on output.
QPSolverStats get_qp_stats() const
virtual EInform call_qp_solver(bool warm_start)=0
Solve the QP defined in the protected input data members and set the solution in the protected output...
~QPSolverRelaxedQPOPTSOL()
void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
size_type num_bounded(const Vector &xl, const Vector &xu, value_type inf_bound)
Class for storing statistics about a run of a (active set?) QP solver.
EOutputLevel
Enumeration for the amount of output to create from solve_qp().
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)
virtual value_type use_as_bigM() const
Return the value of the "big M" used in the relaxation (called by QPHESS functions).
FortranTypes::f_int f_int
ESolutionType
Enumeration for the type of point returned from solve_qp(...).
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
ESolutionType solution_type() const