3 #include "modeling.hpp"
4 #include <boost/function.hpp>
17 OPT_SCO_ITERATION_LIMIT,
18 OPT_PENALTY_ITERATION_LIMIT,
22 static const char* OptStatus_strings[] = {
24 "SCO_ITERATION_LIMIT",
25 "PENALTY_ITERATION_LIMIT",
29 inline string statusToString(OptStatus status) {
30 return OptStatus_strings[status];
38 vector<double> cost_vals;
40 int n_func_evals, n_qp_solves;
51 std::ostream& operator<<(std::ostream& o,
const OptResults& r);
58 virtual OptStatus optimize() = 0;
60 virtual void setProblem(OptProbPtr prob) {prob_ = prob;}
61 void initialize(
const vector<double>& x);
62 vector<double>& x() {
return results_.x;}
65 typedef boost::function<void(OptProb*, DblVec&)> Callback;
66 void addCallback(
const Callback& f);
68 vector<Callback> callbacks_;
69 void callCallbacks(DblVec& x);
84 double improve_ratio_threshold_,
87 min_approx_improve_frac_,
92 max_merit_coeff_increases_,
93 merit_coeff_increase_ratio_,
96 double merit_error_coeff_,
102 void setProblem(OptProbPtr prob);
103 OptStatus optimize();
105 void adjustTrustRegion(
double ratio);
106 void setTrustBoxConstraints(
const vector<double>& x);
107 void initParameters();