44 #ifndef ROL_ALGORITHM_H 45 #define ROL_ALGORITHM_H 74 Teuchos::RCP<Step<Real> >
step_;
76 Teuchos::RCP<AlgorithmState<Real> >
state_;
88 bool printHeader =
false ) {
101 bool printHeader =
false ) {
113 Teuchos::ParameterList &parlist,
114 bool printHeader =
false) {
117 std::invalid_argument,
118 "Invalid step name in algorithm constructor!");
133 std::ostream &outStream = std::cout ) {
136 return run(x,x.
dual(),obj,con,print,outStream);
147 std::ostream &outStream = std::cout ) {
150 return run(x,g,obj,con,print,outStream);
160 std::ostream &outStream = std::cout ) {
161 return run(x,x.
dual(),obj,con,print,outStream);
173 std::ostream &outStream = std::cout ) {
174 std::vector<std::string> output;
177 if (
state_->iterateVec == Teuchos::null ) {
180 state_->iterateVec->set(x);
183 Teuchos::RCP<Vector<Real> > s = x.
clone();
193 if (
state_->minIterVec == Teuchos::null ) {
196 state_->minIterVec->set(x);
228 std::ostream &outStream = std::cout ) {
230 return run(x, x.
dual(), l, l.
dual(), obj, con, print, outStream);
246 std::ostream &outStream = std::cout ) {
247 std::vector<std::string> output;
250 if (
state_->iterateVec == Teuchos::null ) {
253 state_->iterateVec->set(x);
256 if (
state_->lagmultVec == Teuchos::null ) {
259 state_->lagmultVec->set(l);
262 Teuchos::RCP<Vector<Real> > s = x.
clone();
272 if (
state_->minIterVec == Teuchos::null ) {
275 state_->minIterVec->set(x);
300 std::ostream &outStream = std::cout ) {
301 return run(x,x.
dual(),l,l.
dual(),obj,con,bnd,print,outStream);
316 std::ostream &outStream = std::cout ) {
317 std::vector<std::string> output;
320 if (
state_->iterateVec == Teuchos::null ) {
323 state_->iterateVec->set(x);
326 if (
state_->lagmultVec == Teuchos::null ) {
329 state_->lagmultVec->set(l);
332 Teuchos::RCP<Vector<Real> > s = x.
clone();
335 step_->initialize(x, g, l, c, obj, con, bnd, *
state_);
342 if (
state_->minIterVec == Teuchos::null ) {
345 state_->minIterVec->set(x);
365 std::ostream &outStream = std::cout ) {
367 Teuchos::RCP<Objective<Real> > obj = opt.
getObjective();
373 if ( con == Teuchos::null ) {
374 if ( bnd == Teuchos::null ) {
375 return run(*x,*obj,print,outStream);
378 return run(*x,*obj,*bnd,print,outStream);
382 if ( bnd == Teuchos::null ) {
383 return run(*x,*l,*obj,*con,print,outStream);
386 return run(*x,*l,*obj,*con,*bnd,print,outStream);
392 return step_->printHeader();
399 Teuchos::RCP<const AlgorithmState<Real> >
getState(
void)
const {
Provides the interface to evaluate objective functions.
EStep StringToEStep(std::string s)
void stepFactory(Teuchos::ParameterList &parlist, Teuchos::RCP< ROL::Step< Real > > &step)
A minimalist step factory which specializes the Step Type depending on whether a Trust-Region or Line...
virtual std::vector< std::string > run(Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on bound constrained problems (Type-B). This is the primary Type-B interface.
Provides the interface to compute optimization steps.
Contains definitions of custom data types in ROL.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Defines the linear algebra or vector space interface.
Teuchos::RCP< AlgorithmState< Real > > state_
Teuchos::RCP< BoundConstraint< Real > > getBoundConstraint(void)
State for algorithm class. Will be used for restarts.
virtual std::vector< std::string > run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on bound constrained problems (Type-B). This general interface supports the use of dual...
Teuchos::RCP< const AlgorithmState< Real > > getState(void) const
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Defines the equality constraint operator interface.
virtual std::vector< std::string > run(OptimizationProblem< Real > &opt, bool print=false, std::ostream &outStream=std::cout)
Run algorithm using a ROL::OptimizationProblem.
virtual std::vector< std::string > run(Vector< Real > &x, Vector< Real > &l, Objective< Real > &obj, EqualityConstraint< Real > &con, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on equality constrained problems (Type-E). This is the primary Type-E interface...
Provides an interface to run optimization algorithms.
Provides an interface to check status of optimization algorithms.
Algorithm(const Teuchos::RCP< Step< Real > > &step, const Teuchos::RCP< StatusTest< Real > > &status, const Teuchos::RCP< AlgorithmState< Real > > &state, bool printHeader=false)
Constructor, given a step, a status test, and a previously defined algorithm state.
Teuchos::RCP< Vector< Real > > getMultiplierVector(void)
Provides the interface to apply upper and lower bound constraints.
int isValidStep(EStep ls)
Verifies validity of a TrustRegion enum.
virtual std::vector< std::string > run(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, EqualityConstraint< Real > &con, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on equality constrained problems (Type-E). This general interface supports the use of d...
Teuchos::RCP< StatusTest< Real > > status_
Teuchos::RCP< EqualityConstraint< Real > > getEqualityConstraint(void)
Teuchos::RCP< Vector< Real > > getSolutionVector(void)
Teuchos::RCP< StatusTest< Real > > getStatusTest(const std::string step, Teuchos::ParameterList &parlist)
virtual std::vector< std::string > run(Vector< Real > &x, Objective< Real > &obj, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on unconstrained problems (Type-U). This is the primary Type-U interface.
Teuchos::RCP< Step< Real > > step_
Algorithm(const Teuchos::RCP< Step< Real > > &step, const Teuchos::RCP< StatusTest< Real > > &status, bool printHeader=false)
Constructor, given a step and a status test.
std::string getIterInfo(bool withHeader=false)
virtual std::vector< std::string > run(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on equality and bound constrained problems (Type-EB). This general interface supports t...
void deactivate(void)
Turn off bounds.
EStep
Enumeration of step types.
virtual std::vector< std::string > run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on unconstrained problems (Type-U). This general interface supports the use of dual opt...
virtual std::vector< std::string > run(Vector< Real > &x, Vector< Real > &l, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on equality and bound constrained problems (Type-EB). This is the primary Type-EB inter...
Teuchos::RCP< Objective< Real > > getObjective(void)
Algorithm(const std::string &stepname, Teuchos::ParameterList &parlist, bool printHeader=false)
Constructor, given a string, for the step, and a parameter list of various options. The status test is determined based on the step string.
std::string getIterHeader(void)