44 #ifndef ROL_OPTIMIZATIONSOLVER_HPP
45 #define ROL_OPTIMIZATIONSOLVER_HPP
66 ROL::Ptr<Algorithm<Real> >
algo_;
69 ROL::Ptr<CombinedStatusTest<Real> >
status_;
70 ROL::Ptr<AlgorithmState<Real> >
state_;
72 ROL::Ptr<Vector<Real> >
x_;
73 ROL::Ptr<Vector<Real> >
g_;
74 ROL::Ptr<Vector<Real> >
l_;
75 ROL::Ptr<Vector<Real> >
c_;
77 ROL::Ptr<Objective<Real> >
obj_;
78 ROL::Ptr<BoundConstraint<Real> >
bnd_;
79 ROL::Ptr<Constraint<Real> >
con_;
99 ROL::ParameterList &parlist ) {
105 state_ = ROL::makePtr<AlgorithmState<Real>>();
108 stepname_ = parlist.sublist(
"Step").get(
"Type",
"Last Type (Dummy)");
132 status_ = ROL::makePtr<CombinedStatusTest<Real>>();
136 g_ = x_->dual().clone();
145 c_ =
l_->dual().clone();
149 const Real one(1), ten(10);
151 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
154 obj_ = ROL::makePtr<AugmentedLagrangian<Real>>(raw_obj,
con_,*
l_,1.0,*
x_,*
c_,parlist);
156 pen_ = parlist.sublist(
"Step").sublist(
"Augmented Lagrangian").get(
"Initial Penalty Parameter",ten);
159 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
163 obj_ = ROL::makePtr<MoreauYosidaPenalty<Real>>(raw_obj,
bnd_,*
x_,parlist);
164 pen_ = parlist.sublist(
"Step").sublist(
"Moreau-Yosida Penalty").get(
"Initial Penalty Parameter",ten);
167 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
171 obj_ = ROL::makePtr<InteriorPoint::PenalizedObjective<Real>>(raw_obj,
bnd_,*
x_,parlist);
172 pen_ = parlist.sublist(
"Step").sublist(
"Interior Point").get(
"Initial Barrier Parameter",ten);
175 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
178 if(
bnd_->isActivated() ) {
179 obj_ = ROL::makePtr<BoundFletcher<Real> >(raw_obj,
con_,
bnd_,*
x_,*
c_,parlist);
182 obj_ = ROL::makePtr<Fletcher<Real> >(raw_obj,
con_,*
x_,*
c_,parlist);
184 pen_ = parlist.sublist(
"Step").sublist(
"Fletcher").get(
"Penalty Parameter",one);
191 pen_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Initial Radius",ten);
194 pen_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Initial Trust-Region Parameter",ten);
215 const bool combineStatus =
true) {
217 return solve(bhs,status,combineStatus);
230 const bool combineStatus =
true ) {
234 if (status != ROL::nullPtr) {
235 if (!combineStatus) {
256 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
257 "Error in OptimizationSolver::solve() : Unsupported problem type");
282 state_ = ROL::makePtr<AlgorithmState<Real>>();
296 void reset(
const bool resetAlgo =
true) {
305 ROL::dynamicPtrCast<AugmentedLagrangian<Real> >(
obj_)->
reset(*
l_,
pen_);
308 ROL::dynamicPtrCast<MoreauYosidaPenalty<Real> >(
obj_)->
reset(
pen_);
311 ROL::dynamicPtrCast<InteriorPoint::PenalizedObjective<Real> >(
obj_)->updatePenalty(
pen_);
330 template<
typename Real>
331 inline Ptr<OptimizationSolver<Real>>
333 ParameterList& parlist ) {
334 return makePtr<OptimizationSolver<Real>>(opt,parlist);
337 template<
typename Real>
338 inline Ptr<OptimizationSolver<Real>>
340 ParameterList& parlist ) {
341 return makePtr<OptimizationSolver<Real>>(*opt,parlist);
344 template<
typename Real>
345 inline Ptr<OptimizationSolver<Real>>
347 const Ptr<ParameterList>& parlist ) {
348 return makePtr<OptimizationSolver<Real>>(opt,*parlist);
351 template<
typename Real>
352 inline Ptr<OptimizationSolver<Real>>
354 const Ptr<ParameterList>& parlist ) {
355 return makePtr<OptimizationSolver<Real>>(*opt,*parlist);
360 #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.
Ptr< OptimizationSolver< Real > > make_OptimizationSolver(OptimizationProblem< Real > &opt, ParameterList &parlist)
ROL::Ptr< const AlgorithmState< Real > > getAlgorithmState(void) const
Return the AlgorithmState.
virtual Ptr< Constraint< Real > > getConstraint(void)
bool isCompatibleStep(EProblem p, EStep s)