47 #include "MoochoPack_get_init_fixed_free_indep.hpp"
48 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
49 #include "AbstractLinAlgPack_SpVectorOp.hpp"
51 void MoochoPack::get_init_fixed_free_indep(
54 ,
const SpVectorSlice &nu_indep
55 ,
const value_type super_basic_mult_drop_tol
56 ,EJournalOutputLevel olevel
62 ,ConstrainedOptPack::EBounds bnd_fixed[]
68 using AbstractLinAlgPack::norm_inf;
74 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
75 out <<
"\nDetermining which fixed variables to remove from rHL to form rHL_RR (can remove all but one)...\n";
78 max_nu_indep = norm_inf(nu_indep);
80 all_fixed = n_pz == nu_indep.nz();
81 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
82 out <<
"\nmax{|nu_k(indep)|,i=r+1...n} = " << max_nu_indep << std::endl;
84 if( super_basic_mult_drop_tol > 1.0 ) {
85 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
86 out <<
"super_basic_mult_drop_tol = " << super_basic_mult_drop_tol <<
" > 1"
87 <<
"\nNo variables will be removed from the super basis! (You might consider decreasing super_basic_mult_drop_tol < 1)\n";
91 const int prec = out.precision();
92 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ACTIVE_SET) ) {
94 << right << setw(10) <<
"i"
95 << right << setw(prec+12) <<
"nu(i)"
96 << right << setw(8) <<
"status"
98 << right << setw(10) <<
"--------"
99 << right << setw(prec+12) <<
"--------"
100 << right << setw(8) <<
"------"
103 SpVector::const_iterator
104 nu_itr = nu_indep.begin(),
105 nu_end = nu_indep.end();
106 SpVector::difference_type
107 nu_o = nu_indep.offset();
109 *i_x_free_itr = i_x_free,
110 *i_x_fixed_itr = i_x_fixed;
111 ConstrainedOptPack::EBounds
112 *bnd_fixed_itr = bnd_fixed;
115 bool kept_one =
false;
116 {
for(
size_type i_indep = 1; i_indep <= n_pz; ++i_indep ) {
117 if( nu_itr != nu_end && (nu_itr->indice() + nu_o) == i_indep ) {
119 abs_val = ::fabs(nu_itr->value()),
120 rel_val = abs_val / max_nu_indep;
122 keep = ( (all_fixed && abs_val == max_nu_indep && !kept_one)
123 || rel_val < super_basic_mult_drop_tol );
124 if( static_cast<int>(olevel) >=
static_cast<int>(PRINT_ACTIVE_SET) ) {
125 out << right << setw(10) << i_indep + r
126 << right << setw(prec+12) << nu_itr->value()
127 << right << setw(8) << (keep ?
"keep" :
"drop")
131 *i_x_fixed_itr++ = i_indep;
132 namespace COP = ConstrainedOptPack;
134 = ( nu_itr->value() > 0.0 ? COP::UPPER : COP::LOWER );
144 *i_x_free_itr++ = i_indep;
150 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
151 out <<
"\nRemoving n_pz_X = " << (*n_pz_X) <<
" from the superbasic set and keeping n_pz_R = " << (*n_pz_R) << std::endl;
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)