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