145 std::ostream &outStream ) {
147 Ptr<Vector<Real>> pwa = x.
clone();
150 x,g,useLinearDamping_,kappaD_,
152 initialize(x,g,ipobj,bnd,*pwa,outStream);
153 Ptr<TypeU::Algorithm<Real>> algo;
156 if (verbosity_ > 0) writeOutput(outStream,
true);
158 while (status_->check(*state_)) {
160 list_.sublist(
"Status Test").set(
"Gradient Tolerance", gtol_);
161 list_.sublist(
"Status Test").set(
"Step Tolerance", stol_);
162 algo = TypeU::AlgorithmFactory<Real>(list_);
163 if (hasPolyProj_) algo->run(x,g,ipobj,
164 *proj_->getLinearConstraint(),
165 *proj_->getMultiplier(),
166 *proj_->getResidual(),outStream);
167 else algo->run(x,g,ipobj,outStream);
168 subproblemIter_ = algo->getState()->iter;
169 state_->nfval += algo->getState()->nfval;
170 state_->ngrad += algo->getState()->ngrad;
173 state_->stepVec->set(x);
174 state_->stepVec->axpy(-one,*state_->iterateVec);
175 state_->snorm = state_->stepVec->norm();
178 state_->iterateVec->set(x);
185 if( (rho_< one && state_->searchSize > mumin_) || (rho_ > one && state_->searchSize < mumax_) ) {
186 state_->searchSize *= rho_;
189 gtol_ *= gtolrate_; gtol_ = std::max(gtol_,mingtol_);
190 stol_ =
static_cast<Real
>(1e-6)*gtol_;
194 updateState(x,ipobj,bnd,*pwa,outStream);
197 if (verbosity_ > 0) writeOutput(outStream,writeHeader_);
204 std::stringstream hist;
205 if (verbosity_ > 1) {
206 hist << std::string(109,
'-') << std::endl;
207 hist <<
"Interior Point Solver";
208 hist <<
" status output definitions" << std::endl << std::endl;
209 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
210 hist <<
" fval - Objective function value" << std::endl;
211 hist <<
" gnorm - Norm of the gradient" << std::endl;
212 hist <<
" snorm - Norm of the step (update to optimization vector)" << std::endl;
213 hist <<
" penalty - Penalty parameter for bound constraints" << std::endl;
214 hist <<
" #fval - Cumulative number of times the objective function was evaluated" << std::endl;
215 hist <<
" #grad - Cumulative number of times the gradient was computed" << std::endl;
216 hist <<
" optTol - Subproblem optimality tolerance" << std::endl;
217 hist <<
" subiter - Number of subproblem iterations" << std::endl;
218 hist << std::string(109,
'-') << std::endl;
222 hist << std::setw(6) << std::left <<
"iter";
223 hist << std::setw(15) << std::left <<
"fval";
224 hist << std::setw(15) << std::left <<
"gnorm";
225 hist << std::setw(15) << std::left <<
"snorm";
226 hist << std::setw(10) << std::left <<
"penalty";
227 hist << std::setw(8) << std::left <<
"#fval";
228 hist << std::setw(8) << std::left <<
"#grad";
229 hist << std::setw(10) << std::left <<
"optTol";
230 hist << std::setw(8) << std::left <<
"subIter";
246 std::stringstream hist;
247 hist << std::scientific << std::setprecision(6);
248 if ( state_->iter == 0 ) writeName(os);
249 if ( write_header ) writeHeader(os);
250 if ( state_->iter == 0 ) {
252 hist << std::setw(6) << std::left << state_->iter;
253 hist << std::setw(15) << std::left << state_->value;
254 hist << std::setw(15) << std::left << state_->gnorm;
255 hist << std::setw(15) << std::left <<
"---";
256 hist << std::scientific << std::setprecision(2);
257 hist << std::setw(10) << std::left << state_->searchSize;
258 hist << std::setw(8) << std::left << state_->nfval;
259 hist << std::setw(8) << std::left << state_->ngrad;
260 hist << std::setw(10) << std::left <<
"---";
261 hist << std::setw(8) << std::left <<
"---";
266 hist << std::setw(6) << std::left << state_->iter;
267 hist << std::setw(15) << std::left << state_->value;
268 hist << std::setw(15) << std::left << state_->gnorm;
269 hist << std::setw(15) << std::left << state_->snorm;
270 hist << std::scientific << std::setprecision(2);
271 hist << std::setw(10) << std::left << state_->searchSize;
272 hist << std::scientific << std::setprecision(6);
273 hist << std::setw(8) << std::left << state_->nfval;
274 hist << std::setw(8) << std::left << state_->ngrad;
275 hist << std::scientific << std::setprecision(2);
276 hist << std::setw(10) << std::left << gtol_;
277 hist << std::scientific << std::setprecision(6);
278 hist << std::setw(8) << std::left << subproblemIter_;
void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, std::ostream &outStream=std::cout) override
Run algorithm on bound constrained problems (Type-B). This general interface supports the use of dual...