49 namespace ConstrainedOptPack {
50 namespace QPSchurPack {
71 ,
const MatrixSymOpNonsing &Ko
78 ,
bool print_all_warnings
81 namespace GPMSTP = AbstractLinAlgPack::GenPermMatrixSliceIteratorPack;
84 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
85 "constraints == NULL is not allowed." );
92 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
93 "n_R > constraints->n() is not allowed." );
95 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
96 "g.dim() != constraints->n()." );
97 if(G.rows() != n || G.cols() !=
n)
98 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
99 "G.rows() != constraints->n() or G.cols() != constraints->n()." );
105 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
106 "A->rows() != constraints->n()." );
109 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
110 "b_X.dim() != constraints->n() - n_R." );
111 if(Ko.rows() != n_R+m || Ko.cols() != n_R+
m)
112 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
113 "Ko.rows() != n_R+A->cols() or Ko.cols() != n_R+A->cols()." );
114 if(fo.dim() != n_R+
m)
115 throw std::invalid_argument(
"QPInitFixedFreeStd::initialize(...) : Error, "
116 "fo.dim() != n_R+A->cols()." );
120 const int NOT_SET_YET = -9999;
129 if( i_x_free == NULL ) {
135 for(
const size_type *i_x_R = i_x_free; i_x_R != i_x_free +
n_R; ++i_x_R ) {
136 if( *i_x_R < 1 || *i_x_R > n ) {
137 std::ostringstream omsg;
139 <<
"QPInitFixedFreeStd::initialize(...) : Error, "
140 <<
"i_x_free[" << i_x_R-i_x_free <<
"] = "
141 << (*i_x_R) <<
" is out of bounds";
142 throw std::invalid_argument( omsg.str() );
144 if(
x_init_(*i_x_R) != NOT_SET_YET ) {
145 std::ostringstream omsg;
147 <<
"QPInitFixedFreeStd::initialize(...) : Error, "
148 <<
"Duplicate entries for i_x_free[i] = "
150 throw std::invalid_argument( omsg.str() );
156 for(
const size_type *i_x_R = i_x_free; i_x_R != i_x_free +
n_R; ++i_x_R ) {
168 i_x_X_map_t::iterator
171 for(
size_type l = 1; l <= n_X; ++l, ++i_x_X, ++bnd, ++i_x_X_map_itr ) {
172 if( *i_x_X < 1 || *i_x_X > n ) {
173 std::ostringstream omsg;
175 <<
"QPInitFixedFreeStd::initialize(...) : Error, "
176 <<
"i_x_fixed[" << i_x_X-i_x_fixed <<
"] = "
177 << (*i_x_X) <<
" is out of bounds";
178 throw std::invalid_argument( omsg.str() );
181 std::ostringstream omsg;
183 <<
"QPInitFixedFreeStd::initialize(...) : Error, "
184 <<
"bnd_fixed[" << l-1 <<
"] can not equal FREE";
185 throw std::invalid_argument( omsg.str() );
187 if(
x_init_(*i_x_X) != NOT_SET_YET ) {
188 std::ostringstream omsg;
190 <<
"QPInitFixedFreeStd::initialize(...) : Error, "
191 <<
"Duplicate entries for i_x_fixed[i] = "
193 throw std::invalid_argument( omsg.str() );
197 *i_x_X_map_itr = *i_x_X;
201 if(
x_init_(i) == NOT_SET_YET ) {
202 std::ostringstream omsg;
204 <<
"QPInitFixedFreeStd::initialize(...) : Error, "
205 <<
"x_init(" << i <<
") has not been set by"
206 " i_x_free[] or i_x_fixed[].";
207 throw std::invalid_argument( omsg.str() );
212 for(
size_type l = 1; l <= n_X; ++l, ++i_x_X, ++bnd, ++i_x_X_map_itr ) {
215 *i_x_X_map_itr = *i_x_X;
226 n_R,n_X,i_x_free,i_x_fixed,test_setup
239 g_.bind(const_cast<DVectorSlice&>(g));
242 b_X_.bind(const_cast<DVectorSlice&>(b_X));
244 fo_.bind(const_cast<DVectorSlice&>(fo));
351 throw std::logic_error(
"QPInitFixedFreeStd::assert_initialized(), Error "
352 "object not initialized\n" );
Constraints & constraints()
AbstractLinAlgPack::size_type size_type
const x_init_t & x_init() const
const MatrixSymOpNonsing & Ko() const
const MatrixSymOpNonsing * Ko_
void assert_initialized() const
void initialize(const DVectorSlice &g, const MatrixSymOp &G, const MatrixOp *A, size_type n_R, const size_type i_x_free[], const size_type i_x_fixed[], const EBounds bnd_fixed[], const DVectorSlice &b_X, const MatrixSymOpNonsing &Ko, const DVectorSlice &fo, Constraints *constraints, std::ostream *out=NULL, bool test_setup=false, value_type warning_tol=1e-10, value_type error_tol=1e-5, bool print_all_warnings=false)
Initialize.
const GenPermMatrixSlice & Q_X() const
const DVectorSlice g() const
const MatrixSymOp & G() const
const l_x_X_map_t & l_x_X_map() const
const MatrixOp & A() const
const DVectorSlice fo() const
void initialize_Q_R_Q_X(size_type n_R, size_type n_X, const size_type i_x_free[], const size_type i_x_fixed[], bool test_setup, size_type Q_R_row_i[], size_type Q_R_col_j[], GenPermMatrixSlice *Q_R, size_type Q_X_row_i[], size_type Q_X_col_j[], GenPermMatrixSlice *Q_X)
Initialize GenPermMatrixSlice mapping matrices for Q_R and Q_X.
Constraints * constraints_
QPInitFixedFreeStd()
Construct uninitialized.
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
AbstractLinAlgPack::value_type value_type
const GenPermMatrixSlice & Q_R() const
Utility class for a ranged check vector.
virtual size_type n() const =0
Represents the extra constraints in the QP to be satisfied by the schur complement QP solver QPSchur ...
const DVectorSlice b_X() const
const i_x_X_map_t & i_x_X_map() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)