44 #ifndef ROL_PD_RANDVARFUNCTIONAL_HPP
45 #define ROL_PD_RANDVARFUNCTIONAL_HPP
65 void setValue(
const Real val,
const std::vector<Real> &pt) {
84 Real
ppf(
const Real x,
const Real t,
const Real r,
const int deriv = 0)
const {
85 const Real
zero(0), half(0.5), one(1), arg(r*x+t);
88 val = (deriv==0 ? -half*t*t/r :
zero);
90 else if (
zero <= arg && arg <= one ) {
91 val = (deriv==0 ? half*r*x*x+t*x
92 : (deriv==1 ? arg : r));
95 val = (deriv==0 ? (arg-half*(t*t+one))/r
96 : (deriv==1 ? one :
zero));
104 values_ = makePtr<SampledScalar<Real>>();
120 const Real
zero(0), one(1);
121 Real val(0), lold(0), lnew(0), mdiff(0), gdiff(0);
127 lnew = std::min(one, std::max(
zero,
pen_*val+lold));
132 mdiff += sampler.
getMyWeight(i) * std::pow(lnew-lold,2);
135 sampler.
sumAll(&mdiff,&gdiff,1);
136 gdiff = std::sqrt(gdiff);
virtual void setHessVecStorage(const Ptr< SampledScalar< Real >> &gradvec_storage, const Ptr< SampledVector< Real >> &hessvec_storage)
std::vector< Real >::size_type uint
typename PV< Real >::size_type size_type
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
Defines the linear algebra or vector space interface.
Ptr< SampledScalar< Real > > multipliers_
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()
virtual void setStorage(const Ptr< SampledScalar< Real >> &value_storage, const Ptr< SampledVector< Real >> &gradient_storage)
virtual Real computeDual(SampleGenerator< Real > &sampler)
Ptr< SampledScalar< Real > > values_
void setData(SampleGenerator< Real > &sampler, const Real pen, const Real lam=0.0)
virtual void setStorage(const Ptr< SampledScalar< Real >> &value_storage, const Ptr< SampledVector< Real >> &gradient_storage)
void getMultiplier(Real &lam, const std::vector< Real > &pt) const
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)
Ptr< SampledScalar< Real > > multipliers_new_
virtual void setHessVecStorage(const Ptr< SampledScalar< Real >> &gradvec_storage, const Ptr< SampledVector< Real >> &hessvec_storage)
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.