10 #ifndef ROL_STOCHASTICPROBLEM_DEF_HPP
11 #define ROL_STOCHASTICPROBLEM_DEF_HPP
15 template<
typename Real>
19 :
Problem<Real>(obj,x,g), needRiskLessObj_(true) {}
21 template<
typename Real>
27 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
28 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Cannot set stochastic objective after problem has been finalized!");
30 ROL_TEST_FOR_EXCEPTION(fsampler == nullPtr,std::invalid_argument,
31 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Objective function value sampler is null!");
33 ORIGINAL_obj_ = INPUT_obj_;
35 Ptr<SampleGenerator<Real>> _gsampler, _hsampler;
36 _gsampler = (gsampler == nullPtr ? fsampler : gsampler);
37 _hsampler = (hsampler == nullPtr ? _gsampler : hsampler);
39 std::string type = list.sublist(
"SOL").sublist(
"Objective").get(
"Type",
"Risk Neutral");
40 if ( type ==
"Risk Neutral" ) {
41 needRiskLessObj_ =
true;
43 bool storage = list.sublist(
"SOL").sublist(
"Objective").sublist(
"Risk Neutral").get(
"Use Storage",
true);
44 INPUT_obj_ = makePtr<RiskNeutralObjective<Real>>(ORIGINAL_obj_,fsampler,_gsampler,_hsampler,storage);
46 else if ( type ==
"Risk Averse" || type ==
"Deviation" || type ==
"Error" ||
47 type ==
"Regret" || type ==
"Probability" ) {
48 needRiskLessObj_ =
false;
49 objList_ = makePtr<ParameterList>();
50 objList_->sublist(
"SOL") = list.sublist(
"SOL").sublist(
"Objective");
51 INPUT_obj_ = makePtr<StochasticObjective<Real>>(ORIGINAL_obj_,*objList_,fsampler,_gsampler,_hsampler);
53 else if ( type ==
"Mean Value" ) {
54 needRiskLessObj_ =
true;
56 INPUT_obj_ = makePtr<MeanValueObjective<Real>>(ORIGINAL_obj_,fsampler);
59 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
60 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Invalid stochastic optimization type!");
64 template<
typename Real>
71 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
72 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Cannot set stochastic objective after problem has been finalized!");
74 ROL_TEST_FOR_EXCEPTION(fsampler == nullPtr,std::invalid_argument,
75 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Objective function value sampler is null!");
77 ROL_TEST_FOR_EXCEPTION(rvf == nullPtr,std::invalid_argument,
78 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Risk measure is null!");
80 ORIGINAL_obj_ = INPUT_obj_;
82 Ptr<SampleGenerator<Real>> _gsampler, _hsampler;
83 _gsampler = (gsampler == nullPtr ? fsampler : gsampler);
84 _hsampler = (hsampler == nullPtr ? _gsampler : hsampler);
86 needRiskLessObj_ =
false;
87 objList_ = makePtr<ParameterList>();
90 INPUT_obj_ = makePtr<StochasticObjective<Real>>(ORIGINAL_obj_,rvf,fsampler,_gsampler,_hsampler);
93 template<
typename Real>
99 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
100 ">>> ROL::StochasticProblem::makeConstraintStochastic: Cannot set stochastic constraint after problem has been finalized!");
102 ROL_TEST_FOR_EXCEPTION(sampler == nullPtr,std::invalid_argument,
103 ">>> ROL::StochasticProblem::makeConstraintStochastic: Constraint sampler is null!");
105 auto it = INPUT_con_.find(name);
106 ROL_TEST_FOR_EXCEPTION(it == INPUT_con_.end(),std::invalid_argument,
107 ">>> ROL::StochasticProblem::makeConstraintStochastic: Constraint does not exist!");
108 ROL_TEST_FOR_EXCEPTION(ORIGINAL_con_.find(name) != ORIGINAL_con_.end(),std::invalid_argument,
109 ">>> ROL::StochasticProblem::makeConstraintStochastic: Constraint already set!");
110 ORIGINAL_con_.insert({name,it->second});
112 std::string type = list.sublist(
"SOL").sublist(name).get(
"Type",
"Risk Neutral");
113 Ptr<Constraint<Real>> con = it->second.constraint;
114 Ptr<Vector<Real>> mul = it->second.multiplier;
115 Ptr<Vector<Real>> res = it->second.residual;
116 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
117 if ( type ==
"Risk Neutral" ) {
118 ROL_TEST_FOR_EXCEPTION(bman == nullPtr,std::invalid_argument,
119 ">>> ROL::StochasticProblem::makeConstraintStochastic: Risk neutral constraints need a valid BatchManager!");
120 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(nullPtr,
true)});
121 con = makePtr<RiskNeutralConstraint<Real>>(it->second.constraint,sampler,bman);
123 else if ( type ==
"Almost Sure" ) {
124 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(nullPtr,
true)});
125 int nsamp = sampler->numMySamples();
126 con = makePtr<AlmostSureConstraint<Real>>(sampler,it->second.constraint);
127 std::vector<Ptr<Vector<Real>>> mvec(nsamp,nullPtr), rvec(nsamp,nullPtr);
128 for (
int j = 0; j < nsamp; ++j) {
129 mvec[j] = mul->clone(); mvec[j]->set(*mul);
130 rvec[j] = res->clone(); rvec[j]->set(*res);
132 mul = makePtr<DualSimulatedVector<Real>>(mvec,sampler->getBatchManager(),sampler);
133 res = makePtr<PrimalSimulatedVector<Real>>(rvec,sampler->getBatchManager(),sampler);
135 bnd = makePtr<SimulatedBoundConstraint<Real>>(sampler, bnd);
137 else if ( type ==
"Risk Averse" || type ==
"Deviation" || type ==
"Error" ||
138 type ==
"Regret" || type ==
"Probability" ) {
139 ROL_TEST_FOR_EXCEPTION(bnd == nullPtr,std::invalid_argument,
140 ">>> ROL::StochasticProblem::makeConstraintStochastic: Stochastic constraints must be inequalities!");
141 Ptr<ParameterList> clist = makePtr<ParameterList>();
142 clist->sublist(
"SOL") = list.sublist(
"SOL").sublist(name);
143 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(clist,
false)});
144 con = makePtr<StochasticConstraint<Real>>(it->second.constraint,sampler,*clist);
146 else if ( type ==
"Mean Value" ) {
147 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(nullPtr,
true)});
148 con = makePtr<MeanValueConstraint<Real>>(it->second.constraint,sampler);
151 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
152 ">>> ROL::StochasticProblem::makeConstraintStochastic: Invalid stochastic optimization type!");
159 template<
typename Real>
165 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
166 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Cannot set stochastic constraint after problem has been finalized!");
168 ROL_TEST_FOR_EXCEPTION(sampler == nullPtr,std::invalid_argument,
169 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Constraint sampler is null!");
171 auto it = INPUT_linear_con_.find(name);
172 ROL_TEST_FOR_EXCEPTION(it == INPUT_linear_con_.end(),std::invalid_argument,
173 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Constraint does not exist!");
174 ROL_TEST_FOR_EXCEPTION(ORIGINAL_linear_con_.find(name) != ORIGINAL_linear_con_.end(),std::invalid_argument,
175 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Constraint already set!");
176 ORIGINAL_linear_con_.insert({name,it->second});
178 std::string type = list.sublist(
"SOL").sublist(name).get(
"Type",
"Risk Neutral");
179 Ptr<Constraint<Real>> con = it->second.constraint;
180 Ptr<Vector<Real>> mul = it->second.multiplier;
181 Ptr<Vector<Real>> res = it->second.residual;
182 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
183 if ( type ==
"Risk Neutral" ) {
184 ROL_TEST_FOR_EXCEPTION(bman == nullPtr,std::invalid_argument,
185 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Risk neutral constraints need a valid BatchManager!");
186 con = makePtr<RiskNeutralConstraint<Real>>(it->second.constraint,sampler,bman);
188 else if ( type ==
"Almost Sure" ) {
189 int nsamp = sampler->numMySamples();
190 con = makePtr<AlmostSureConstraint<Real>>(sampler,it->second.constraint);
191 std::vector<Ptr<Vector<Real>>> mvec(nsamp,nullPtr), rvec(nsamp,nullPtr);
192 for (
int j = 0; j < nsamp; ++j) {
193 mvec[j] = mul->clone(); mvec[j]->set(*mul);
194 rvec[j] = res->clone(); rvec[j]->set(*res);
196 mul = makePtr<DualSimulatedVector<Real>>(mvec,sampler->getBatchManager(),sampler);
197 res = makePtr<PrimalSimulatedVector<Real>>(rvec,sampler->getBatchManager(),sampler);
199 bnd = makePtr<SimulatedBoundConstraint<Real>>(sampler, bnd);
201 else if ( type ==
"Mean Value" ) {
202 con = makePtr<MeanValueConstraint<Real>>(it->second.constraint,sampler);
205 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
206 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Invalid stochastic optimization type!");
213 template<
typename Real>
215 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
216 ">>> ROL::StochasticProblem::resetStochasticObjective: Cannot reset stochastic objective after problem has been finalized!");
217 if (ORIGINAL_obj_ != nullPtr) {
218 INPUT_obj_ = ORIGINAL_obj_;
219 needRiskLessObj_ =
true;
222 ORIGINAL_obj_ = nullPtr;
225 template<
typename Real>
227 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
228 ">>> ROL::StochasticProblem::resetStochasticConstraint: Cannot reset stochastic constraint after problem has been finalized!");
229 auto it = ORIGINAL_con_.find(name);
230 if (it != ORIGINAL_con_.end()) {
231 Ptr<Constraint<Real>> con = it->second.constraint;
232 Ptr<Vector<Real>> mul = it->second.multiplier;
233 Ptr<Vector<Real>> res = it->second.residual;
234 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
238 conList_.erase(conList_.find(name));
239 ORIGINAL_con_.erase(it);
243 template<
typename Real>
245 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
246 ">>> ROL::StochasticProblem::resetStochasticLinearConstraint: Cannot reset stochastic constraint after problem has been finalized!");
247 auto it = ORIGINAL_linear_con_.find(name);
248 if (it != ORIGINAL_linear_con_.end()) {
249 Ptr<Constraint<Real>> con = it->second.constraint;
250 Ptr<Vector<Real>> mul = it->second.multiplier;
251 Ptr<Vector<Real>> res = it->second.residual;
252 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
256 ORIGINAL_linear_con_.erase(it);
260 template<
typename Real>
262 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
263 ">>> ROL::StochasticProblem::reset: Cannot reset stochastic problem after problem has been finalized!");
265 resetStochasticObjective();
267 std::vector<std::string> names;
268 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
269 names.push_back(it->first);
271 for (
auto it = names.begin(); it != names.end(); ++it) {
272 resetStochasticConstraint(*it);
276 for (
auto it = INPUT_linear_con_.begin(); it != INPUT_linear_con_.end(); ++it) {
277 names.push_back(it->first);
279 for (
auto it = names.begin(); it != names.end(); ++it) {
280 resetStochasticLinearConstraint(*it);
283 if (ORIGINAL_xprim_ != nullPtr) {
284 INPUT_xprim_ = ORIGINAL_xprim_;
285 ORIGINAL_xprim_ = nullPtr;
288 if (ORIGINAL_xdual_ != nullPtr) {
289 INPUT_xdual_ = ORIGINAL_xdual_;
290 ORIGINAL_xdual_ = nullPtr;
293 if (ORIGINAL_bnd_ != nullPtr) {
294 INPUT_bnd_ = ORIGINAL_bnd_;
295 ORIGINAL_bnd_ = nullPtr;
299 template<
typename Real>
301 ROL_TEST_FOR_EXCEPTION(!isFinalized(),std::invalid_argument,
302 ">>> ROL::StochasticProblem::getObjectiveStatistic: Cannot get statistic if problem has not been finalized!");
304 Ptr<std::vector<Real>> stat
305 = dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->getStatistic();
306 if (stat != nullPtr)
return *stat;
307 else return std::vector<Real>();
309 catch (std::exception &e) {
310 return std::vector<Real>();
314 template<
typename Real>
316 ROL_TEST_FOR_EXCEPTION(!isFinalized(),std::invalid_argument,
317 ">>> ROL::StochasticProblem::getConstraintStatistic: Cannot get statistic if problem has not been finalized!");
318 auto it = statMap_.find(name);
319 ROL_TEST_FOR_EXCEPTION(it==statMap_.end(),std::invalid_argument,
320 ">>> ROL::StochasticProblem::getConstraintStatistic: Constraint does not exist!");
322 Ptr<std::vector<Real>> stat
323 = dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->getStatistic(1,it->second);
324 if (stat != nullPtr)
return *stat;
325 else return std::vector<Real>();
327 catch (std::exception &e) {
328 return std::vector<Real>();
332 template<
typename Real>
334 ROL_TEST_FOR_EXCEPTION(!isFinalized(),std::invalid_argument,
335 ">>> ROL::StochasticProblem::getConstraintStatistic: Cannot get statistic if problem has not been finalized!");
336 ROL_TEST_FOR_EXCEPTION(comp>1||comp<0,std::invalid_argument,
337 ">>> ROL::StochasticProblem::getSolutionStatistic: Component must be either 0 or 1!");
341 val = dynamicPtrCast<StochasticObjective<Real>>(INPUT_obj_)->computeStatistic(*INPUT_xprim_);
343 catch (std::exception &e) {
344 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
345 ">>> ROL::StochasticProblem::getSolutionStatistic: Objective does not have a computeStatistic function!");
349 auto it = statMap_.find(name);
350 ROL_TEST_FOR_EXCEPTION(it==statMap_.end(),std::invalid_argument,
351 ">>> ROL::StochasticProblem::getSolutionStatistic: Constraint does not exist!");
353 auto it2 = INPUT_con_.find(name);
354 val = dynamicPtrCast<StochasticConstraint<Real>>(it2->second.constraint)->computeStatistic(*INPUT_xprim_);
356 catch (std::exception &e) {
357 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
358 ">>> ROL::StochasticProblem::getSolutionStatistic: Constraint does not have a computeStatistic function!");
364 template<
typename Real>
367 std::vector<Ptr<ParameterList>> conList;
369 risk_ = !needRiskLessObj_;
371 needRiskLessCon_.clear();
373 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
374 auto it2 = conList_.find(it->first);
375 if (it2==conList_.end()) {
376 conList.push_back(nullPtr);
377 needRiskLessCon_.push_back(
true);
380 conList.push_back(std::get<0>(it2->second));
381 needRiskLessCon_.push_back(std::get<1>(it2->second));
382 flag = std::get<1>(it2->second);
384 dynamicPtrCast<StochasticConstraint<Real>>(it->second.constraint)->setIndex(cnt);
388 statMap_.insert({it->first,cnt});
393 if (needRiskLessObj_) {
394 Ptr<Objective<Real>> obj = INPUT_obj_;
395 INPUT_obj_ = makePtr<RiskLessObjective<Real>>(obj);
398 ORIGINAL_xprim_ = INPUT_xprim_;
399 INPUT_xprim_ = makePtr<RiskVector<Real>>(objList_,conList,ORIGINAL_xprim_);
400 ORIGINAL_xdual_ = INPUT_xdual_;
401 INPUT_xdual_ = makePtr<RiskVector<Real>>(objList_,conList,ORIGINAL_xdual_);
402 if (objList_ != nullPtr) {
403 Real statObj = objList_->sublist(
"SOL").get(
"Initial Statistic",1.0);
404 dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->setStatistic(statObj,0);
406 for (
size_t i = 0; i < conList.size(); ++i) {
407 if (conList[i] != nullPtr) {
408 Real statCon = conList[i]->sublist(
"SOL").get(
"Initial Statistic",1.0);
409 dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->setStatistic(statCon,1,i);
413 if (INPUT_bnd_ != nullPtr) {
414 ORIGINAL_bnd_ = INPUT_bnd_;
415 INPUT_bnd_ = makePtr<RiskBoundConstraint<Real>>(objList_,conList,ORIGINAL_bnd_);
419 std::unordered_map<std::string,ConstraintData<Real>> riskless_con;
420 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
421 if (needRiskLessCon_[cnt]) {
422 Ptr<Constraint<Real>> con = makePtr<RiskLessConstraint<Real>>(it->second.constraint);
423 Ptr<Vector<Real>> mul = it->second.multiplier;
424 Ptr<Vector<Real>> res = it->second.residual;
425 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
427 if (ORIGINAL_con_.count(it->first) == size_t(0))
432 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
433 Ptr<Constraint<Real>> con = it->second.constraint;
434 Ptr<Vector<Real>> mul = it->second.multiplier;
435 Ptr<Vector<Real>> res = it->second.residual;
436 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
442 riskless_con.clear();
443 for (
auto it = INPUT_linear_con_.begin(); it != INPUT_linear_con_.end(); ++it) {
444 Ptr<Constraint<Real>> con = makePtr<RiskLessConstraint<Real>>(it->second.constraint);
445 Ptr<Vector<Real>> mul = it->second.multiplier;
446 Ptr<Vector<Real>> res = it->second.residual;
447 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
449 if (ORIGINAL_linear_con_.count(it->first) == size_t(0))
450 ORIGINAL_linear_con_.insert({it->first,
ConstraintData<Real>(it->second.constraint,mul,res,bnd)});
452 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
453 Ptr<Constraint<Real>> con = it->second.constraint;
454 Ptr<Vector<Real>> mul = it->second.multiplier;
455 Ptr<Vector<Real>> res = it->second.residual;
456 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
467 template<
typename Real>
472 if (needRiskLessObj_ && ORIGINAL_obj_ != nullPtr) {
473 INPUT_obj_ = ORIGINAL_obj_;
474 ORIGINAL_obj_ = nullPtr;
476 if (ORIGINAL_xprim_ != nullPtr) INPUT_xprim_ = ORIGINAL_xprim_;
477 if (ORIGINAL_xdual_ != nullPtr) INPUT_xdual_ = ORIGINAL_xdual_;
478 if (ORIGINAL_bnd_ != nullPtr) INPUT_bnd_ = ORIGINAL_bnd_;
479 ORIGINAL_xprim_ = nullPtr;
480 ORIGINAL_xdual_ = nullPtr;
481 ORIGINAL_bnd_ = nullPtr;
484 std::unordered_map<std::string,ConstraintData<Real>> riskless_con;
485 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
486 if (needRiskLessCon_[cnt]) {
487 Ptr<Constraint<Real>> con = it->second.constraint;
488 Ptr<Vector<Real>> mul = it->second.multiplier;
489 Ptr<Vector<Real>> res = it->second.residual;
490 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
495 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
496 auto it2 = ORIGINAL_con_.find(it->first);
497 if (it2 != ORIGINAL_con_.end()) {
498 Ptr<Constraint<Real>> con = it2->second.constraint;
499 Ptr<Vector<Real>> mul = it2->second.multiplier;
500 Ptr<Vector<Real>> res = it2->second.residual;
501 Ptr<BoundConstraint<Real>> bnd = it2->second.bounds;
505 ORIGINAL_con_.erase(it2);
509 riskless_con.clear();
510 for (
auto it = INPUT_linear_con_.begin(); it != INPUT_linear_con_.end(); ++it) {
511 Ptr<Constraint<Real>> con = it->second.constraint;
512 Ptr<Vector<Real>> mul = it->second.multiplier;
513 Ptr<Vector<Real>> res = it->second.residual;
514 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
517 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
518 auto it2 = ORIGINAL_linear_con_.find(it->first);
519 if (it2 != ORIGINAL_linear_con_.end()) {
520 Ptr<Constraint<Real>> con = it2->second.constraint;
521 Ptr<Vector<Real>> mul = it2->second.multiplier;
522 Ptr<Vector<Real>> res = it2->second.residual;
523 Ptr<BoundConstraint<Real>> bnd = it2->second.bounds;
527 ORIGINAL_linear_con_.erase(it2);
532 needRiskLessCon_.clear();
538 #endif // ROL_STOCHASTICPROBLEM_DEF_HPP
Provides the interface to evaluate objective functions.
void makeConstraintStochastic(std::string name, ParameterList &list, const Ptr< SampleGenerator< Real >> &sampler, const Ptr< BatchManager< Real >> &bman=nullPtr)
void addLinearConstraint(std::string name, const Ptr< Constraint< Real >> &linear_econ, const Ptr< Vector< Real >> &linear_emul, const Ptr< Vector< Real >> &linear_eres=nullPtr, bool reset=false)
Add a linear equality constraint.
void resetStochasticLinearConstraint(std::string name)
std::vector< Real > getConstraintStatistic(std::string name) const
void removeLinearConstraint(std::string name)
Remove an existing linear constraint.
StochasticProblem(const Ptr< Objective< Real >> &obj, const Ptr< Vector< Real >> &x, const Ptr< Vector< Real >> &g=nullPtr)
Default constructor for StochasticProblem.
Real getSolutionStatistic(int comp=0, std::string name="") const
Defines the linear algebra or vector space interface.
virtual void finalize(bool lumpConstraints=false, bool printToStream=false, std::ostream &outStream=std::cout)
Tranform user-supplied constraints to consist of only bounds and equalities. Optimization problem can...
std::vector< Real > getObjectiveStatistic(void) const
void resetStochasticObjective(void)
void addConstraint(std::string name, const Ptr< Constraint< Real >> &econ, const Ptr< Vector< Real >> &emul, const Ptr< Vector< Real >> &eres=nullPtr, bool reset=false)
Add an equality constraint.
void resetStochasticConstraint(std::string name)
void removeConstraint(std::string name)
Remove an existing constraint.
Provides the interface to implement any functional that maps a random variable to a (extended) real n...
void edit(void) override
Resume editting optimization problem after finalize has been called.
virtual void edit()
Resume editting optimization problem after finalize has been called.
void makeObjectiveStochastic(ParameterList &list, const Ptr< SampleGenerator< Real >> &fsampler, const Ptr< SampleGenerator< Real >> &gsampler=nullPtr, const Ptr< SampleGenerator< Real >> &hsampler=nullPtr)
void makeLinearConstraintStochastic(std::string name, ParameterList &list, const Ptr< SampleGenerator< Real >> &sampler, const Ptr< BatchManager< Real >> &bman=nullPtr)
void resetStochastic(void)
void finalize(bool lumpConstraints=false, bool printToStream=false, std::ostream &outStream=std::cout) override
Tranform user-supplied constraints to consist of only bounds and equalities. Optimization problem can...