ROL
ROL_RiskVector.hpp
Go to the documentation of this file.
1// @HEADER
2// ************************************************************************
3//
4// Rapid Optimization Library (ROL) Package
5// Copyright (2014) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact lead developers:
38// Drew Kouri (dpkouri@sandia.gov) and
39// Denis Ridzal (dridzal@sandia.gov)
40//
41// ************************************************************************
42// @HEADER
43
44#ifndef ROL_RISKVECTOR_HPP
45#define ROL_RISKVECTOR_HPP
46
47#include "ROL_StdVector.hpp"
49#include "ROL_ParameterList.hpp"
50
51namespace ROL {
52
53template<class Real>
54class RiskVector : public Vector<Real> {
55private:
56 Ptr<std::vector<Real> > statObj_;
57 Ptr<StdVector<Real> > statObj_vec_;
60
61 std::vector<Ptr<std::vector<Real> > > statCon_;
62 std::vector<Ptr<StdVector<Real> > > statCon_vec_;
64 std::vector<int> nStatCon_;
65
66 Ptr<Vector<Real> > vec_;
67
68 mutable bool isDualInitialized_;
69 mutable Ptr<std::vector<Real> > dualObj_;
70 mutable std::vector<Ptr<std::vector<Real> > > dualCon_;
71 mutable Ptr<Vector<Real> > dual_vec1_;
72 mutable Ptr<RiskVector<Real> > dual_vec_;
73
74 void initializeObj(Ptr<ParameterList> &parlist,
75 const Real stat = 1) {
76 // Get risk measure information
77 if (parlist != nullPtr) {
78 std::string name;
79 std::vector<Real> lower, upper;
80 bool activated(false);
81 RandVarFunctionalInfo<Real>(*parlist,name,nStatObj_,lower,upper,activated);
82 augmentedObj_ = (nStatObj_ > 0) ? true : false;
83 // Initialize statistic vector
84 if (augmentedObj_) {
85 statObj_ = makePtr<std::vector<Real>>(nStatObj_,stat);
86 statObj_vec_ = makePtr<StdVector<Real>>(statObj_);
87 }
88 }
89 else {
90 augmentedObj_ = false;
91 nStatObj_ = 0;
92 }
93 }
94
95 void initializeCon(std::vector<Ptr<ParameterList> > &parlist,
96 const Real stat = 1) {
97 int size = parlist.size();
98 statCon_.resize(size); statCon_vec_.resize(size); nStatCon_.resize(size);
99 for (int i = 0; i < size; ++i) {
100 if (parlist[i] != nullPtr) {
101 // Get risk measure information
102 std::string name;
103 std::vector<Real> lower, upper;
104 bool activated(false);
105 RandVarFunctionalInfo<Real>(*parlist[i],name,nStatCon_[i],lower,upper,activated);
106 augmentedCon_ = (nStatCon_[i] > 0) ? true : augmentedCon_;
107 // Initialize statistic vector
108 if (nStatCon_[i] > 0) {
109 statCon_[i] = makePtr<std::vector<Real>>(nStatCon_[i],stat);
110 statCon_vec_[i] = makePtr<StdVector<Real>>(statCon_[i]);
111 }
112 else {
113 statCon_[i] = nullPtr;
114 statCon_vec_[i] = nullPtr;
115 }
116 }
117 else {
118 statCon_[i] = nullPtr;
119 statCon_vec_[i] = nullPtr;
120 }
121 }
122 }
123
124public:
125
126 // Objective risk only
127 RiskVector( Ptr<ParameterList> &parlist,
128 const Ptr<Vector<Real> > &vec,
129 const Real stat = 0 )
130 : statObj_(nullPtr), statObj_vec_(nullPtr),
131 augmentedObj_(false), nStatObj_(0),
132 augmentedCon_(false),
133 vec_(vec), isDualInitialized_(false) {
134 initializeObj(parlist,stat);
135 }
136
137 // Inequality constraint risk only
138 RiskVector( std::vector<Ptr<ParameterList> > &parlist,
139 const Ptr<Vector<Real> > &vec,
140 const Real stat = 0 )
141 : statObj_(nullPtr), statObj_vec_(nullPtr),
142 augmentedObj_(false), nStatObj_(0),
143 augmentedCon_(false),
144 vec_(vec), isDualInitialized_(false) {
145 initializeCon(parlist,stat);
146 }
147
148 // Objective and inequality constraint risk
149 RiskVector( Ptr<ParameterList> & parlistObj,
150 std::vector<Ptr<ParameterList> > &parlistCon,
151 const Ptr<Vector<Real> > &vec,
152 const Real stat = 0 )
153 : statObj_(nullPtr), statObj_vec_(nullPtr),
154 augmentedObj_(false), nStatObj_(0),
155 augmentedCon_(false),
156 vec_(vec), isDualInitialized_(false) {
157 initializeObj(parlistObj,stat);
158 initializeCon(parlistCon,stat);
159 }
160
161 // Build from components
162 RiskVector( const Ptr<Vector<Real> > &vec,
163 const Ptr<std::vector<Real> > &statObj,
164 const std::vector<Ptr<std::vector<Real> > > &statCon )
165 : statObj_(nullPtr), statObj_vec_(nullPtr),
166 augmentedObj_(false), nStatObj_(0), augmentedCon_(false),
167 vec_(vec), isDualInitialized_(false) {
168 if (statObj != nullPtr) {
169 statObj_ = statObj;
170 statObj_vec_ = makePtr<StdVector<Real>>(statObj_);
171 augmentedObj_ = true;
172 nStatObj_ = statObj->size();
173 }
174 int size = statCon.size();
175 statCon_.clear(); statCon_vec_.clear(); nStatCon_.clear();
176 statCon_.resize(size,nullPtr);
177 statCon_vec_.resize(size,nullPtr);
178 nStatCon_.resize(size,0);
179 for (int i = 0; i < size; ++i) {
180 if (statCon[i] != nullPtr) {
181 statCon_[i] = statCon[i];
182 statCon_vec_[i] = makePtr<StdVector<Real>>(statCon_[i]);
183 augmentedCon_ = true;
184 nStatCon_[i] = statCon[i]->size();
185 }
186 }
187 }
188
189 // Build from components -- Objective only...no statistic
190 RiskVector( const Ptr<Vector<Real> > &vec )
191 : statObj_(nullPtr), statObj_vec_(nullPtr),
192 augmentedObj_(false), nStatObj_(0), augmentedCon_(false),
193 vec_(vec), isDualInitialized_(false) {}
194
195 void set( const Vector<Real> &x ) {
196 const RiskVector<Real> &xs = dynamic_cast<const RiskVector<Real>&>(x);
197 vec_->set(*(xs.getVector()));
198 if (augmentedObj_ && statObj_vec_ != nullPtr) {
199 statObj_vec_->set(*(xs.getStatisticVector(0)));
200 }
201 if (augmentedCon_) {
202 int size = statCon_vec_.size();
203 for (int i = 0; i < size; ++i) {
204 if (statCon_vec_[i] != nullPtr) {
205 statCon_vec_[i]->set(*(xs.getStatisticVector(1,i)));
206 }
207 }
208 }
209 }
210
211 void plus( const Vector<Real> &x ) {
212 const RiskVector<Real> &xs = dynamic_cast<const RiskVector<Real>&>(x);
213 vec_->plus(*(xs.getVector()));
214 if (augmentedObj_ && statObj_vec_ != nullPtr) {
215 statObj_vec_->plus(*(xs.getStatisticVector(0)));
216 }
217 if (augmentedCon_) {
218 int size = statCon_vec_.size();
219 for (int i = 0; i < size; ++i) {
220 if (statCon_vec_[i] != nullPtr) {
221 statCon_vec_[i]->plus(*(xs.getStatisticVector(1,i)));
222 }
223 }
224 }
225 }
226
227 void scale( const Real alpha ) {
228 vec_->scale(alpha);
229 if (augmentedObj_ && statObj_vec_ != nullPtr) {
230 statObj_vec_->scale(alpha);
231 }
232 if (augmentedCon_) {
233 int size = statCon_vec_.size();
234 for (int i = 0; i < size; ++i) {
235 if (statCon_vec_[i] != nullPtr) {
236 statCon_vec_[i]->scale(alpha);
237 }
238 }
239 }
240 }
241
242 void axpy( const Real alpha, const Vector<Real> &x ) {
243 const RiskVector<Real> &xs = dynamic_cast<const RiskVector<Real>&>(x);
244 vec_->axpy(alpha,*(xs.getVector()));
245 if (augmentedObj_ && statObj_vec_ != nullPtr) {
246 statObj_vec_->axpy(alpha,*(xs.getStatisticVector(0)));
247 }
248 if (augmentedCon_) {
249 int size = statCon_vec_.size();
250 for (int i = 0; i < size; ++i) {
251 if (statCon_vec_[i] != nullPtr) {
252 statCon_vec_[i]->axpy(alpha,*(xs.getStatisticVector(1,i)));
253 }
254 }
255 }
256 }
257
258 Real dot( const Vector<Real> &x ) const {
259 const RiskVector<Real> &xs = dynamic_cast<const RiskVector<Real>&>(x);
260 Real val = vec_->dot(*(xs.getVector()));
261 if (augmentedObj_ && statObj_vec_ != nullPtr) {
262 val += statObj_vec_->dot(*(xs.getStatisticVector(0)));
263 }
264 if (augmentedCon_) {
265 int size = statCon_vec_.size();
266 for (int i = 0; i < size; ++i) {
267 if (statCon_vec_[i] != nullPtr) {
268 val += statCon_vec_[i]->dot(*(xs.getStatisticVector(1,i)));
269 }
270 }
271 }
272 return val;
273 }
274
275 Real norm(void) const {
276 return sqrt( dot(*this) );
277 }
278
279 Ptr<Vector<Real> > clone(void) const {
280 Ptr<std::vector<Real> > e2 = nullPtr;
281 if (augmentedObj_ && statObj_vec_ != nullPtr) {
282 e2 = makePtr<std::vector<Real>>(nStatObj_,static_cast<Real>(0));
283 }
284 int size = statCon_vec_.size();
285 std::vector<Ptr<std::vector<Real> > > e3(size, nullPtr);
286 for (int j = 0; j < size; ++j) {
287 if (statCon_vec_[j] != nullPtr) {
288 e3[j] = makePtr<std::vector<Real>>(nStatCon_[j],static_cast<Real>(0));
289 }
290 }
291 return makePtr<RiskVector>(vec_->clone(),e2,e3);
292 }
293
294 const Vector<Real> &dual(void) const {
295 // Initialize dual vectors if not already initialized
296 if ( !isDualInitialized_ ) {
297 dual_vec1_ = vec_->dual().clone();
298 dualObj_ = nullPtr;
299 if (statObj_ != nullPtr) {
300 dualObj_ = makePtr<std::vector<Real>>(statObj_->size());
301 }
302 int size = statCon_.size();
303 dualCon_.clear(); dualCon_.resize(size,nullPtr);
304 for (int i = 0; i < size; ++i) {
305 if (statCon_[i] != nullPtr) {
306 dualCon_[i] = makePtr<std::vector<Real>>(statCon_[i]->size());
307 }
308 }
309 dual_vec_ = makePtr<RiskVector<Real>>(dual_vec1_,dualObj_,dualCon_);
310 isDualInitialized_ = true;
311 }
312 // Set vector component
313 dual_vec1_->set(vec_->dual());
314 // Set statistic component
315 if ( augmentedObj_ && statObj_vec_ != nullPtr ) {
316 dynamicPtrCast<RiskVector<Real> >(dual_vec_)->setStatistic(*statObj_,0);
317 }
318 if ( augmentedCon_ ) {
319 int size = statCon_.size();
320 for (int i = 0; i < size; ++i) {
321 if (statCon_[i] != nullPtr) {
322 dynamicPtrCast<RiskVector<Real> >(dual_vec_)->setStatistic(*statCon_[i],1,i);
323 }
324 }
325 }
326 // Return dual vector
327 return *dual_vec_;
328 }
329
330 Ptr<Vector<Real> > basis( const int i ) const {
331 Ptr<Vector<Real> > e1;
332 Ptr<std::vector<Real> > e2 = nullPtr;
333 if (augmentedObj_ && statObj_vec_ != nullPtr) {
334 e2 = makePtr<std::vector<Real>>(nStatObj_,static_cast<Real>(0));
335 }
336 int size = statCon_vec_.size();
337 std::vector<Ptr<std::vector<Real> > > e3(size);
338 for (int j = 0; j < size; ++j) {
339 if (statCon_vec_[j] != nullPtr) {
340 e3[j] = makePtr<std::vector<Real>>(nStatCon_[j],static_cast<Real>(0));
341 }
342 }
343 int n1 = vec_->dimension(), n2 = 0;
344 if (statObj_vec_ != nullPtr) {
345 n2 = statObj_vec_->dimension();
346 }
347 if ( i < n1 ) {
348 e1 = vec_->basis(i);
349 }
350 else if (i >= n1 && i < n1+n2) {
351 e1 = vec_->clone(); e1->zero();
352 (*e2)[i-n1] = static_cast<Real>(1);
353 }
354 else if (i >= n1+n2) {
355 e1 = vec_->clone(); e1->zero();
356 int sum = n1+n2, sum0 = sum;
357 for (int j = 0; j < size; ++j) {
358 if (statCon_vec_[j] != nullPtr) {
359 sum += nStatCon_[j];
360 if (i < sum) {
361 (*e3[j])[i-sum0] = static_cast<Real>(1);
362 break;
363 }
364 sum0 = sum;
365 }
366 }
367 if (i >= sum) {
368 throw Exception::NotImplemented(">>> ROL::RiskVector::Basis: index out of bounds!");
369 }
370 }
371 return makePtr<RiskVector<Real>>(e1,e2,e3);
372 }
373
374 void applyUnary( const Elementwise::UnaryFunction<Real> &f ) {
375 vec_->applyUnary(f);
376 if (augmentedObj_ && statObj_vec_ != nullPtr) {
377 statObj_vec_->applyUnary(f);
378 }
379 if (augmentedCon_) {
380 int size = statCon_vec_.size();
381 for (int i = 0; i < size; ++i) {
382 if (statCon_vec_[i] != nullPtr) {
383 statCon_vec_[i]->applyUnary(f);
384 }
385 }
386 }
387 }
388
389 void applyBinary( const Elementwise::BinaryFunction<Real> &f, const Vector<Real> &x ) {
390 const RiskVector<Real> &xs = dynamic_cast<const RiskVector<Real>&>(x);
391 vec_->applyBinary(f,*xs.getVector());
392 if (augmentedObj_ && statObj_vec_ != nullPtr) {
393 statObj_vec_->applyBinary(f,*xs.getStatisticVector(0));
394 }
395 if (augmentedCon_) {
396 int size = statCon_vec_.size();
397 for (int i = 0; i < size; ++i) {
398 if (statCon_vec_[i] != nullPtr) {
399 statCon_vec_[i]->applyBinary(f,*xs.getStatisticVector(1,i));
400 }
401 }
402 }
403 }
404
405 Real reduce( const Elementwise::ReductionOp<Real> &r ) const {
406 Real result = r.initialValue();
407 r.reduce(vec_->reduce(r),result);
408 if (augmentedObj_ && statObj_vec_ != nullPtr) {
409 r.reduce(statObj_vec_->reduce(r),result);
410 }
411 if (augmentedCon_) {
412 int size = statCon_vec_.size();
413 for (int i = 0; i < size; ++i) {
414 if (statCon_vec_[i] != nullPtr) {
415 r.reduce(statCon_vec_[i]->reduce(r),result);
416 }
417 }
418 }
419 return result;
420 }
421
422 void setScalar( const Real C ) {
423 vec_->setScalar(C);
424 if (augmentedObj_ && statObj_vec_ != nullPtr) {
425 statObj_vec_->setScalar(C);
426 }
427 if (augmentedCon_) {
428 int size = statCon_vec_.size();
429 for (int i = 0; i < size; ++i) {
430 if (statCon_vec_[i] != nullPtr) {
431 statCon_vec_[i]->setScalar(C);
432 }
433 }
434 }
435 }
436
437 void randomize( const Real l=0.0, const Real u=1.0 ) {
438 vec_->randomize(l,u);
439 if (augmentedObj_ && statObj_vec_ != nullPtr) {
440 statObj_vec_->randomize(l,u);
441 }
442 if (augmentedCon_) {
443 int size = statCon_vec_.size();
444 for (int i = 0; i < size; ++i) {
445 if (statCon_vec_[i] != nullPtr) {
446 statCon_vec_[i]->randomize(l,u);
447 }
448 }
449 }
450 }
451
452 int dimension(void) const {
453 int dim = vec_->dimension();
454 if (augmentedObj_) {
455 dim += statObj_vec_->dimension();
456 }
457 if (augmentedCon_) {
458 int size = statCon_vec_.size();
459 for (int i = 0; i < size; ++i) {
460 if (statCon_vec_[i] != nullPtr) {
461 dim += statCon_vec_[i]->dimension();
462 }
463 }
464 }
465 return dim;
466 }
467
468 /***************************************************************************/
469 /************ ROL VECTOR ACCESSOR FUNCTIONS ********************************/
470 /***************************************************************************/
471 Ptr<const StdVector<Real>>
472 getStatisticVector(const int comp, const int index = 0) const {
473 if (comp == 0) {
474 return statObj_vec_;
475 }
476 else if (comp == 1) {
477 return statCon_vec_[index];
478 }
479 else {
480 throw Exception::NotImplemented(">>> ROL::RiskVector::getStatisticVector: Component must be 0 or 1!");
481 }
482 }
483
484 Ptr<StdVector<Real>>
485 getStatisticVector(const int comp, const int index = 0) {
486 if (comp == 0) {
487 return statObj_vec_;
488 }
489 else if (comp == 1) {
490 return statCon_vec_[index];
491 }
492 else {
493 throw Exception::NotImplemented(">>> ROL::RiskVector::getStatistic: Component must be 0 or 1!");
494 }
495 }
496
497 Ptr<const Vector<Real> > getVector(void) const {
498 return vec_;
499 }
500
501 Ptr<Vector<Real> > getVector(void) {
502 return vec_;
503 }
504
505 /***************************************************************************/
506 /************ COMPONENT ACCESSOR FUNCTIONS *********************************/
507 /***************************************************************************/
508 Ptr<std::vector<Real>>
509 getStatistic(const int comp = 0, const int index = 0) {
510 if (comp == 0) {
511 if (augmentedObj_) {
512 return statObj_;
513 }
514 }
515 else if (comp == 1) {
516 if (augmentedCon_) {
517 return statCon_[index];
518 }
519 }
520 else {
521 throw Exception::NotImplemented(">>> ROL::RiskVector::getStatistic: Component must be 0 or 1!");
522 }
523 return nullPtr;
524 }
525
526 Ptr<const std::vector<Real>>
527 getStatistic(const int comp = 0, const int index = 0) const {
528 if (comp == 0) {
529 if (augmentedObj_) {
530 return statObj_;
531 }
532 }
533 else if (comp == 1) {
534 if (augmentedCon_) {
535 return statCon_[index];
536 }
537 }
538 else {
539 throw Exception::NotImplemented(">>> ROL::RiskVector::getStatistic: Component must be 0 or 1!");
540 }
541 return nullPtr;
542 }
543
544 void setStatistic(const Real stat, const int comp = 0, const int index = 0) {
545 if ( comp == 0 ) {
546 if ( augmentedObj_ ) {
547 statObj_->assign(nStatObj_,stat);
548 }
549 }
550 else if ( comp == 1 ) {
551 if ( augmentedCon_ ) {
552 statCon_[index]->assign(nStatCon_[index],stat);
553 }
554 }
555 else {
556 throw Exception::NotImplemented(">>> ROL::RiskVector::setStatistic: Component must be 0 or 1!");
557 }
558 }
559
560 void setStatistic(const std::vector<Real> &stat, const int comp = 0, const int index = 0) {
561 if ( comp == 0 ) {
562 if ( augmentedObj_ ) {
563 if ( nStatObj_ != static_cast<int>(stat.size()) ) {
564 throw Exception::NotImplemented(">>> ROL::RiskVector::setStatistic: Dimension mismatch!");
565 }
566 statObj_->assign(stat.begin(),stat.end());
567 }
568 }
569 else if ( comp == 1) {
570 if ( augmentedCon_ ) {
571 if ( nStatCon_[index] != static_cast<int>(stat.size()) ) {
572 throw Exception::NotImplemented(">>> ROL::RiskVector::setStatistic: Dimension mismatch!");
573 }
574 statCon_[index]->assign(stat.begin(),stat.end());
575 }
576 }
577 else {
578 throw Exception::NotImplemented(">>> ROL::RiskVector::setStatistic: Component must be 0 or 1!");
579 }
580 }
581
582 void setVector(const Vector<Real>& vec) {
583 vec_->set(vec);
584 }
585};
586
587}
588
589#endif
Ptr< std::vector< Real > > getStatistic(const int comp=0, const int index=0)
Ptr< Vector< Real > > basis(const int i) const
Return i-th basis vector.
Ptr< const StdVector< Real > > getStatisticVector(const int comp, const int index=0) const
Ptr< Vector< Real > > getVector(void)
void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
Ptr< StdVector< Real > > getStatisticVector(const int comp, const int index=0)
RiskVector(const Ptr< Vector< Real > > &vec)
void plus(const Vector< Real > &x)
Compute , where .
std::vector< int > nStatCon_
int dimension(void) const
Return dimension of the vector space.
void setScalar(const Real C)
Set where .
void initializeObj(Ptr< ParameterList > &parlist, const Real stat=1)
void setStatistic(const std::vector< Real > &stat, const int comp=0, const int index=0)
std::vector< Ptr< StdVector< Real > > > statCon_vec_
void setStatistic(const Real stat, const int comp=0, const int index=0)
Ptr< Vector< Real > > vec_
RiskVector(Ptr< ParameterList > &parlist, const Ptr< Vector< Real > > &vec, const Real stat=0)
void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector< Real > &x)
Ptr< Vector< Real > > dual_vec1_
Ptr< const std::vector< Real > > getStatistic(const int comp=0, const int index=0) const
void scale(const Real alpha)
Compute where .
Ptr< RiskVector< Real > > dual_vec_
Ptr< std::vector< Real > > statObj_
Real dot(const Vector< Real > &x) const
Compute where .
RiskVector(std::vector< Ptr< ParameterList > > &parlist, const Ptr< Vector< Real > > &vec, const Real stat=0)
Ptr< Vector< Real > > clone(void) const
Clone to make a new (uninitialized) vector.
void initializeCon(std::vector< Ptr< ParameterList > > &parlist, const Real stat=1)
Ptr< const Vector< Real > > getVector(void) const
std::vector< Ptr< std::vector< Real > > > dualCon_
const Vector< Real > & dual(void) const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
void set(const Vector< Real > &x)
Set where .
void applyUnary(const Elementwise::UnaryFunction< Real > &f)
void randomize(const Real l=0.0, const Real u=1.0)
Set vector to be uniform random between [l,u].
Real reduce(const Elementwise::ReductionOp< Real > &r) const
void setVector(const Vector< Real > &vec)
Ptr< std::vector< Real > > dualObj_
std::vector< Ptr< std::vector< Real > > > statCon_
RiskVector(const Ptr< Vector< Real > > &vec, const Ptr< std::vector< Real > > &statObj, const std::vector< Ptr< std::vector< Real > > > &statCon)
Ptr< StdVector< Real > > statObj_vec_
RiskVector(Ptr< ParameterList > &parlistObj, std::vector< Ptr< ParameterList > > &parlistCon, const Ptr< Vector< Real > > &vec, const Real stat=0)
Real norm(void) const
Returns where .
Defines the linear algebra or vector space interface.
constexpr auto dim