44 #ifndef ROL_ALGORITHM_H
45 #define ROL_ALGORITHM_H
76 ROL::Ptr<AlgorithmState<Real> >
state_;
88 bool printHeader =
false ) {
91 state_ = ROL::makePtr<AlgorithmState<Real>>();
101 bool printHeader =
false ) {
113 ROL::ParameterList &parlist,
114 bool printHeader =
false) {
122 std::invalid_argument,
123 "Invalid step name in algorithm constructor!");
128 state_ = ROL::makePtr<AlgorithmState<Real>>();
138 std::ostream &outStream = std::cout,
139 bool printVectors =
false,
140 std::ostream &vectorStream = std::cout ) {
143 return run(x,x.
dual(),obj,bnd,print,outStream,printVectors,vectorStream);
154 std::ostream &outStream = std::cout,
155 bool printVectors =
false,
156 std::ostream &vectorStream = std::cout ) {
159 return run(x,g,obj,bnd,print,outStream,printVectors,vectorStream);
169 std::ostream &outStream = std::cout,
170 bool printVectors =
false,
171 std::ostream &vectorStream = std::cout ) {
172 return run(x,x.
dual(),obj,bnd,print,outStream,printVectors,vectorStream);
184 std::ostream &outStream = std::cout,
185 bool printVectors =
false,
186 std::ostream &vectorStream = std::cout ) {
188 x.
print(vectorStream);
191 std::vector<std::string> output;
194 if (
state_->iterateVec == ROL::nullPtr ) {
197 state_->iterateVec->set(x);
200 ROL::Ptr<Vector<Real> > s = x.
clone();
210 if (
state_->minIterVec == ROL::nullPtr ) {
213 state_->minIterVec->set(x);
223 x.
print(vectorStream);
238 std::stringstream hist;
239 hist <<
"Optimization Terminated with Status: ";
242 output.push_back(hist.str());
244 outStream << hist.str();
258 std::ostream &outStream = std::cout,
259 bool printVectors =
false,
260 std::ostream &vectorStream = std::cout ) {
262 return run(x, x.
dual(), l, l.
dual(), obj, con, print, outStream, printVectors, vectorStream);
278 std::ostream &outStream = std::cout,
279 bool printVectors =
false,
280 std::ostream &vectorStream = std::cout ) {
282 x.
print(vectorStream);
285 std::vector<std::string> output;
288 if (
state_->iterateVec == ROL::nullPtr ) {
291 state_->iterateVec->set(x);
294 if (
state_->lagmultVec == ROL::nullPtr ) {
297 state_->lagmultVec->set(l);
300 ROL::Ptr<Vector<Real> > s = x.
clone();
310 if (
state_->minIterVec == ROL::nullPtr ) {
313 state_->minIterVec->set(x);
323 x.
print(vectorStream);
331 std::stringstream hist;
332 hist <<
"Optimization Terminated with Status: ";
335 output.push_back(hist.str());
337 outStream << hist.str();
351 std::ostream &outStream = std::cout,
352 bool printVectors =
false,
353 std::ostream &vectorStream = std::cout) {
354 return run(x,x.
dual(),l,l.
dual(),obj,con,bnd,print,outStream,printVectors,vectorStream);
369 std::ostream &outStream = std::cout,
370 bool printVectors =
false,
371 std::ostream &vectorStream = std::cout ) {
373 x.
print(vectorStream);
376 std::vector<std::string> output;
379 if (
state_->iterateVec == ROL::nullPtr ) {
382 state_->iterateVec->set(x);
385 if (
state_->lagmultVec == ROL::nullPtr ) {
388 state_->lagmultVec->set(l);
391 ROL::Ptr<Vector<Real> > s = x.
clone();
394 step_->initialize(x, g, l, c, obj, con, bnd, *
state_);
401 if (
state_->minIterVec == ROL::nullPtr ) {
404 state_->minIterVec->set(x);
413 x.
print(vectorStream);
420 std::stringstream hist;
421 hist <<
"Optimization Terminated with Status: ";
424 output.push_back(hist.str());
426 outStream << hist.str();
435 std::ostream &outStream = std::cout ) {
444 if ( con == ROL::nullPtr ) {
445 if ( bnd == ROL::nullPtr ) {
446 return run(*x,*obj,print,outStream);
449 return run(*x,*obj,*bnd,print,outStream);
453 if ( bnd == ROL::nullPtr ) {
454 return run(*x,*l,*obj,*con,print,outStream);
457 return run(*x,*l,*obj,*con,*bnd,print,outStream);
463 return step_->printHeader();
470 ROL::Ptr<const AlgorithmState<Real> >
getState(
void)
const {