10 #ifndef ROL_PD_RANDVARFUNCTIONAL_HPP
11 #define ROL_PD_RANDVARFUNCTIONAL_HPP
31 void setValue(
const Real val,
const std::vector<Real> &pt) {
50 Real
ppf(
const Real x,
const Real t,
const Real r,
const int deriv = 0)
const {
51 const Real
zero(0), half(0.5), one(1), arg(r*x+t);
54 val = (deriv==0 ? -half*t*t/r :
zero);
56 else if (
zero <= arg && arg <= one ) {
57 val = (deriv==0 ? half*r*x*x+t*x
58 : (deriv==1 ? arg : r));
61 val = (deriv==0 ? (arg-half*(t*t+one))/r
62 : (deriv==1 ? one :
zero));
70 values_ = makePtr<ScalarController<Real>>();
86 const Real
zero(0), one(1);
87 Real val(0), lold(0), lnew(0), mdiff(0), gdiff(0);
93 lnew = std::min(one, std::max(
zero,
pen_*val+lold));
98 mdiff += sampler.
getMyWeight(i) * std::pow(lnew-lold,2);
101 sampler.
sumAll(&mdiff,&gdiff,1);
102 gdiff = std::sqrt(gdiff);
std::vector< Real >::size_type uint
typename PV< Real >::size_type size_type
virtual void setHessVecStorage(const Ptr< ScalarController< Real >> &gradvec_storage, const Ptr< VectorController< Real >> &hessvec_storage)
Ptr< ScalarController< Real > > multipliers_
Real ppf(const Real x, const Real t, const Real r, const int deriv=0) const
void setMultiplier(Real &lam, const std::vector< Real > &pt)
virtual std::vector< Real > getMyPoint(const int i) const
void updatePenalty(const Real pen)
Real getPenaltyParameter(void) const
virtual Real getMyWeight(const int i) const
virtual void setStorage(const Ptr< ScalarController< Real >> &value_storage, const Ptr< VectorController< Real >> &gradient_storage)
Defines the linear algebra or vector space interface.
virtual int numMySamples(void) const
void updateDual(SampleGenerator< Real > &sampler)
void sumAll(Real *input, Real *output, int dim) const
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Ptr< ScalarController< Real > > multipliers_new_
virtual Real computeDual(SampleGenerator< Real > &sampler)
virtual void setStorage(const Ptr< ScalarController< Real >> &value_storage, const Ptr< VectorController< Real >> &gradient_storage)
void setData(SampleGenerator< Real > &sampler, const Real pen, const Real lam=0.0)
void getMultiplier(Real &lam, const std::vector< Real > &pt) const
Ptr< ScalarController< Real > > values_
PD_RandVarFunctional(void)
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.
Provides the interface to implement any functional that maps a random variable to a (extended) real n...
void setValue(const Real val, const std::vector< Real > &pt)
virtual void setHessVecStorage(const Ptr< ScalarController< Real >> &gradvec_storage, const Ptr< VectorController< Real >> &hessvec_storage)
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.