// @HEADER // ***************************************************************************** // Rapid Optimization Library (ROL) Package // // Copyright 2014 NTESS and the ROL contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef HS_PROBLEM_004_HPP #define HS_PROBLEM_004_HPP #include "ROL_NonlinearProgram.hpp" namespace HS { namespace HS_004 { template class Obj { public: template ScalarT value( const std::vector &x, Real &tol ) { ScalarT a = x[0]+1.0; return a*a*a/3.0 + x[1]; } }; } template class Problem_004 : public ROL::NonlinearProgram { typedef ROL::Vector V; typedef ROL::Objective OBJ; typedef ROL::NonlinearProgram NP; public: Problem_004() : NP( dimension_x() ) { NP::setLower(0,1); NP::setLower(1,0); } int dimension_x() { return 2; } const ROL::Ptr getObjective() { return ROL::makePtr>(); } const ROL::Ptr getInitialGuess() { Real x[] = {1.125,0.125}; return NP::createOptVector(x); }; bool initialGuessIsFeasible() { return true; } Real getInitialObjectiveValue() { return Real(3.323568); } Real getSolutionObjectiveValue() { return Real(8.0/3.0); } ROL::Ptr getSolutionSet() { Real x[] = {1,0}; return ROL::CreatePartitionedVector(NP::createOptVector(x)); } }; } #endif // HS_PROBLEM_004_HPP