44 #ifndef ROL_OPTIMIZATIONSOLVER_HPP
45 #define ROL_OPTIMIZATIONSOLVER_HPP
64 ROL::Ptr<Algorithm<Real> >
algo_;
67 ROL::Ptr<CombinedStatusTest<Real> >
status_;
68 ROL::Ptr<AlgorithmState<Real> >
state_;
70 ROL::Ptr<Vector<Real> >
x_;
71 ROL::Ptr<Vector<Real> >
g_;
72 ROL::Ptr<Vector<Real> >
l_;
73 ROL::Ptr<Vector<Real> >
c_;
75 ROL::Ptr<Objective<Real> >
obj_;
76 ROL::Ptr<BoundConstraint<Real> >
bnd_;
77 ROL::Ptr<Constraint<Real> >
con_;
97 ROL::ParameterList &parlist ) {
103 state_ = ROL::makePtr<AlgorithmState<Real>>();
106 stepname_ = parlist.sublist(
"Step").get(
"Type",
"Last Type (Dummy)");
130 status_ = ROL::makePtr<CombinedStatusTest<Real>>();
134 g_ = x_->dual().clone();
143 c_ =
l_->dual().clone();
147 const Real one(1), ten(10);
149 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
152 obj_ = ROL::makePtr<AugmentedLagrangian<Real>>(raw_obj,
con_,*
l_,1.0,*
x_,*
c_,parlist);
154 pen_ = parlist.sublist(
"Step").sublist(
"Augmented Lagrangian").get(
"Initial Penalty Parameter",ten);
157 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
161 obj_ = ROL::makePtr<MoreauYosidaPenalty<Real>>(raw_obj,
bnd_,*
x_,parlist);
162 pen_ = parlist.sublist(
"Step").sublist(
"Moreau-Yosida Penalty").get(
"Initial Penalty Parameter",ten);
165 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
169 obj_ = ROL::makePtr<InteriorPoint::PenalizedObjective<Real>>(raw_obj,
bnd_,*
x_,parlist);
170 pen_ = parlist.sublist(
"Step").sublist(
"Interior Point").get(
"Initial Barrier Parameter",ten);
173 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
176 if(
bnd_->isActivated() ) {
177 obj_ = ROL::makePtr<BoundFletcher<Real> >(raw_obj,
con_,
bnd_,*
x_,*
c_,parlist);
180 obj_ = ROL::makePtr<Fletcher<Real> >(raw_obj,
con_,*
x_,*
c_,parlist);
182 pen_ = parlist.sublist(
"Step").sublist(
"Fletcher").get(
"Penalty Parameter",one);
189 pen_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Initial Radius",ten);
192 pen_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Initial Trust-Region Parameter",ten);
213 const bool combineStatus =
true) {
215 return solve(bhs,status,combineStatus);
228 const bool combineStatus =
true ) {
232 if (status != ROL::nullPtr) {
233 if (!combineStatus) {
254 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
255 "Error in OptimizationSolver::solve() : Unsupported problem type");
281 state_ = ROL::makePtr<AlgorithmState<Real>>();
295 void reset(
const bool resetAlgo =
true) {
304 ROL::dynamicPtrCast<AugmentedLagrangian<Real> >(
obj_)->
reset(*
l_,
pen_);
307 ROL::dynamicPtrCast<MoreauYosidaPenalty<Real> >(
obj_)->
reset(
pen_);
310 ROL::dynamicPtrCast<InteriorPoint::PenalizedObjective<Real> >(
obj_)->updatePenalty(
pen_);
330 #endif // ROL_OPTIMIZATIONSOLVER_HPP
ROL::Ptr< BoundConstraint< Real > > bnd_
ROL::Ptr< Objective< Real > > obj_
ROL::Ptr< StatusTest< Real > > getStatusTest(const std::string step, ROL::ParameterList &parlist)
EStep StringToEStep(std::string s)
ROL::Ptr< StatusTest< Real > > status0_
void stepFactory(ROL::ParameterList &parlist, ROL::Ptr< ROL::Step< Real > > &step)
A minimalist step factory which specializes the Step Type depending on whether a Trust-Region or Line...
ROL::Ptr< Step< Real > > getStep(const std::string &type, ROL::ParameterList &parlist) const
virtual Ptr< Objective< Real > > getObjective(void)
std::vector< std::string > output_
virtual Ptr< BoundConstraint< Real > > getBoundConstraint(void)
ROL::Ptr< Vector< Real > > c_
int solve(std::ostream &outStream, const ROL::Ptr< StatusTest< Real > > &status=ROL::nullPtr, const bool combineStatus=true)
Solve optimization problem.
ROL::Ptr< Step< Real > > step_
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
ROL::Ptr< Vector< Real > > g_
ROL::Ptr< CombinedStatusTest< Real > > status_
ROL::Ptr< Constraint< Real > > con_
std::vector< std::string > getOutput(void) const
Returns iteration history as a vector of strings.
void reset(const bool resetAlgo=true)
Reset both Algorithm and Step.
virtual Ptr< Vector< Real > > getSolutionVector(void)
Provides an interface to check status of optimization algorithms.
virtual Ptr< Vector< Real > > getMultiplierVector(void)
EProblem getProblemType(void)
ROL::Ptr< Algorithm< Real > > algo_
Provides a simplified interface for solving a wide range of optimization problems.
ROL::Ptr< Vector< Real > > x_
std::string getStepName(void) const
Grab step name (after check for consistency).
basic_nullstream< char, char_traits< char >> nullstream
void resetAlgorithmState(void)
Reset the AlgorithmState.
ROL::Ptr< Vector< Real > > l_
int solve(const ROL::Ptr< StatusTest< Real > > &status=ROL::nullPtr, const bool combineStatus=true)
Solve optimization problem with no iteration output.
std::string EStepToString(EStep tr)
EStep
Enumeration of step types.
ROL::Ptr< AlgorithmState< Real > > state_
OptimizationSolver(OptimizationProblem< Real > &opt, ROL::ParameterList &parlist)
Constructor.
ROL::Ptr< const AlgorithmState< Real > > getAlgorithmState(void) const
Return the AlgorithmState.
virtual Ptr< Constraint< Real > > getConstraint(void)
bool isCompatibleStep(EProblem p, EStep s)