10 #ifndef ROL_OPTIMIZATIONSOLVER_HPP
11 #define ROL_OPTIMIZATIONSOLVER_HPP
32 ROL::Ptr<Algorithm<Real> >
algo_;
35 ROL::Ptr<CombinedStatusTest<Real> >
status_;
36 ROL::Ptr<AlgorithmState<Real> >
state_;
38 ROL::Ptr<Vector<Real> >
x_;
39 ROL::Ptr<Vector<Real> >
g_;
40 ROL::Ptr<Vector<Real> >
l_;
41 ROL::Ptr<Vector<Real> >
c_;
43 ROL::Ptr<Objective<Real> >
obj_;
44 ROL::Ptr<BoundConstraint<Real> >
bnd_;
45 ROL::Ptr<Constraint<Real> >
con_;
65 ROL::ParameterList &parlist ) {
71 state_ = ROL::makePtr<AlgorithmState<Real>>();
74 stepname_ = parlist.sublist(
"Step").get(
"Type",
"Last Type (Dummy)");
98 status_ = ROL::makePtr<CombinedStatusTest<Real>>();
102 g_ = x_->dual().clone();
111 c_ =
l_->dual().clone();
115 const Real one(1), ten(10);
117 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
120 obj_ = ROL::makePtr<AugmentedLagrangian<Real>>(raw_obj,
con_,*
l_,1.0,*
x_,*
c_,parlist);
122 pen_ = parlist.sublist(
"Step").sublist(
"Augmented Lagrangian").get(
"Initial Penalty Parameter",ten);
125 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
129 obj_ = ROL::makePtr<MoreauYosidaPenalty<Real>>(raw_obj,
bnd_,*
x_,parlist);
130 pen_ = parlist.sublist(
"Step").sublist(
"Moreau-Yosida Penalty").get(
"Initial Penalty Parameter",ten);
133 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
137 obj_ = ROL::makePtr<InteriorPoint::PenalizedObjective<Real>>(raw_obj,
bnd_,*
x_,parlist);
138 pen_ = parlist.sublist(
"Step").sublist(
"Interior Point").get(
"Initial Barrier Parameter",ten);
141 ROL::Ptr<Objective<Real> > raw_obj = opt.
getObjective();
144 if(
bnd_->isActivated() ) {
145 obj_ = ROL::makePtr<BoundFletcher<Real> >(raw_obj,
con_,
bnd_,*
x_,*
c_,parlist);
148 obj_ = ROL::makePtr<Fletcher<Real> >(raw_obj,
con_,*
x_,*
c_,parlist);
150 pen_ = parlist.sublist(
"Step").sublist(
"Fletcher").get(
"Penalty Parameter",one);
157 pen_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Initial Radius",ten);
160 pen_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Initial Trust-Region Parameter",ten);
181 const bool combineStatus =
true) {
183 return solve(bhs,status,combineStatus);
196 const bool combineStatus =
true ) {
200 if (status != ROL::nullPtr) {
201 if (!combineStatus) {
222 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
223 "Error in OptimizationSolver::solve() : Unsupported problem type");
248 state_ = ROL::makePtr<AlgorithmState<Real>>();
262 void reset(
const bool resetAlgo =
true) {
271 ROL::dynamicPtrCast<AugmentedLagrangian<Real> >(
obj_)->
reset(*
l_,
pen_);
274 ROL::dynamicPtrCast<MoreauYosidaPenalty<Real> >(
obj_)->
reset(
pen_);
277 ROL::dynamicPtrCast<InteriorPoint::PenalizedObjective<Real> >(
obj_)->updatePenalty(
pen_);
296 template<
typename Real>
297 inline Ptr<OptimizationSolver<Real>>
299 ParameterList& parlist ) {
300 return makePtr<OptimizationSolver<Real>>(opt,parlist);
303 template<
typename Real>
304 inline Ptr<OptimizationSolver<Real>>
306 ParameterList& parlist ) {
307 return makePtr<OptimizationSolver<Real>>(*opt,parlist);
310 template<
typename Real>
311 inline Ptr<OptimizationSolver<Real>>
313 const Ptr<ParameterList>& parlist ) {
314 return makePtr<OptimizationSolver<Real>>(opt,*parlist);
317 template<
typename Real>
318 inline Ptr<OptimizationSolver<Real>>
320 const Ptr<ParameterList>& parlist ) {
321 return makePtr<OptimizationSolver<Real>>(*opt,*parlist);
326 #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...
basic_nullstream< char, std::char_traits< char >> nullstream
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).
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)