44 #ifndef ROL_STOCHASTICPROBLEM_DEF_HPP
45 #define ROL_STOCHASTICPROBLEM_DEF_HPP
49 template<
typename Real>
53 :
Problem<Real>(obj,x,g), needRiskLessObj_(true) {}
55 template<
typename Real>
61 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
62 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Cannot set stochastic objective after problem has been finalized!");
64 ROL_TEST_FOR_EXCEPTION(fsampler == nullPtr,std::invalid_argument,
65 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Objective function value sampler is null!");
67 ORIGINAL_obj_ = INPUT_obj_;
69 Ptr<SampleGenerator<Real>> _gsampler, _hsampler;
70 _gsampler = (gsampler == nullPtr ? fsampler : gsampler);
71 _hsampler = (hsampler == nullPtr ? _gsampler : hsampler);
73 std::string type = list.sublist(
"SOL").sublist(
"Objective").get(
"Type",
"Risk Neutral");
74 if ( type ==
"Risk Neutral" ) {
75 needRiskLessObj_ =
true;
77 bool storage = list.sublist(
"SOL").sublist(
"Objective").sublist(
"Risk Neutral").get(
"Use Storage",
true);
78 INPUT_obj_ = makePtr<RiskNeutralObjective<Real>>(ORIGINAL_obj_,fsampler,_gsampler,_hsampler,storage);
80 else if ( type ==
"Risk Averse" || type ==
"Deviation" || type ==
"Error" ||
81 type ==
"Regret" || type ==
"Probability" ) {
82 needRiskLessObj_ =
false;
83 objList_ = makePtr<ParameterList>();
84 objList_->sublist(
"SOL") = list.sublist(
"SOL").sublist(
"Objective");
85 INPUT_obj_ = makePtr<StochasticObjective<Real>>(ORIGINAL_obj_,*objList_,fsampler,_gsampler,_hsampler);
87 else if ( type ==
"Mean Value" ) {
88 needRiskLessObj_ =
true;
90 INPUT_obj_ = makePtr<MeanValueObjective<Real>>(ORIGINAL_obj_,fsampler);
93 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
94 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Invalid stochastic optimization type!");
98 template<
typename Real>
105 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
106 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Cannot set stochastic objective after problem has been finalized!");
108 ROL_TEST_FOR_EXCEPTION(fsampler == nullPtr,std::invalid_argument,
109 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Objective function value sampler is null!");
111 ROL_TEST_FOR_EXCEPTION(rvf == nullPtr,std::invalid_argument,
112 ">>> ROL::StochasticProblem::makeObjectiveStochastic: Risk measure is null!");
114 ORIGINAL_obj_ = INPUT_obj_;
116 Ptr<SampleGenerator<Real>> _gsampler, _hsampler;
117 _gsampler = (gsampler == nullPtr ? fsampler : gsampler);
118 _hsampler = (hsampler == nullPtr ? _gsampler : hsampler);
120 needRiskLessObj_ =
false;
121 objList_ = makePtr<ParameterList>();
124 INPUT_obj_ = makePtr<StochasticObjective<Real>>(ORIGINAL_obj_,rvf,fsampler,_gsampler,_hsampler);
127 template<
typename Real>
133 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
134 ">>> ROL::StochasticProblem::makeConstraintStochastic: Cannot set stochastic constraint after problem has been finalized!");
136 ROL_TEST_FOR_EXCEPTION(sampler == nullPtr,std::invalid_argument,
137 ">>> ROL::StochasticProblem::makeConstraintStochastic: Constraint sampler is null!");
139 auto it = INPUT_con_.find(name);
140 ROL_TEST_FOR_EXCEPTION(it == INPUT_con_.end(),std::invalid_argument,
141 ">>> ROL::StochasticProblem::makeConstraintStochastic: Constraint does not exist!");
142 ROL_TEST_FOR_EXCEPTION(ORIGINAL_con_.find(name) != ORIGINAL_con_.end(),std::invalid_argument,
143 ">>> ROL::StochasticProblem::makeConstraintStochastic: Constraint already set!");
144 ORIGINAL_con_.insert({name,it->second});
146 std::string type = list.sublist(
"SOL").sublist(name).get(
"Type",
"Risk Neutral");
147 Ptr<Constraint<Real>> con = it->second.constraint;
148 Ptr<Vector<Real>> mul = it->second.multiplier;
149 Ptr<Vector<Real>> res = it->second.residual;
150 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
151 if ( type ==
"Risk Neutral" ) {
152 ROL_TEST_FOR_EXCEPTION(bman == nullPtr,std::invalid_argument,
153 ">>> ROL::StochasticProblem::makeConstraintStochastic: Risk neutral constraints need a valid BatchManager!");
154 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(nullPtr,
true)});
155 con = makePtr<RiskNeutralConstraint<Real>>(it->second.constraint,sampler,bman);
157 else if ( type ==
"Almost Sure" ) {
158 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(nullPtr,
true)});
159 int nsamp = sampler->numMySamples();
160 con = makePtr<AlmostSureConstraint<Real>>(sampler,it->second.constraint);
161 std::vector<Ptr<Vector<Real>>> mvec(nsamp,nullPtr), rvec(nsamp,nullPtr);
162 for (
int j = 0; j < nsamp; ++j) {
163 mvec[j] = mul->clone(); mvec[j]->set(*mul);
164 rvec[j] = res->clone(); rvec[j]->set(*res);
166 mul = makePtr<DualSimulatedVector<Real>>(mvec,sampler->getBatchManager(),sampler);
167 res = makePtr<PrimalSimulatedVector<Real>>(rvec,sampler->getBatchManager(),sampler);
169 bnd = makePtr<SimulatedBoundConstraint<Real>>(sampler, bnd);
171 else if ( type ==
"Risk Averse" || type ==
"Deviation" || type ==
"Error" ||
172 type ==
"Regret" || type ==
"Probability" ) {
173 ROL_TEST_FOR_EXCEPTION(bnd == nullPtr,std::invalid_argument,
174 ">>> ROL::StochasticProblem::makeConstraintStochastic: Stochastic constraints must be inequalities!");
175 Ptr<ParameterList> clist = makePtr<ParameterList>();
176 clist->sublist(
"SOL") = list.sublist(
"SOL").sublist(name);
177 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(clist,
false)});
178 con = makePtr<StochasticConstraint<Real>>(it->second.constraint,sampler,*clist);
180 else if ( type ==
"Mean Value" ) {
181 conList_.insert({name,std::pair<Ptr<ParameterList>,
bool>(nullPtr,
true)});
182 con = makePtr<MeanValueConstraint<Real>>(it->second.constraint,sampler);
185 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
186 ">>> ROL::StochasticProblem::makeConstraintStochastic: Invalid stochastic optimization type!");
193 template<
typename Real>
199 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
200 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Cannot set stochastic constraint after problem has been finalized!");
202 ROL_TEST_FOR_EXCEPTION(sampler == nullPtr,std::invalid_argument,
203 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Constraint sampler is null!");
205 auto it = INPUT_linear_con_.find(name);
206 ROL_TEST_FOR_EXCEPTION(it == INPUT_linear_con_.end(),std::invalid_argument,
207 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Constraint does not exist!");
208 ROL_TEST_FOR_EXCEPTION(ORIGINAL_linear_con_.find(name) != ORIGINAL_linear_con_.end(),std::invalid_argument,
209 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Constraint already set!");
210 ORIGINAL_linear_con_.insert({name,it->second});
212 std::string type = list.sublist(
"SOL").sublist(name).get(
"Type",
"Risk Neutral");
213 Ptr<Constraint<Real>> con = it->second.constraint;
214 Ptr<Vector<Real>> mul = it->second.multiplier;
215 Ptr<Vector<Real>> res = it->second.residual;
216 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
217 if ( type ==
"Risk Neutral" ) {
218 ROL_TEST_FOR_EXCEPTION(bman == nullPtr,std::invalid_argument,
219 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Risk neutral constraints need a valid BatchManager!");
220 con = makePtr<RiskNeutralConstraint<Real>>(it->second.constraint,sampler,bman);
222 else if ( type ==
"Almost Sure" ) {
223 int nsamp = sampler->numMySamples();
224 con = makePtr<AlmostSureConstraint<Real>>(sampler,it->second.constraint);
225 std::vector<Ptr<Vector<Real>>> mvec(nsamp,nullPtr), rvec(nsamp,nullPtr);
226 for (
int j = 0; j < nsamp; ++j) {
227 mvec[j] = mul->clone(); mvec[j]->set(*mul);
228 rvec[j] = res->clone(); rvec[j]->set(*res);
230 mul = makePtr<DualSimulatedVector<Real>>(mvec,sampler->getBatchManager(),sampler);
231 res = makePtr<PrimalSimulatedVector<Real>>(rvec,sampler->getBatchManager(),sampler);
233 bnd = makePtr<SimulatedBoundConstraint<Real>>(sampler, bnd);
235 else if ( type ==
"Mean Value" ) {
236 con = makePtr<MeanValueConstraint<Real>>(it->second.constraint,sampler);
239 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
240 ">>> ROL::StochasticProblem::makeLinearConstraintStochastic: Invalid stochastic optimization type!");
247 template<
typename Real>
249 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
250 ">>> ROL::StochasticProblem::resetStochasticObjective: Cannot reset stochastic objective after problem has been finalized!");
251 if (ORIGINAL_obj_ != nullPtr) {
252 INPUT_obj_ = ORIGINAL_obj_;
253 needRiskLessObj_ =
true;
256 ORIGINAL_obj_ = nullPtr;
259 template<
typename Real>
261 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
262 ">>> ROL::StochasticProblem::resetStochasticConstraint: Cannot reset stochastic constraint after problem has been finalized!");
263 auto it = ORIGINAL_con_.find(name);
264 if (it != ORIGINAL_con_.end()) {
265 Ptr<Constraint<Real>> con = it->second.constraint;
266 Ptr<Vector<Real>> mul = it->second.multiplier;
267 Ptr<Vector<Real>> res = it->second.residual;
268 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
272 conList_.erase(conList_.find(name));
273 ORIGINAL_con_.erase(it);
277 template<
typename Real>
279 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
280 ">>> ROL::StochasticProblem::resetStochasticLinearConstraint: Cannot reset stochastic constraint after problem has been finalized!");
281 auto it = ORIGINAL_linear_con_.find(name);
282 if (it != ORIGINAL_linear_con_.end()) {
283 Ptr<Constraint<Real>> con = it->second.constraint;
284 Ptr<Vector<Real>> mul = it->second.multiplier;
285 Ptr<Vector<Real>> res = it->second.residual;
286 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
290 ORIGINAL_linear_con_.erase(it);
294 template<
typename Real>
296 ROL_TEST_FOR_EXCEPTION(isFinalized(),std::invalid_argument,
297 ">>> ROL::StochasticProblem::reset: Cannot reset stochastic problem after problem has been finalized!");
299 resetStochasticObjective();
301 std::vector<std::string> names;
302 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
303 names.push_back(it->first);
305 for (
auto it = names.begin(); it != names.end(); ++it) {
306 resetStochasticConstraint(*it);
310 for (
auto it = INPUT_linear_con_.begin(); it != INPUT_linear_con_.end(); ++it) {
311 names.push_back(it->first);
313 for (
auto it = names.begin(); it != names.end(); ++it) {
314 resetStochasticLinearConstraint(*it);
317 if (ORIGINAL_xprim_ != nullPtr) {
318 INPUT_xprim_ = ORIGINAL_xprim_;
319 ORIGINAL_xprim_ = nullPtr;
322 if (ORIGINAL_xdual_ != nullPtr) {
323 INPUT_xdual_ = ORIGINAL_xdual_;
324 ORIGINAL_xdual_ = nullPtr;
327 if (ORIGINAL_bnd_ != nullPtr) {
328 INPUT_bnd_ = ORIGINAL_bnd_;
329 ORIGINAL_bnd_ = nullPtr;
333 template<
typename Real>
335 ROL_TEST_FOR_EXCEPTION(!isFinalized(),std::invalid_argument,
336 ">>> ROL::StochasticProblem::getObjectiveStatistic: Cannot get statistic if problem has not been finalized!");
338 Ptr<std::vector<Real>> stat
339 = dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->getStatistic();
340 if (stat != nullPtr)
return *stat;
341 else return std::vector<Real>();
343 catch (std::exception &e) {
344 return std::vector<Real>();
348 template<
typename Real>
350 ROL_TEST_FOR_EXCEPTION(!isFinalized(),std::invalid_argument,
351 ">>> ROL::StochasticProblem::getConstraintStatistic: Cannot get statistic if problem has not been finalized!");
352 auto it = statMap_.find(name);
353 ROL_TEST_FOR_EXCEPTION(it==statMap_.end(),std::invalid_argument,
354 ">>> ROL::StochasticProblem::getConstraintStatistic: Constraint does not exist!");
356 Ptr<std::vector<Real>> stat
357 = dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->getStatistic(1,it->second);
358 if (stat != nullPtr)
return *stat;
359 else return std::vector<Real>();
361 catch (std::exception &e) {
362 return std::vector<Real>();
366 template<
typename Real>
368 ROL_TEST_FOR_EXCEPTION(!isFinalized(),std::invalid_argument,
369 ">>> ROL::StochasticProblem::getConstraintStatistic: Cannot get statistic if problem has not been finalized!");
370 ROL_TEST_FOR_EXCEPTION(comp>1||comp<0,std::invalid_argument,
371 ">>> ROL::StochasticProblem::getSolutionStatistic: Component must be either 0 or 1!");
375 val = dynamicPtrCast<StochasticObjective<Real>>(INPUT_obj_)->computeStatistic(*INPUT_xprim_);
377 catch (std::exception &e) {
378 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
379 ">>> ROL::StochasticProblem::getSolutionStatistic: Objective does not have a computeStatistic function!");
383 auto it = statMap_.find(name);
384 ROL_TEST_FOR_EXCEPTION(it==statMap_.end(),std::invalid_argument,
385 ">>> ROL::StochasticProblem::getSolutionStatistic: Constraint does not exist!");
387 auto it2 = INPUT_con_.find(name);
388 val = dynamicPtrCast<StochasticConstraint<Real>>(it2->second.constraint)->computeStatistic(*INPUT_xprim_);
390 catch (std::exception &e) {
391 ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
392 ">>> ROL::StochasticProblem::getSolutionStatistic: Constraint does not have a computeStatistic function!");
398 template<
typename Real>
401 std::vector<Ptr<ParameterList>> conList;
403 risk_ = !needRiskLessObj_;
405 needRiskLessCon_.clear();
407 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
408 auto it2 = conList_.find(it->first);
409 if (it2==conList_.end()) {
410 conList.push_back(nullPtr);
411 needRiskLessCon_.push_back(
true);
414 conList.push_back(std::get<0>(it2->second));
415 needRiskLessCon_.push_back(std::get<1>(it2->second));
416 flag = std::get<1>(it2->second);
418 dynamicPtrCast<StochasticConstraint<Real>>(it->second.constraint)->setIndex(cnt);
422 statMap_.insert({it->first,cnt});
427 if (needRiskLessObj_) {
428 Ptr<Objective<Real>> obj = INPUT_obj_;
429 INPUT_obj_ = makePtr<RiskLessObjective<Real>>(obj);
432 ORIGINAL_xprim_ = INPUT_xprim_;
433 INPUT_xprim_ = makePtr<RiskVector<Real>>(objList_,conList,ORIGINAL_xprim_);
434 ORIGINAL_xdual_ = INPUT_xdual_;
435 INPUT_xdual_ = makePtr<RiskVector<Real>>(objList_,conList,ORIGINAL_xdual_);
436 if (objList_ != nullPtr) {
437 Real statObj = objList_->sublist(
"SOL").get(
"Initial Statistic",1.0);
438 dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->setStatistic(statObj,0);
440 for (
size_t i = 0; i < conList.size(); ++i) {
441 if (conList[i] != nullPtr) {
442 Real statCon = conList[i]->sublist(
"SOL").get(
"Initial Statistic",1.0);
443 dynamicPtrCast<RiskVector<Real>>(INPUT_xprim_)->setStatistic(statCon,1,i);
447 if (INPUT_bnd_ != nullPtr) {
448 ORIGINAL_bnd_ = INPUT_bnd_;
449 INPUT_bnd_ = makePtr<RiskBoundConstraint<Real>>(objList_,conList,ORIGINAL_bnd_);
453 std::unordered_map<std::string,ConstraintData<Real>> riskless_con;
454 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
455 if (needRiskLessCon_[cnt]) {
456 Ptr<Constraint<Real>> con = makePtr<RiskLessConstraint<Real>>(it->second.constraint);
457 Ptr<Vector<Real>> mul = it->second.multiplier;
458 Ptr<Vector<Real>> res = it->second.residual;
459 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
461 if (ORIGINAL_con_.count(it->first) == size_t(0))
466 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
467 Ptr<Constraint<Real>> con = it->second.constraint;
468 Ptr<Vector<Real>> mul = it->second.multiplier;
469 Ptr<Vector<Real>> res = it->second.residual;
470 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
476 riskless_con.clear();
477 for (
auto it = INPUT_linear_con_.begin(); it != INPUT_linear_con_.end(); ++it) {
478 Ptr<Constraint<Real>> con = makePtr<RiskLessConstraint<Real>>(it->second.constraint);
479 Ptr<Vector<Real>> mul = it->second.multiplier;
480 Ptr<Vector<Real>> res = it->second.residual;
481 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
483 if (ORIGINAL_linear_con_.count(it->first) == size_t(0))
484 ORIGINAL_linear_con_.insert({it->first,
ConstraintData<Real>(it->second.constraint,mul,res,bnd)});
486 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
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;
501 template<
typename Real>
506 if (needRiskLessObj_ && ORIGINAL_obj_ != nullPtr) {
507 INPUT_obj_ = ORIGINAL_obj_;
508 ORIGINAL_obj_ = nullPtr;
510 if (ORIGINAL_xprim_ != nullPtr) INPUT_xprim_ = ORIGINAL_xprim_;
511 if (ORIGINAL_xdual_ != nullPtr) INPUT_xdual_ = ORIGINAL_xdual_;
512 if (ORIGINAL_bnd_ != nullPtr) INPUT_bnd_ = ORIGINAL_bnd_;
513 ORIGINAL_xprim_ = nullPtr;
514 ORIGINAL_xdual_ = nullPtr;
515 ORIGINAL_bnd_ = nullPtr;
518 std::unordered_map<std::string,ConstraintData<Real>> riskless_con;
519 for (
auto it = INPUT_con_.begin(); it != INPUT_con_.end(); ++it) {
520 if (needRiskLessCon_[cnt]) {
521 Ptr<Constraint<Real>> con = it->second.constraint;
522 Ptr<Vector<Real>> mul = it->second.multiplier;
523 Ptr<Vector<Real>> res = it->second.residual;
524 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
529 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
530 auto it2 = ORIGINAL_con_.find(it->first);
531 if (it2 != ORIGINAL_con_.end()) {
532 Ptr<Constraint<Real>> con = it2->second.constraint;
533 Ptr<Vector<Real>> mul = it2->second.multiplier;
534 Ptr<Vector<Real>> res = it2->second.residual;
535 Ptr<BoundConstraint<Real>> bnd = it2->second.bounds;
539 ORIGINAL_con_.erase(it2);
543 riskless_con.clear();
544 for (
auto it = INPUT_linear_con_.begin(); it != INPUT_linear_con_.end(); ++it) {
545 Ptr<Constraint<Real>> con = it->second.constraint;
546 Ptr<Vector<Real>> mul = it->second.multiplier;
547 Ptr<Vector<Real>> res = it->second.residual;
548 Ptr<BoundConstraint<Real>> bnd = it->second.bounds;
551 for (
auto it = riskless_con.begin(); it != riskless_con.end(); ++it) {
552 auto it2 = ORIGINAL_linear_con_.find(it->first);
553 if (it2 != ORIGINAL_linear_con_.end()) {
554 Ptr<Constraint<Real>> con = it2->second.constraint;
555 Ptr<Vector<Real>> mul = it2->second.multiplier;
556 Ptr<Vector<Real>> res = it2->second.residual;
557 Ptr<BoundConstraint<Real>> bnd = it2->second.bounds;
561 ORIGINAL_linear_con_.erase(it2);
566 needRiskLessCon_.clear();
572 #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...