44 #ifndef ROL_MINIMAX2_HPP 45 #define ROL_MINIMAX2_HPP 51 #include "Teuchos_RCP.hpp" 65 using Teuchos::dyn_cast;
70 using Teuchos::dyn_cast;
83 Real f1 = std::pow((*xp)[0],4.0) + std::pow((*xp)[1],2.0);
84 Real f2 = std::pow(2.0-(*xp)[0],2.0) + std::pow(2.0-(*xp)[1],2.0);
85 Real f3 = 2.0*std::exp(-(*xp)[0] + (*xp)[1]);
86 return std::max(f1,std::max(f2,f3));
95 Real f1 = std::pow((*xp)[0],4.0) + std::pow((*xp)[1],2.0);
96 Real f2 = std::pow(2.0-(*xp)[0],2.0) + std::pow(2.0-(*xp)[1],2.0);
97 Real f3 = 2.0*std::exp(-(*xp)[0] + (*xp)[1]);
99 if ( f1 >= std::max(f2,f3) ) {
100 (*gp)[0] = 4.0*std::pow((*xp)[0],3.0);
101 (*gp)[1] = 2.0*(*xp)[1];
103 else if ( f2 >= std::max(f1,f3) ) {
104 (*gp)[0] = 2.0*(*xp)[0]-4.0;
105 (*gp)[1] = 2.0*(*xp)[1]-4.0;
107 else if ( f3 >= std::max(f1,f2) ) {
108 (*gp)[0] = -2.0*std::exp(-(*xp)[0]+(*xp)[1]);
109 (*gp)[1] = 2.0*std::exp(-(*xp)[0]+(*xp)[1]);
Provides the interface to evaluate objective functions.
Teuchos::RCP< const vector > getVector(const V &x)
Defines the linear algebra or vector space interface.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Teuchos::RCP< vector > getVector(V &x)
Real value(const Vector< Real > &x, Real &tol)
Compute value.
std::vector< Real > vector