59 #define min(a,b) ( (a < b) ? a : b )
60 #define max(a,b) ( (a > b) ? a : b )
62 namespace MoochoPack {
73 init_barrier_parameter_(init_barrier_parameter),
76 tau_epsilon_(tau_epsilon),
77 theta_epsilon_(theta_epsilon),
92 NLP &nlp = algo.nlp();
94 if (!nlp.is_initialized())
96 nlp.initialize(
false);
113 IterQuantityAccess<value_type>& e_tol_iq = s.e_tol();
114 IterQuantityAccess<value_type>& mu_iq = s.barrier_parameter();
135 const value_type opt_err = s.opt_kkt_err().get_k(0);
136 const value_type feas_err = s.feas_kkt_err().get_k(0);
137 const value_type comp_err_mu = s.comp_err_mu().get_k(0);
140 if (e_tol_iq.last_updated() == IterQuantity::NONE_UPDATED)
148 const value_type e_tol_km1 = e_tol_iq.get_k(-1);
149 bool sub_prob_converged = (opt_err < e_tol_km1 && feas_err < e_tol_km1 && comp_err_mu < e_tol_km1);
150 if (sub_prob_converged)
154 mu_k =
min(tau_mu_*mu_km1,
pow(mu_km1, theta_mu_));
159 out <<
"\nSub-problem converged!\n"
160 <<
" Updating barrier parameter (mu) and sub problem tolerance (e_tol) ...\n";
167 out <<
"\nSub-problem not-converged!\n"
168 <<
" Keeping existing barrier parameter (mu) and sub problem tolerance (e_tol) ...\n";
171 e_tol_iq.set_k(0,-1);
177 out <<
"\nbarrier_parameter (mu) = " << mu_iq.get_k(0)
178 <<
"\nsub problem tolerance (e_tol) = " << e_tol_iq.get_k(0) << std::endl;
188 ,
poss_type assoc_step_poss, std::ostream&
out,
const std::string& L
193 out << L <<
"# Update the interior point barrier parameter (mu)\n"
194 << L <<
"if (KKTerror < e_tol) then\n"
195 << L <<
" mu_kp1 = min(tau_mu*mu_k, mu_k^theta_mu)\n"
196 << L <<
" e_tol_kp1 = min(e_tol_max, tau_epsilon*min(mu_k, mu_k^theta_epsilon))\n"
198 << L <<
" mu_kp1 = mu_k\n"
199 << L <<
" e_tol_kp1 = e_tol_k\n"
206 e_tol =
min(e_tol_max_, e_tol);
214 const int local_num_options = 5;
225 const char* local_SOptions[local_num_options] =
239 ,
const char opt_grp_name[] )
241 OptionsFromStreamPack::SetOptionsFromStreamNode(
242 opt_grp_name, local_num_options, local_SOptions ),
256 target().tau_mu(std::atof(option_value.c_str()));
259 target().theta_mu(std::atof(option_value.c_str()));
262 target().tau_epsilon(std::atof(option_value.c_str()));
265 target().theta_epsilon(std::atof(option_value.c_str()));
268 target().e_tol_max(std::atof(option_value.c_str()));
UpdateBarrierParameter_Step(const value_type init_barrier_parameter=0.1, const value_type tau_mu=0.2, const value_type theta_mu=1.5, const value_type tau_epsilon=10, const value_type theta_epsilon=1.1, const value_type e_tol_max=1000)
Constructor.
void pow(DVectorSlice *vs_lhs, const DVectorSlice &vs_rhs1, const DVectorSlice &vs_rhs2)
vs_lhs = pow(vs_rhs1,vs_rhs2)
bool StringToBool(const char *opt_name, const char *str)
Convert a string "true" or "false" into bool #true# or #false#.
value_type Calculate_e_tol(value_type mu)
rSQP Algorithm control class.
void print_step(const IterationPack::Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss, std::ostream &out, const std::string &leading_str) const
Called by Algorithm::print_algorithm() to print out what this step does in Matlab like format...
UpdateBarrierParameter_Step & target()
Barrier Parameter (mu) Update.
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
virtual std::ostream & journal_out() const
Return a reference to a std::ostream to be used to output debug information and the like...
EJournalOutputLevel
enum for journal output.
T_To & dyn_cast(T_From &from)
void print_algorithm_step(const Algorithm &algo, Algorithm::poss_type step_poss, EDoStepType type, Algorithm::poss_type assoc_step_poss, std::ostream &out)
Prints to 'out' the algorithm step.
AlgorithmTracker & track()
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.
UpdateBarrierParameter_StepSetOptions(UpdateBarrierParameter_Step *target=0, const char opt_grp_name[]="UpdateBarrierParameter")
AbstractLinAlgPack::value_type value_type
Acts as the central hub for an iterative algorithm.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
const std::string & option_value(OptionsGroup::const_iterator &itr)