AugmentedLagrangian(Objective<Real> &obj, EqualityConstraint<Real> &con, 
               const ROL::Vector<Real> &x, const ROL::Vector<Real> &c)
   : mu_(0.0), fval_(0.0), isConEvaluated_(false), ncval_(0), nfval_(0), ngval_(0) {
   obj_ = Teuchos::rcp(&obj, false);
   con_ = Teuchos::rcp(&con, false);
   c_    = c.clone();
   dc1_  = x.dual().clone();
   dc2_  = c.clone();
   lam_  = c.dual().clone();
   dlam_ = c.dual().clone();
   flag_ = true;
   HessianLevel_ = 1;
 }
  MoreauYosidaPenalty(const Teuchos::RCP<Objective<Real> > &obj,
                      const Teuchos::RCP<BoundConstraint<Real> > &con, 
                      const ROL::Vector<Real> &x, const Real mu = 1.0)
    : obj_(obj), con_(con), mu_(mu),
      fval_(0), isConEvaluated_(false), nfval_(0), ngval_(0) {

    g_    = x.dual().clone();
    l_    = x.clone();
    l1_   = x.clone();
    dl1_  = x.dual().clone();
    u_    = x.clone();
    u1_   = x.clone();
    du1_  = x.dual().clone();
    xlam_ = x.clone();
    v_    = x.clone();
    dv_   = x.dual().clone();
    dv2_  = x.dual().clone();
    lam_  = x.clone();
    tmp_  = x.clone();

    con_->setVectorToLowerBound(*l_);
    con_->setVectorToUpperBound(*u_);

    lam_->zero();
    //lam_->set(*u_);
    //lam_->plus(*l_);
    //lam_->scale(0.5);
  }
Esempio n. 3
0
 void hessVec_11(ROL::Vector<Real> &hv,
           const ROL::Vector<Real> &v,
           const ROL::Vector<Real> &u,
           const ROL::Vector<Real> &z,
                 Real &tol) {
   if ( useFU_ ) {
     hv.zero();
   }
   else {
     Teuchos::RCP<Tpetra::MultiVector<> > hvp
       = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(hv)).getVector();
     Teuchos::RCP<const Tpetra::MultiVector<> > vp
       = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(v)).getVector();
     data_->ApplyJacobian1ToVec(hvp, vp);
     Real two(2);
     hvp->scale(two*scale_);
   }
 }
 void gradient_2(ROL::Vector<Real> &g,
                 const ROL::Vector<Real> &u,
                 const ROL::Vector<Real> &z,
                 Real &tol) {
     Teuchos::RCP<Tpetra::MultiVector<> > gp
         = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(g)).getVector();
     if ( useFU_ ) {
         g.zero();
     }
     else {
         Teuchos::RCP<const Tpetra::MultiVector<> > up
             = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector();
         Teuchos::RCP<Tpetra::MultiVector<> > tmp
             = Teuchos::rcp(new Tpetra::MultiVector<>(gp->getMap(), 1));
         data_->ApplyAdjointJacobian2ToVec (tmp, up, up);
         filter_->apply(gp, tmp);
     }
 }
 void gradient_2(ROL::Vector<Real> &g, const ROL::Vector<Real> &u,
                 const ROL::Vector<Real> &z, Real &tol ) {
     try {
         Teuchos::RCP<Tpetra::MultiVector<> > gp =
             (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(g)).getVector();
         Teuchos::RCP<const Tpetra::MultiVector<> > up =
             (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector();
         Teuchos::RCP<const Tpetra::MultiVector<> > zp =
             (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(z)).getVector();
         assembler_->assembleQoIGradient2(qoi_,up,zp);
         gp->scale(static_cast<Real>(1),*(assembler_->getQoIGradient2()));
     }
     catch ( Exception::Zero & ez ) {
         g.zero();
     }
     catch ( Exception::NotImplemented & eni ) {
         ROL::ParametrizedObjective_SimOpt<Real>::gradient_2(g,u,z,tol);
     }
 }
 void hessVec_22( ROL::Vector<Real> &hv, const ROL::Vector<Real> &v,
                  const ROL::Vector<Real> &u,  const ROL::Vector<Real> &z, Real &tol ) {
     try {
         Teuchos::RCP<Tpetra::MultiVector<> > hvp =
             (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(hv)).getVector();
         Teuchos::RCP<const Tpetra::MultiVector<> > vp =
             (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(v)).getVector();
         Teuchos::RCP<const Tpetra::MultiVector<> > up =
             (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector();
         Teuchos::RCP<const Tpetra::MultiVector<> > zp =
             (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(z)).getVector();
         assembler_->assembleQoIHessVec22(qoi_,vp,up,zp);
         hvp->scale(static_cast<Real>(1),*(assembler_->getQoIHessVec22()));
     }
     catch (Exception::Zero &ez) {
         hv.zero();
     }
     catch (Exception::NotImplemented &eni) {
         ROL::ParametrizedObjective_SimOpt<Real>::hessVec_22(hv,v,u,z,tol);
         //throw Exception::NotImplemented(">>> (IntegratedObjective::hessVec_22): Hessian not implemented.");
     }
 }
Esempio n. 7
0
 void hessVec_21(ROL::Vector<Real> &hv,
           const ROL::Vector<Real> &v,
           const ROL::Vector<Real> &u,
           const ROL::Vector<Real> &z,
                 Real &tol) {
   if ( useFU_ ) {
     hv.zero();
   }
   else {
     Teuchos::RCP<Tpetra::MultiVector<> > hvp
       = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(hv)).getVector();
     Teuchos::RCP<const Tpetra::MultiVector<> > vp
       = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(v)).getVector();
     Teuchos::RCP<const Tpetra::MultiVector<> > up
       = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector();
     Teuchos::RCP<Tpetra::MultiVector<> > tmp
       = Teuchos::rcp(new Tpetra::MultiVector<>(hvp->getMap(), 1));
     data_->ApplyAdjointJacobian2ToVec (tmp, up, vp);
     filter_->apply(hvp, tmp);
     Real two(2);
     hvp->scale(two*scale_);
   }
 }
Esempio n. 8
0
  void applyAdjointHessian_22(ROL::Vector<Real> &ahwv, const ROL::Vector<Real> &w, const ROL::Vector<Real> &v,
                              const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol) 
  {
	  ahwv.zero();	
  }
 void initialize(const ROL::Vector<Real> &x, const ROL::Vector<Real> &s, const ROL::Vector<Real> &g, 
                 Objective<Real> &obj, BoundConstraint<Real> &con) {
   LineSearch<Real>::initialize(x,s,g,obj,con);
   xnew_ = x.clone();
 }