99 ParameterList &parlist)
102 usePresolve_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Use Presolve",
true);
103 useInexact_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Use Inexact Solve",
true);
104 penaltyParam_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Initial Penalty Parameter",10.0);
105 maxPen_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Maximum Penalty Parameter",-1.0);
106 update_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Penalty Update Scale",10.0);
107 freq_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Penalty Update Frequency",0);
108 ztol_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Nonanticipativity Constraint Tolerance",1e-4);
109 maxit_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Iteration Limit",100);
110 print_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Print Subproblem Solve History",
false);
111 maxPen_ = (maxPen_ <= static_cast<Real>(0) ? ROL_INF<Real>() :
maxPen_);
114 ParameterList olist; olist.sublist(
"SOL") = parlist.sublist(
"SOL").sublist(
"Objective");
115 std::string type = olist.sublist(
"SOL").get(
"Type",
"Risk Neutral");
116 std::string prob = olist.sublist(
"SOL").sublist(
"Probability").get(
"Name",
"bPOE");
117 hasStat_ = ((type==
"Risk Averse") ||
118 (type==
"Deviation") ||
119 (type==
"Probability" && prob==
"bPOE"));
120 Ptr<ParameterList> parlistptr = makePtrFromRef<ParameterList>(olist);
122 ph_vector_ = makePtr<RiskVector<Real>>(parlistptr,
123 input_->getPrimalOptimizationVector());
135 ph_bound_ = makePtr<RiskBoundConstraint<Real>>(parlistptr,
136 input_->getBoundConstraint());
143 if (
input_->getConstraint() != nullPtr) {
160 input_->getMultiplierVector());
166 ph_status_ = makePtr<PH_StatusTest<Real>>(parlist,
177 for (
int i = 0; i <
sampler_->numMySamples(); ++i) {
197 void run(std::ostream &outStream = std::cout) {
199 std::vector<Real> vec_p(2), vec_g(2);
200 Real znorm(ROL_INF<Real>()), zdotz(0);
201 int iter(0), tspiter(0), flag = 1;
202 bool converged =
true;
204 outStream << std::scientific << std::setprecision(6);
205 outStream << std::endl <<
"Progressive Hedging"
207 << std::setw(8) << std::left <<
"iter"
208 << std::setw(15) << std::left <<
"||z-Ez||"
209 << std::setw(15) << std::left <<
"penalty"
210 << std::setw(10) << std::left <<
"subiter"
211 << std::setw(8) << std::left <<
"success"
213 for (iter = 0; iter <
maxit_; ++iter) {
217 for (
int j = 0; j <
sampler_->numMySamples(); ++j) {
233 vec_p[0] +=
sampler_->getMyWeight(j)
236 vec_p[1] +=
static_cast<Real
>(
ph_solver_->getAlgorithmState()->iter);
240 ? converged :
false);
246 sampler_->sumAll(&vec_p[0],&vec_g[0],2);
248 for (
int j = 0; j <
sampler_->numMySamples(); ++j) {
252 znorm = std::sqrt(std::abs(vec_g[0] - zdotz));
253 tspiter +=
static_cast<int>(vec_g[1]);
256 << std::setw(8) << std::left << iter
257 << std::setw(15) << std::left << znorm
259 << std::setw(10) << std::left << static_cast<int>(vec_g[1])
260 << std::setw(8) << std::left << converged
263 if (znorm <=
ztol_ && converged) {
265 outStream <<
"Converged: Nonanticipativity constraint tolerance satisfied!" << std::endl;
282 if (iter >=
maxit_ && flag != 0) {
283 outStream <<
"Maximum number of iterations exceeded" << std::endl;
285 outStream <<
"Total number of subproblem iterations per sample: "
286 << tspiter <<
" / " <<
sampler_->numGlobalSamples()
287 <<
" ~ " <<
static_cast<int>(std::ceil(
static_cast<Real
>(tspiter)/
static_cast<Real
>(
sampler_->numGlobalSamples())))