133 ParameterList &parlist)
136 usePresolve_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Use Presolve",
true);
137 useInexact_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Use Inexact Solve",
true);
138 penaltyParam_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Initial Penalty Parameter",10.0);
139 maxPen_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Maximum Penalty Parameter",-1.0);
140 update_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Penalty Update Scale",10.0);
141 freq_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Penalty Update Frequency",0);
142 ztol_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Nonanticipativity Constraint Tolerance",1e-4);
143 maxit_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Iteration Limit",100);
144 print_ = parlist.sublist(
"SOL").sublist(
"Progressive Hedging").get(
"Print Subproblem Solve History",
false);
145 maxPen_ = (maxPen_ <= static_cast<Real>(0) ? ROL_INF<Real>() :
maxPen_);
148 ParameterList olist; olist.sublist(
"SOL") = parlist.sublist(
"SOL").sublist(
"Objective");
149 std::string type = olist.sublist(
"SOL").get(
"Type",
"Risk Neutral");
150 std::string prob = olist.sublist(
"SOL").sublist(
"Probability").get(
"Name",
"bPOE");
151 hasStat_ = ((type==
"Risk Averse") ||
152 (type==
"Deviation") ||
153 (type==
"Probability" && prob==
"bPOE"));
154 Ptr<ParameterList> parlistptr = makePtrFromRef<ParameterList>(olist);
156 ph_vector_ = makePtr<RiskVector<Real>>(parlistptr,
157 input_->getPrimalOptimizationVector());
169 ph_bound_ = makePtr<RiskBoundConstraint<Real>>(parlistptr,
170 input_->getBoundConstraint());
177 if (
input_->getConstraint() != nullPtr) {
194 input_->getMultiplierVector());
200 ph_status_ = makePtr<PH_StatusTest<Real>>(parlist,
211 for (
int i = 0; i <
sampler_->numMySamples(); ++i) {
231 void run(std::ostream &outStream = std::cout) {
233 std::vector<Real> vec_p(2), vec_g(2);
234 Real znorm(ROL_INF<Real>()), zdotz(0);
235 int iter(0), tspiter(0), flag = 1;
236 bool converged =
true;
238 outStream << std::scientific << std::setprecision(6);
239 outStream << std::endl <<
"Progressive Hedging"
241 << std::setw(8) << std::left <<
"iter"
242 << std::setw(15) << std::left <<
"||z-Ez||"
243 << std::setw(15) << std::left <<
"penalty"
244 << std::setw(10) << std::left <<
"subiter"
245 << std::setw(8) << std::left <<
"success"
247 for (iter = 0; iter <
maxit_; ++iter) {
251 for (
int j = 0; j <
sampler_->numMySamples(); ++j) {
267 vec_p[0] +=
sampler_->getMyWeight(j)
270 vec_p[1] +=
static_cast<Real
>(
ph_solver_->getAlgorithmState()->iter);
274 ? converged :
false);
280 sampler_->sumAll(&vec_p[0],&vec_g[0],2);
282 for (
int j = 0; j <
sampler_->numMySamples(); ++j) {
286 znorm = std::sqrt(std::abs(vec_g[0] - zdotz));
287 tspiter +=
static_cast<int>(vec_g[1]);
290 << std::setw(8) << std::left << iter
291 << std::setw(15) << std::left << znorm
293 << std::setw(10) << std::left << static_cast<int>(vec_g[1])
294 << std::setw(8) << std::left << converged
297 if (znorm <=
ztol_ && converged) {
299 outStream <<
"Converged: Nonanticipativity constraint tolerance satisfied!" << std::endl;
316 if (iter >=
maxit_ && flag != 0) {
317 outStream <<
"Maximum number of iterations exceeded" << std::endl;
319 outStream <<
"Total number of subproblem iterations per sample: "
320 << tspiter <<
" / " <<
sampler_->numGlobalSamples()
321 <<
" ~ " <<
static_cast<int>(std::ceil(
static_cast<Real
>(tspiter)/
static_cast<Real
>(
sampler_->numGlobalSamples())))