44#ifndef ROL_TYPEB_PRIMALINTERIORPOINTALGORITHM_DEF_HPP
45#define ROL_TYPEB_PRIMALINTERIORPOINTALGORITHM_DEF_HPP
52template<
typename Real>
61 ParameterList& steplist = list.sublist(
"Step").sublist(
"Interior Point");
62 state_->searchSize = steplist.get(
"Initial Barrier Parameter", 1.0);
63 mumin_ = steplist.get(
"Minimum Barrier Parameter", 1e-4);
64 mumax_ = steplist.get(
"Maximum Barrier Parameter", 1e8);
65 rho_ = steplist.get(
"Barrier Penalty Reduction Factor", 0.5);
67 kappaD_ = steplist.get(
"Linear Damping Coefficient", 1.e-4);
68 print_ = steplist.sublist(
"Subproblem").get(
"Print History",
false);
70 gtol_ = steplist.sublist(
"Subproblem").get(
"Initial Optimality Tolerance", 1e-2);
72 int maxit = steplist.sublist(
"Subproblem").get(
"Iteration Limit", 1000);
73 list_.sublist(
"Status Test").set(
"Iteration Limit", maxit);
75 gtolrate_ = steplist.sublist(
"Subproblem").get(
"Optimality Tolerance Reduction Factor", 0.1);
76 mingtol_ =
static_cast<Real
>(1e-2)*list.sublist(
"Status Test").get(
"Gradient Tolerance", 1e-8);
78 stepname_ = steplist.sublist(
"Subproblem").get(
"Step Type",
"Augmented Lagrangian");
81 verbosity_ = list.sublist(
"General").get(
"Output Level", 0);
87template<
typename Real>
93 std::ostream &outStream) {
95 if (
proj_ == nullPtr) {
96 proj_ = makePtr<PolyhedralProjection<Real>>(makePtrFromRef(bnd));
99 proj_->project(x,outStream);
110template<
typename Real>
115 std::ostream &outStream) {
132 proj_->project(pwa,outStream);
140template<
typename Real>
145 std::ostream &outStream ) {
147 Ptr<Vector<Real>> pwa = x.
clone();
153 Ptr<TypeU::Algorithm<Real>> algo;
160 list_.sublist(
"Status Test").set(
"Gradient Tolerance",
gtol_);
161 list_.sublist(
"Status Test").set(
"Step Tolerance",
stol_);
164 *
proj_->getLinearConstraint(),
165 *
proj_->getMultiplier(),
166 *
proj_->getResidual(),outStream);
167 else algo->run(x,g,ipobj,outStream);
169 state_->nfval += algo->getState()->nfval;
170 state_->ngrad += algo->getState()->ngrad;
178 state_->iterateVec->set(x);
202template<
typename Real>
204 std::stringstream hist;
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";
235template<
typename Real>
237 std::stringstream hist;
238 hist << std::endl <<
"Interior Point Solver (Type B, Bound Constraints)";
240 hist <<
"Subproblem Solver: " <<
stepname_ << std::endl;
244template<
typename Real>
246 std::stringstream hist;
247 hist << std::scientific << std::setprecision(6);
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);
Provides the interface to apply upper and lower bound constraints.
virtual void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.
void update(const Vector< Real > &x, UpdateType type, int iter=-1)
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
void updatePenalty(const Real mu)
Real getObjectiveValue(const Vector< Real > &x, Real &tol)
Provides the interface to evaluate objective functions.
Provides an interface to check status of optimization algorithms.
Ptr< PolyhedralProjection< Real > > proj_
void initialize(const Vector< Real > &x, const Vector< Real > &g)
Algorithm()
Constructor, given a step and a status test.
virtual void writeExitStatus(std::ostream &os) const
const Ptr< AlgorithmState< Real > > state_
const Ptr< CombinedStatusTest< Real > > status_
void writeName(std::ostream &os) const override
Print step name.
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...
void updateState(const Vector< Real > &x, InteriorPointObjective< Real > &ipobj, BoundConstraint< Real > &bnd, Vector< Real > &pwa, std::ostream &outStream=std::cout)
void initialize(Vector< Real > &x, const Vector< Real > &g, InteriorPointObjective< Real > &ipobj, BoundConstraint< Real > &bnd, Vector< Real > &pwa, std::ostream &outStream=std::cout)
InteriorPointAlgorithm(ParameterList &list)
void writeOutput(std::ostream &os, bool write_header=false) const override
Print iterate status.
void writeHeader(std::ostream &os) const override
Print iterate header.
Defines the linear algebra or vector space interface.
virtual Real norm() const =0
Returns where .
virtual void set(const Vector &x)
Set where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Ptr< Algorithm< Real > > AlgorithmFactory(ParameterList &parlist)
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.