38 #include <Xyce_config.h>
45 #include <N_IO_CircuitBlock.h>
46 #include <N_IO_CmdParse.h>
47 #include <N_IO_InitialConditions.h>
48 #include <N_IO_OptionBlock.h>
49 #include <N_IO_PkgOptionsMgr.h>
50 #include <N_IO_SpiceSeparatedFieldTool.h>
59 #include <N_UTL_Diagnostic.h>
60 #include <N_UTL_ExtendedString.h>
61 #include <N_UTL_Factory.h>
62 #include <N_UTL_FeatureTest.h>
63 #include <N_UTL_OptionBlock.h>
64 #include <N_ERH_Message.h>
66 #include <N_TOP_Topology.h>
67 #include <N_LAS_System.h>
68 #include <N_LAS_Builder.h>
73 #include <N_PDS_Manager.h>
74 #include <N_UTL_Timer.h>
85 #define OBJTYPE 1 // 0 - L2Norm, 1 - amplifier circuit
92 #include "ROL_StdVector.hpp"
93 #include "ROL_Vector.hpp"
95 #include "ROL_Algorithm.hpp"
96 #include "ROL_CompositeStep.hpp"
97 #include "ROL_LineSearchStep.hpp"
98 #include "Teuchos_oblackholestream.hpp"
99 #include "Teuchos_GlobalMPISession.hpp"
100 #include "ROL_BoundConstraint.hpp"
101 #include "Teuchos_XMLParameterListHelpers.hpp"
102 #include "ROL_TrustRegionStep.hpp"
103 #include "ROL_StatusTest.hpp"
104 #include "ROL_Types.hpp"
105 #include "ROL_BundleStep.hpp"
106 #include "ROL_BundleStatusTest.hpp"
111 #include "ROL_Reduced_Objective_SimOpt.hpp"
112 #include "ROL_ParametrizedObjective_SimOpt.hpp"
113 #include "ROL_Reduced_ParametrizedObjective_SimOpt.hpp"
116 #include "Teuchos_Comm.hpp"
117 #include "Teuchos_DefaultComm.hpp"
118 #include "Teuchos_CommHelpers.hpp"
120 #include "ROL_RiskNeutralObjective.hpp"
121 #include "ROL_RiskAverseObjective.hpp"
123 #include "ROL_MonteCarloGenerator.hpp"
124 #include "ROL_QuasiMonteCarloGenerator.hpp"
125 #include "ROL_StdTeuchosBatchManager.hpp"
126 #include "ROL_UserInputGenerator.hpp"
128 #include "ROL_PlusFunction.hpp"
129 #include "ROL_CVaR.hpp"
130 #include "ROL_CVaRVector.hpp"
131 #include "ROL_CVaRBoundConstraint.hpp"
148 Linear::System & linear_system,
149 Topo::Topology & topology,
150 IO::InitialConditionsManager & initial_conditions_manager)
158 outputManagerAdapter_(analysis_manager.getOutputManagerAdapter()),
160 rolLoopInitialized_(false),
161 solutionPtrVector_(0),
165 mysensRHSPtrVector_(0),
167 constraintPtrVector_(0),
172 std::ifstream param_file;
173 std::string deviceName,paramName,dummy;
176 param_file.open(
"parameters.txt");
177 getline(param_file,dummy);
180 if(!(param_file >> deviceName))
break;
181 if(!(param_file >> paramName))
break;
182 paramName = deviceName+
":"+paramName;
184 if(!(param_file >> temp))
break;
185 if(!(param_file >> temp))
break;
186 if(!(param_file >> temp))
break;
204 const Util::OptionBlock & option_block)
206 for (Util::ParamList::const_iterator it = option_block.begin(), end = option_block.end(); it != end; ++it)
208 const Util::Param ¶m = (*it);
210 if (param.uTag() ==
"DAESTATEDERIV")
212 else if (param.uTag() ==
"DEBUGLEVEL")
220 else if (param.uTag() ==
"METHOD")
223 Report::UserError() << param.uTag() <<
" is not a recognized time integration option";
292 if (DEBUG_ANALYSIS && isActive(Diag::TIME_PARAMETERS))
294 Xyce::dout() << std::endl << std::endl;
295 Xyce::dout() << section_divider << std::endl;
296 Xyce::dout() <<
"ROL Sweep::init" << std::endl;
392 bool integration_status =
true;
402 while (currentStep < finalStep)
413 if (DEBUG_ANALYSIS && isActive(Diag::TIME_PARAMETERS))
415 Xyce::dout() <<
"ROL DC Sweep # " << currentStep <<
"\t" << (*it);
418 if (currentStep != 0 && reset)
461 return integration_status;
489 Stats::StatTop _predictorStat(
"Predictor");
490 Stats::TimeBlock _predictorTimer(_predictorStat);
496 Stats::StatTop _updateDeviceSourceStat(
"Update Device Sources");
497 Stats::TimeBlock _updateDeviceSourceTimer(_updateDeviceSourceStat);
503 Stats::StatTop _nonlinearSolveStat(
"Solve");
504 Stats::TimeBlock _nonlinearSolveTimer(_nonlinearSolveStat);
510 Stats::StatTop _errorStat(
"Error Estimation");
511 Stats::TimeBlock _errorTimer(_errorStat);
530 for (
int i=0;i<nc;i++)
543 for (
int i=0;i<nz;i++)
601 Stats::StatTop _processSuccessfulStepStat(
"Successful Step");
602 Stats::TimeBlock _processSuccessfulStepTimer(_processSuccessfulStepStat);
630 if (DEBUG_ANALYSIS && isActive(Diag::TIME_PARAMETERS))
634 std::cout <<
"Current solution" << std::endl;
640 for (
int i=0;i<3;i++)
645 std::cout <<
"Current f vector" << std::endl;
646 for (
unsigned int k = 0; k < ds.
daeFVectorPtr->globalLength(); k++)
650 std::cout <<
"Current q vector" << std::endl;
651 for (
unsigned int k = 0; k < ds.
daeQVectorPtr->globalLength(); k++)
655 std::cout <<
"Current b vector" << std::endl;
656 for (
unsigned int k = 0; k < ds.
daeBVectorPtr->globalLength(); k++)
663 if (DEBUG_ANALYSIS & DEBUG_TIME && isActive(Diag::TIME_DUMP_SOLUTION_ARRAYS))
687 Stats::StatTop _processFailedStat(
"Failed Steps");
688 Stats::TimeBlock _processFailedTimer(_processFailedStat);
743 typedef double RealT;
759 Teuchos::RCP<const Teuchos::Comm<int> > comm = Teuchos::DefaultComm<int>::getComm();
775 std::string filename =
"input.xml";
776 Teuchos::RCP<Teuchos::ParameterList> parlist = Teuchos::rcp(
new Teuchos::ParameterList() );
777 Teuchos::updateParametersFromXmlFile( filename, Teuchos::Ptr<Teuchos::ParameterList>(&*parlist) );
779 std::string outputname = parlist->get(
"Output File",
"rol_output.txt");
780 std::ofstream out(outputname.c_str());
781 Teuchos::RCP<std::ostream> outStream = Teuchos::rcp(&out,
false);
783 out <<
"nu = " << nu <<
" nc = " << nc <<
" nz = " << nz << std::endl;
784 out <<
"Entering ROL loop" << std::endl;
786 bool do_checks = parlist->get(
"Do Checks",
true);
787 bool use_scale = parlist->get(
"Use Scaling For Epsilon-Active Sets",
true);
788 bool use_sqp = parlist->get(
"Use SQP",
true);
789 bool use_lsearch = parlist->get(
"Use Line Search",
true);
790 bool use_TR = parlist->get(
"Use Trust Region",
true);
791 bool use_bundle = parlist->get(
"Use Bundle Method",
true);
792 bool use_bcon = parlist->get(
"Use Bound Constraints",
true);
793 RealT alpha = parlist->get(
"Penalty Parameter", 1.e-4);
795 RealT ampl = parlist->get(
"Amplifier Gain", 4.0);
796 int ptype = parlist->get(
"Penalty Type", 1);
799 int nSamp = parlist->get(
"Number of Samples (UQ)", 10);
800 int samplertype = parlist->get(
"Sampler Type", 1);
801 RealT gamma = parlist->get(
"CVaR: gamma", 1.e-4);
802 RealT prob = parlist->get(
"CVaR: prob", 0.99);
803 RealT coeff = parlist->get(
"CVaR: coeff", 1.0);
808 Teuchos::RCP< ::ROL::ParametrizedEqualityConstraint_SimOpt<RealT> > con;
812 Teuchos::RCP<std::vector<RealT> > z_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
813 Teuchos::RCP<std::vector<RealT> > z1_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
814 Teuchos::RCP<std::vector<RealT> > z2_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
815 Teuchos::RCP<std::vector<RealT> > z3_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
816 Teuchos::RCP<std::vector<RealT> > yz_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
817 Teuchos::RCP<std::vector<RealT> > ajvz_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
818 ::ROL::StdVector<RealT> z(z_rcp);
819 ::ROL::StdVector<RealT> z1(z1_rcp);
820 ::ROL::StdVector<RealT> z2(z2_rcp);
821 ::ROL::StdVector<RealT> z3(z3_rcp);
822 ::ROL::StdVector<RealT> yz(yz_rcp);
823 ::ROL::StdVector<RealT> ajvz(ajvz_rcp);
855 std::ifstream param_file;
856 param_file.open(
"parameters.txt");
858 std::string parName, dummy;
859 std::vector<RealT> up_bounds(nz,0.0);
860 std::vector<RealT> lo_bounds(nz,0.0);
861 getline(param_file,dummy);
862 for(
int i=0;i<nz;i++)
864 param_file >> parName;
865 param_file >> parName;
878 param_file.open(
"uncertain_parameters.txt");
879 std::vector<std::vector<RealT> > ubounds;
880 std::vector<RealT> tempv(2,0);
881 std::string deviceName,paramName;
882 getline(param_file,dummy);
885 if(!(param_file >> deviceName))
887 if(deviceName[0]==
'*')
889 getline(param_file,dummy);
892 if(!(param_file >> paramName))
894 paramName = deviceName+
":"+paramName;
895 std::cout <<
"Uncertain parameter " << paramName << std::endl;
897 if(!(param_file >> temp))
break;
899 if(!(param_file >> temp))
break;
901 ubounds.push_back(tempv);
908 Teuchos::RCP< ::ROL::Vector<RealT> > up = Teuchos::rcp(&u,
false);
909 Teuchos::RCP< ::ROL::Vector<RealT> > yup = Teuchos::rcp(&yu,
false);
910 Teuchos::RCP< ::ROL::Vector<RealT> > cp = Teuchos::rcp(&c,
false);
911 Teuchos::RCP< ::ROL::Vector<RealT> > jvp = Teuchos::rcp(&jv,
false);
913 Teuchos::RCP< ::ROL::Vector<RealT> > zp = Teuchos::rcp(&z,
false);
914 Teuchos::RCP< ::ROL::Vector<RealT> > z3p = Teuchos::rcp(&z3,
false);
915 Teuchos::RCP< ::ROL::Vector<RealT> > yzp = Teuchos::rcp(&yz,
false);
916 Teuchos::RCP< ::ROL::Vector<RealT> > ajvzp = Teuchos::rcp(&ajvz,
false);
919 ::ROL::Vector_SimOpt<RealT> x(up,zp);
920 ::ROL::Vector_SimOpt<RealT> y(yup,yzp);
921 ::ROL::Vector_SimOpt<RealT> ajv(jvp,ajvzp);
928 Teuchos::RCP< ::ROL::BatchManager<double> > bman = Teuchos::rcp(new ::ROL::StdTeuchosBatchManager<double,int>(comm));
929 Teuchos::RCP< ::ROL::SampleGenerator<double> > sampler;
930 std::ifstream dirNums(
"new-joe-kuo-6.21201");
932 sampler = Teuchos::rcp(new ::ROL::MonteCarloGenerator<double>(50*nSamp,ubounds,bman,
false,
false,100));
933 else if(samplertype==2)
936 out <<
"DirNums file not found!" << std::endl;
938 sampler = Teuchos::rcp(new ::ROL::QuasiMonteCarloGenerator<double>(nSamp,ubounds,bman,dirNums,skip,
false,
false,100));
940 con->setParameter(sampler->getMyPoint(0));
945 std::ofstream allsamples(
"all_samples.txt");
946 std::ofstream samples(
"good_samples.txt");
948 out <<
"Generating good samples..." << std::endl;
949 for (
int k=0;k<50*nSamp;k++)
951 con->setParameter(sampler->getMyPoint(k));
955 out <<
"Checking Jacobian_1" << std::endl;
957 std::vector<RealT> steps(numSteps);
958 for(
int i=0;i<numSteps;++i)
960 steps[i] = pow(10,-i);
963 using ::ROL::Finite_Difference_Arrays::shifts;
964 using ::ROL::Finite_Difference_Arrays::weights;
967 std::vector<RealT> tmp(numVals);
968 std::vector<std::vector<RealT> > jvCheck(numSteps, tmp);
971 Teuchos::RCP< ::ROL::Vector<RealT> > cc = c.clone();
972 con->value(*cc,*(x.get_1()),*(x.get_2()),tol);
975 Teuchos::RCP< ::ROL::Vector<RealT> > Jv = jv.clone();
977 con->applyJacobian_1(*Jv, *(y.get_1()), *(x.get_1()), *(x.get_2()), tol);
981 Teuchos::RCP< ::ROL::Vector<RealT> > cdif = c.clone();
982 Teuchos::RCP< ::ROL::Vector<RealT> > cnew = c.clone();
983 Teuchos::RCP< ::ROL::Vector<RealT> > xnew = x.clone();
987 RealT minGradError = 1.e+10;
989 for (
int i=0; i<numSteps; i++)
992 RealT eta = steps[i];
997 cdif->scale(weights[order-1][0]);
999 for(
int j=0; j<order; ++j)
1002 xnew->axpy(eta*shifts[order-1][j], y);
1004 if( weights[order-1][j+1] != 0 )
1007 ::ROL::Vector_SimOpt<RealT> &xnews = Teuchos::dyn_cast< ::ROL::Vector_SimOpt<RealT> >(*xnew);
1008 con->value(*cnew,*(xnews.get_1()),z,tol);
1009 cdif->axpy(weights[order-1][j+1],*cnew);
1014 cdif->scale(1.0/eta);
1017 jvCheck[i][0] = eta;
1018 jvCheck[i][1] = normJv;
1019 jvCheck[i][2] = cdif->norm();
1020 cdif->axpy(-1.0, *Jv);
1021 jvCheck[i][3] = cdif->norm();
1025 std::stringstream hist;
1029 << std::setw(20) <<
"Step size"
1030 << std::setw(20) <<
"norm(Jac*vec)"
1031 << std::setw(20) <<
"norm(FD approx)"
1032 << std::setw(20) <<
"norm(abs error)"
1034 << std::setw(20) <<
"---------"
1035 << std::setw(20) <<
"-------------"
1036 << std::setw(20) <<
"---------------"
1037 << std::setw(20) <<
"---------------"
1040 hist << std::scientific << std::setprecision(11) << std::right
1041 << std::setw(20) << jvCheck[i][0]
1042 << std::setw(20) << jvCheck[i][1]
1043 << std::setw(20) << jvCheck[i][2]
1044 << std::setw(20) << jvCheck[i][3]
1048 minGradError = std::min(jvCheck[i][3],minGradError);
1050 out <<
"\n" << std::endl;
1053 std::cout <<
"minGradError = " << minGradError << std::endl;
1054 for(
int j=0;j<ubounds.size();j++)
1055 allsamples << std::scientific << std::setprecision(8) << (sampler->getMyPoint(k))[j] <<
' ';
1057 if( minGradError < 2.e-6 )
1059 for(
int j=0;j<ubounds.size();j++)
1060 samples << std::scientific << std::setprecision(8) << (sampler->getMyPoint(k))[j] <<
' ';
1066 out <<
"Checking Jacobian_2" << std::endl;
1069 con->value(*cc,*(x.get_1()),*(x.get_2()),tol);
1072 con->applyJacobian_2(*Jv, *(y.get_2()), *(x.get_1()), *(x.get_2()), tol);
1073 normJv = Jv->norm();
1075 for (
int i=0; i<numSteps; i++)
1078 RealT eta = steps[i];
1083 cdif->scale(weights[order-1][0]);
1085 for(
int j=0; j<order; ++j)
1088 xnew->axpy(eta*shifts[order-1][j], y);
1090 if( weights[order-1][j+1] != 0 )
1093 ::ROL::Vector_SimOpt<RealT> &xnews = Teuchos::dyn_cast< ::ROL::Vector_SimOpt<RealT> >(*xnew);
1094 con->value(*cnew,u,*(xnews.get_2()),tol);
1095 cdif->axpy(weights[order-1][j+1],*cnew);
1100 cdif->scale(1.0/eta);
1103 jvCheck[i][0] = eta;
1104 jvCheck[i][1] = normJv;
1105 jvCheck[i][2] = cdif->norm();
1106 cdif->axpy(-1.0, *Jv);
1107 jvCheck[i][3] = cdif->norm();
1111 std::stringstream hist;
1115 << std::setw(20) <<
"Step size"
1116 << std::setw(20) <<
"norm(Jac*vec)"
1117 << std::setw(20) <<
"norm(FD approx)"
1118 << std::setw(20) <<
"norm(abs error)"
1120 << std::setw(20) <<
"---------"
1121 << std::setw(20) <<
"-------------"
1122 << std::setw(20) <<
"---------------"
1123 << std::setw(20) <<
"---------------"
1126 hist << std::scientific << std::setprecision(11) << std::right
1127 << std::setw(20) << jvCheck[i][0]
1128 << std::setw(20) << jvCheck[i][1]
1129 << std::setw(20) << jvCheck[i][2]
1130 << std::setw(20) << jvCheck[i][3]
1134 out <<
"\n" << std::endl;
1140 out <<
"Generated " << nGSamp <<
" good samples." << std::endl;
1147 out <<
"Checking full Jacobian" << std::endl;
1148 con->checkApplyJacobian(x,y,jv,
true,*outStream);
1159 out <<
"Checking Jacobian consistency" << std::endl;
1160 con->checkAdjointConsistencyJacobian_1(jv,yu,u,z,
true,*outStream);
1161 con->checkAdjointConsistencyJacobian_2(jv,yz,u,z,
true,*outStream);
1163 out <<
"Checking consistency of solves" << std::endl;
1164 con->checkSolve(u,z,c,
true,*outStream);
1165 con->checkInverseJacobian_1(jv,yu,u,z,
true,*outStream);
1166 con->checkInverseAdjointJacobian_1(yu,jv,u,z,
true,*outStream);
1171 Teuchos::RCP< ::ROL::ParametrizedObjective_SimOpt<RealT> > obj;
1172 Teuchos::RCP< ::ROL::ParametrizedObjective_SimOpt<RealT> > pen;
1176 obj = Teuchos::rcp(
new Objective_DC_L2Norm<RealT>(1.e-4,nc,nz));
1179 std::cout <<
"Amplifier circuit problem" << std::endl;
1180 obj = Teuchos::rcp(
new Objective_DC_AMP<RealT>(nc,nz));
1181 pen = Teuchos::rcp(
new Penalty_DC_AMP<RealT>(ptype,alpha,ampl,nc,nz));
1183 std::vector< Teuchos::RCP< ::ROL::Objective<RealT> > > objVec;
1184 std::vector<bool> types(1,
true);
1186 con->checkSolve(u,z,c,
true,*outStream);
1189 out <<
"Checking objective" << std::endl;
1190 obj->checkGradient(x,x,y,
true,*outStream);
1191 obj->checkHessVec(x,x,y,
true,*outStream);
1193 out <<
"Checking penalty" << std::endl;
1194 pen->checkGradient(x,x,y,
true,*outStream);
1195 pen->checkHessVec(x,x,y,
true,*outStream);
1200 Teuchos::RCP< ::ROL::ParametrizedObjective<RealT> > robj = Teuchos::rcp(new ::ROL::Reduced_ParametrizedObjective_SimOpt<RealT>(obj,con,up,cp));
1202 Teuchos::RCP< ::ROL::ParametrizedObjective<RealT> > rpen = Teuchos::rcp(new ::ROL::Reduced_ParametrizedObjective_SimOpt<RealT>(pen,con,up,cp));
1207 *outStream <<
"Derivatives of reduced objective" << std::endl;
1208 robj->checkGradient(z,z,yz,
true,*outStream);
1209 robj->checkHessVec(z,z,yz,
true,*outStream);
1211 *outStream <<
"Derivatives of reduced penalty" << std::endl;
1212 rpen->checkGradient(z,z,yz,
true,*outStream);
1213 rpen->checkHessVec(z,z,yz,
true,*outStream);
1218 Teuchos::RCP<std::vector< RealT > > g0_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
1219 ::ROL::StdVector<RealT> g0p(g0_rcp);
1220 robj->gradient(g0p,z,tol);
1221 *outStream << std::scientific <<
"Norm of initial gradient = " << g0p.norm() <<
"\n";
1225 scale = 1.0e-2/g0p.norm();
1228 *outStream << std::scientific <<
"Scaling: " << scale <<
"\n";
1229 Teuchos::RCP<::ROL::BoundConstraint<RealT> > bcon = Teuchos::rcp(
new BoundConstraint_ROL_DC<RealT>(scale,lo_bounds,up_bounds));
1236 *outStream <<
"\n Initial guess " << std::endl;
1237 for (
int i=0;i<nz;i++)
1238 *outStream <<
paramNameVec_[i] <<
" = " << (*z_rcp)[i] << std::endl;
1239 RealT gtol = parlist->get(
"Gradient Tolerance",1.e-14);
1240 RealT stol = parlist->get(
"Step Tolerance",1.e-16);
1241 int maxit = parlist->get(
"Maximum Number of Iterations",100);
1243 con->solve(u,z,tol);
1247 std::ofstream sampleWeights(
"weights.txt");
1248 for(
int i=0;i<nSamp;i++)
1250 sampleWeights << 1./(
RealT)nSamp <<
'\n';
1252 sampleWeights.close();
1253 std::string input_samples =
"good_samples.txt";
1254 std::string input_weights =
"weights.txt";
1256 Teuchos::RCP< ::ROL::SampleGenerator<double> > samplerSolve = Teuchos::rcp(new ::ROL::UserInputGenerator<RealT>(input_samples,input_weights,nSamp,ubounds.size(),bman));
1257 std::vector<RealT> sampleMean(ubounds.size(),0);
1259 Teuchos::RCP< ::ROL::SampleGenerator<double> > samplerTest = Teuchos::rcp(new ::ROL::UserInputGenerator<RealT>(input_samples,input_weights,nGSamp,ubounds.size(),bman));
1260 std::ofstream data_IG_UQ(
"data_IG_UQ.txt");
1261 std::ofstream plot_IG_UQ(
"plot_IG_UQ.txt");
1262 RealT sumlin = 0, sumlin2 = 0, sumgain = 0, sumgain2 = 0, gain, oval, param;
1263 Teuchos::RCP<std::vector<Teuchos::RCP<Linear::Vector> > > uup = Teuchos::rcp_const_cast<std::vector<Teuchos::RCP<Linear::Vector> > >((Teuchos::dyn_cast<Linear::ROL_XyceVector<RealT> >(u)).getVector());
1264 for(
int i=0;i<nSamp;i++)
1266 con->setParameter(samplerSolve->getMyPoint(i));
1267 con->solve(u,z,tol);
1268 oval = obj.value(u,z,tol);
1269 for(
int j=0;j<nc;j++)
1271 plot_IG_UQ << std::scientific << std::setprecision(8) << (*(*uup)[j])[3] <<
' ';
1274 gain = ((*(*uup)[nc-1])[3]-(*(*uup)[0])[3])/2.0;
1276 sumgain2 += gain*gain;
1279 param = (samplerSolve->getMyPoint(i))[j];
1280 data_IG_UQ << std::scientific << std::setprecision(8) << param <<
' ';
1281 sampleMean[j] += param/nSamp;
1283 data_IG_UQ << oval <<
' ' << gain <<
'\n';
1285 sumlin2 += oval*oval;
1288 RealT meanlin = sumlin/nSamp;
1289 RealT meangain = sumgain/nSamp;
1290 RealT varlin = (sumlin2 - nSamp*meanlin*meanlin)/(RealT)(nSamp-1);
1291 RealT vargain = (sumgain2 - nSamp*meangain*meangain)/(RealT)(nSamp-1);
1292 data_IG_UQ <<
'\n' <<
"------------------------------------------" <<
'\n';
1293 data_IG_UQ <<
"mean(lin) = " << meanlin <<
" " <<
'\n';
1294 data_IG_UQ <<
"sqrt(sample variance)(lin) = " << std::sqrt(varlin) <<
'\n';
1295 data_IG_UQ <<
"mean(gain) = " << meangain <<
" " <<
'\n';
1296 data_IG_UQ <<
"sqrt(sample variance)(gain) = " << std::sqrt(vargain) <<
'\n';
1302 Teuchos::RCP< ::ROL::Distribution<double> > dist;
1303 Teuchos::RCP< ::ROL::PlusFunction<double> > pf;
1304 Teuchos::RCP< ::ROL::RiskMeasure<RealT> > rmobj;
1305 bool storage =
true;
1306 Teuchos::RCP< ::ROL::RiskNeutralObjective<RealT> > neutobj;
1307 Teuchos::RCP< ::ROL::RiskAverseObjective<RealT> > riskobj;
1308 Teuchos::RCP< ::ROL::RiskNeutralObjective<RealT> > neutpen;
1309 Teuchos::RCP< ::ROL::RiskAverseObjective<RealT> > riskpen;
1310 Teuchos::RCP< ::ROL::BoundConstraint<RealT> >bconcvar = Teuchos::rcp(new ::ROL::CVaRBoundConstraint<RealT>(bcon));
1312 bconcvar->deactivate();
1317 Teuchos::RCP< ::ROL::StatusTest<double> > status_tr;
1318 Teuchos::RCP< ::ROL::Step<double> > step_tr;
1319 Teuchos::RCP< ::ROL::Algorithm<double> > algo_tr;
1320 std::clock_t timer_tr = std::clock();
1322 *outStream <<
"\nSOLVE DETERMINISTIC MEAN-VALUE PROBLEM\n";
1324 con->setParameter(sampleMean);
1326 objVec.push_back(robj);
1328 objVec.push_back(rpen);
1331 SumObjective<RealT> fullobjDET(objVec,types);
1332 con->checkSolve(u,z,c,
true,*outStream);
1335 *outStream <<
"Derivatives of reduced objective" << std::endl;
1336 robj->checkGradient(z1,z1,yz,
true,*outStream);
1337 robj->checkHessVec(z1,z1,yz,
true,*outStream);
1339 *outStream <<
"Derivatives of reduced penalty" << std::endl;
1340 rpen->checkGradient(z1,z1,yz,
true,*outStream);
1341 rpen->checkHessVec(z1,z1,yz,
true,*outStream);
1344 status_tr = Teuchos::rcp(new ::ROL::StatusTest<RealT>(gtol, stol, maxit));
1345 step_tr = Teuchos::rcp(new ::ROL::TrustRegionStep<RealT>(*parlist));
1346 algo_tr = Teuchos::rcp(new ::ROL::Algorithm<RealT>(step_tr,status_tr,
false));
1347 algo_tr->run(z1,fullobjDET,*bcon,
true,*outStream);
1348 *outStream <<
"\n Solution " << std::endl;
1349 for (
int i=0;i<nz;i++)
1351 *outStream <<
paramNameVec_[i] <<
" = " << (*z1_rcp)[i] << std::endl;
1354 *outStream <<
"\nSOLVE EXPECTED VALUE WITH TRUST REGION\n";
1355 out <<
"Using " << nSamp <<
" samples" << std::endl;
1357 *outStream <<
"\n Initial guess " << std::endl;
1358 for (
int i=0;i<nz;i++)
1359 *outStream <<
paramNameVec_[i] <<
" = " << (*z2_rcp)[i] << std::endl;
1360 neutobj = Teuchos::rcp(new ::ROL::RiskNeutralObjective<RealT>(robj,samplerSolve,storage));
1362 objVec.push_back(neutobj);
1363 neutpen = Teuchos::rcp(new ::ROL::RiskNeutralObjective<RealT>(rpen,samplerSolve,storage));
1364 objVec.push_back(neutpen);
1365 SumObjective<RealT> fullobjEXP(objVec,types);
1368 out <<
"Derivatives of risk neutral objective" << std::endl;
1369 neutobj->checkGradient(z2,z2,yz,
true,*outStream);
1370 neutobj->checkHessVec(z2,z2,yz,
true,*outStream);
1372 out <<
"Derivatives of risk neutral penalty" << std::endl;
1373 neutpen->checkGradient(z2,z2,yz,
true,*outStream);
1374 neutpen->checkHessVec(z2,z2,yz,
true,*outStream);
1377 status_tr = Teuchos::rcp(new ::ROL::StatusTest<RealT>(gtol, stol, maxit));
1378 step_tr = Teuchos::rcp(new ::ROL::TrustRegionStep<RealT>(*parlist));
1379 algo_tr = Teuchos::rcp(new ::ROL::Algorithm<RealT>(step_tr,status_tr,
false));
1380 algo_tr->run(z2,fullobjEXP,*bcon,
true,*outStream);
1381 *outStream <<
"\n Solution " << std::endl;
1382 for (
int i=0;i<nz;i++)
1384 *outStream <<
paramNameVec_[i] <<
" = " << (*z2_rcp)[i] << std::endl;
1387 *outStream <<
"\nSOLVE SMOOTHED CONDITIONAL VALUE AT RISK WITH TRUST REGION\n";
1388 *outStream <<
"prob = " << prob <<
", coeff = " << coeff <<
", gamma = " << gamma << std::endl;
1389 out <<
"Using " << nSamp <<
" samples" << std::endl;
1391 *outStream <<
"\n Initial guess " << std::endl;
1392 for (
int i=0;i<nz;i++)
1393 *outStream <<
paramNameVec_[i] <<
" = " << (*z3_rcp)[i] << std::endl;
1395 std::vector<RealT> data(2,0.0);
1396 data[0] = -0.5; data[1] = 0.5;
1397 dist = Teuchos::rcp( new ::ROL::Distribution<RealT>(::ROL::DISTRIBUTION_PARABOLIC,data) );
1398 pf = Teuchos::rcp( new ::ROL::PlusFunction<RealT>(dist,gamma) );
1399 rmobj = Teuchos::rcp( new ::ROL::CVaR<RealT>(prob,coeff,pf) );
1401 neutobj = Teuchos::rcp(new ::ROL::RiskNeutralObjective<RealT>(robj,samplerSolve,storage));
1403 objVec.push_back(neutobj);
1408 riskobj = Teuchos::rcp(new ::ROL::RiskAverseObjective<RealT>(robj,rmobj,samplerSolve,storage));
1410 objVec.push_back(riskobj);
1415 neutpen = Teuchos::rcp(new ::ROL::RiskNeutralObjective<RealT>(rpen,samplerSolve,storage));
1416 objVec.push_back(neutpen);
1422 riskpen = Teuchos::rcp(new ::ROL::RiskAverseObjective<RealT>(rpen,rmobj,samplerSolve,storage));
1423 objVec.push_back(riskpen);
1428 SumObjective<RealT> fullobj(objVec,types);
1429 status_tr = Teuchos::rcp(new ::ROL::StatusTest<RealT>(gtol, stol, maxit));
1430 step_tr = Teuchos::rcp(new ::ROL::TrustRegionStep<RealT>(*parlist));
1431 algo_tr = Teuchos::rcp(new ::ROL::Algorithm<RealT>(step_tr,status_tr,
false));
1435 ::ROL::CVaRVector<RealT> z3c(z3v,z3p);
1436 ::ROL::CVaRVector<RealT> yzc(yzv,yzp);
1439 out <<
"Derivatives of risk neutral objective" << std::endl;
1440 neutobj->checkGradient(z3,z3,yz,
true,*outStream);
1441 neutobj->checkHessVec(z3,z3,yz,
true,*outStream);
1448 out <<
"Derivatives of risk neutral penalty" << std::endl;
1449 neutpen->checkGradient(z3,z3,yz,
true,*outStream);
1450 neutpen->checkHessVec(z3,z3,yz,
true,*outStream);
1454 out <<
"Derivatives of risk averse penalty" << std::endl;
1455 riskpen->checkGradient(z3c,z3c,yzc,
true,*outStream);
1456 riskpen->checkHessVec(z3c,z3c,yzc,
true,*outStream);
1462 algo_tr->run(z3c,fullobj,*bconcvar,
true,*outStream);
1464 algo_tr->run(z3,fullobj,*bcon,
true,*outStream);
1465 *outStream <<
"\n Solution " << std::endl;
1466 for (
int i=0;i<nz;i++)
1468 *outStream <<
paramNameVec_[i] <<
" = " << (*z3_rcp)[i] << std::endl;
1470 *outStream <<
"var = " << z3v << std::endl;
1471 *outStream <<
"Trust-Region required " << (std::clock()-timer_tr)/(RealT)CLOCKS_PER_SEC
1478 *outStream <<
"\nSOLVE NONSMOOTH CVAR PROBLEM WITH BUNDLE TRUST REGION\n";
1480 *outStream <<
"prob = " << prob <<
", coeff = " << coeff << std::endl;
1481 dist = Teuchos::rcp( new ::ROL::Distribution<RealT>(::ROL::DISTRIBUTION_DIRAC) );
1482 pf = Teuchos::rcp( new ::ROL::PlusFunction<RealT>(dist,1.0) );
1483 rmobj = Teuchos::rcp( new ::ROL::CVaR<RealT>(prob,coeff,pf) );
1484 neutobj = Teuchos::rcp(new ::ROL::RiskNeutralObjective<RealT>(robj,samplerSolve,storage));
1486 objVec.push_back(neutobj);
1492 neutpen = Teuchos::rcp(new ::ROL::RiskNeutralObjective<RealT>(rpen,samplerSolve,storage));
1493 objVec.push_back(neutpen);
1499 riskpen = Teuchos::rcp(new ::ROL::RiskAverseObjective<RealT>(rpen,rmobj,samplerSolve,storage));
1500 objVec.push_back(riskpen);
1504 SumObjective<RealT> fullobj(objVec,types);
1507 ::ROL::CVaRVector<RealT> zc(zv,zp);
1509 parlist->set(
"Bundle Step: Epsilon Solution Tolerance",gtol);
1510 ::ROL::BundleStatusTest<RealT> status_bm(gtol, maxit);
1511 ::ROL::BundleStep<RealT> step_bm(*parlist);
1512 ::ROL::Algorithm<RealT> algo_bm(Teuchos::rcp(&step_bm,
false),Teuchos::rcp(&status_bm,
false),
false);
1513 std::clock_t timer_bm = std::clock();
1515 algo_bm.run(zc,fullobj,*bconcvar,
true,*outStream);
1517 algo_bm.run(z,fullobj,*bcon,
true,*outStream);
1518 *outStream <<
"\n Solution " << std::endl;
1519 for (
int i=0;i<nz;i++)
1521 *outStream <<
paramNameVec_[i] <<
" = " << (*z_rcp)[i] << std::endl;
1523 *outStream <<
"var = " << zv << std::endl;
1524 *outStream <<
"Bundle Method required " << (std::clock()-timer_bm)/(RealT)CLOCKS_PER_SEC
1530 std::vector<
std::
string> output_data_UQ;
1531 output_data_UQ.push_back("data_UQ_DET.txt");
1532 output_data_UQ.push_back("data_UQ_EV.txt");
1533 output_data_UQ.push_back("data_UQ_CVaR.txt");
1534 std::vector<
std::
string> output_plot_UQ;
1535 output_plot_UQ.push_back("plot_UQ_DET.txt");
1536 output_plot_UQ.push_back("plot_UQ_EV.txt");
1537 output_plot_UQ.push_back("plot_UQ_CVaR.txt");
1538 std::vector< ::
ROL::StdVector<RealT> > solutions;
1539 solutions.push_back(z1);
1540 solutions.push_back(z2);
1541 solutions.push_back(z3);
1543 int nTestSamp = nGSamp - nSamp;
1544 out << "Using " << nTestSamp << " to approximate densities" <<
std::endl;
1545 for(
int k=0;k<solutions.size();k++)
1547 std::ofstream data_UQ(output_data_UQ[k].c_str());
1548 std::ofstream plot_UQ(output_plot_UQ[k].c_str());
1549 sumlin = 0; sumlin2 = 0;
1550 sumgain = 0; sumgain2 = 0;
1551 for(
int i=nSamp;i<nGSamp;i++)
1553 con->setParameter(samplerTest->getMyPoint(i));
1554 con->solve(u,solutions[k],tol);
1555 oval = obj.value(u,solutions[k],tol);
1556 for(
int j=0;j<nc;j++)
1557 plot_UQ << std::scientific << std::setprecision(8) << (*(*uup)[j])[3] <<
' ';
1559 gain = ((*(*uup)[nc-1])[3]-(*(*uup)[0])[3])/2.0;
1561 sumgain2 += gain*gain;
1564 data_UQ << std::scientific << std::setprecision(8) << (samplerTest->getMyPoint(i))[j] <<
' ';
1566 data_UQ << oval <<
' ' << gain <<
'\n';
1568 sumlin2 += oval*oval;
1571 meanlin = sumlin/nTestSamp;
1572 meangain = sumgain/nTestSamp;
1573 varlin = (sumlin2 - nTestSamp*meanlin*meanlin)/(RealT)(nTestSamp-1);
1574 vargain = (sumgain2 - nTestSamp*meangain*meangain)/(RealT)(nTestSamp-1);
1575 data_UQ <<
"\n ------------------------------------------ \n";
1576 data_UQ <<
"mean(lin) = " << meanlin <<
" " <<
'\n';
1577 data_UQ <<
"sqrt(sample variance)(lin) = " << std::sqrt(varlin) <<
'\n';
1578 data_UQ <<
"mean(gain) = " << meangain <<
'\n';
1579 data_UQ <<
"sqrt(sample variance)(gain) = " << std::sqrt(vargain) <<
'\n';
1591 parlist->set(
"Bundle Step: Epsilon Solution Tolerance",gtol);
1592 ::ROL::BundleStatusTest<RealT> status_bm(gtol, maxit);
1593 ::ROL::BundleStep<RealT> step_bm(*parlist);
1594 ::ROL::Algorithm<RealT> algo_bm(Teuchos::rcp(&step_bm,
false),Teuchos::rcp(&status_bm,
false),
false);
1595 std::clock_t timer_bm = std::clock();
1597 objVec.push_back(robj);
1599 objVec.push_back(rpen);
1602 SumObjective<RealT> fullobj(objVec,types);
1603 algo_bm.run(z,fullobj,*bcon,
true,*outStream);
1604 *outStream <<
"\n Solution " << std::endl;
1605 for (
int i=0;i<nz;i++)
1607 *outStream <<
paramNameVec_[i] <<
" = " << (*z_rcp)[i] << std::endl;
1609 *outStream <<
"Bundle Method required " << (std::clock()-timer_bm)/(RealT)CLOCKS_PER_SEC
1615 ::ROL::StatusTest<RealT> status_tr(gtol, stol, maxit);
1616 ::ROL::TrustRegionStep<RealT> step_tr(*parlist);
1617 ::ROL::Algorithm<RealT> algo_tr(Teuchos::rcp(&step_tr,
false),Teuchos::rcp(&status_tr,
false),
false);
1618 std::clock_t timer_tr = std::clock();
1620 objVec.push_back(robj);
1622 objVec.push_back(rpen);
1625 SumObjective<RealT> fullobj(objVec,types);
1626 algo_tr.run(z,fullobj,*bcon,
true,*outStream);
1627 *outStream <<
"\n Solution " << std::endl;
1628 for (
int i=0;i<nz;i++)
1630 *outStream <<
paramNameVec_[i] <<
" = " << (*z_rcp)[i] << std::endl;
1632 *outStream <<
"Trust-Region required " << (std::clock()-timer_tr)/(RealT)CLOCKS_PER_SEC
1638 ::ROL::StatusTest<RealT> status_ls(gtol, stol, maxit);
1639 ::ROL::LineSearchStep<RealT> step_ls(*parlist);
1640 ::ROL::Algorithm<RealT> algo_ls(Teuchos::rcp(&step_ls,
false),Teuchos::rcp(&status_ls,
false),
false);
1641 std::clock_t timer_ls = std::clock();
1643 objVec.push_back(robj);
1645 objVec.push_back(rpen);
1648 SumObjective<RealT> fullobj(objVec,types);
1649 algo_ls.run(z,fullobj,*bcon,
true,*outStream);
1650 *outStream <<
"\n Solution " << std::endl;
1651 for (
int i=0;i<nz;i++)
1653 *outStream <<
paramNameVec_[i] <<
" = " << (*z_rcp)[i] << std::endl;
1655 *outStream <<
"Line-Search required " << (std::clock()-timer_ls)/(RealT)CLOCKS_PER_SEC
1661 Teuchos::RCP<std::vector<RealT> > gz_rcp = Teuchos::rcp(
new std::vector<RealT> (nz, 0.0) );
1662 ::ROL::StdVector<RealT> gz(gz_rcp);
1663 Teuchos::RCP< ::ROL::Vector<RealT> > gzp = Teuchos::rcp(&gz,
false);
1665 Teuchos::RCP< ::ROL::Vector<RealT> > gup = Teuchos::rcp(&gu,
false);
1666 ::ROL::Vector_SimOpt<RealT> g(gup,gzp);
1669 RealT ctol = 1.e-16;
1670 ::ROL::ConstraintStatusTest<RealT> status_sqp(gtol,ctol,stol,maxit);
1671 ::ROL::CompositeStep<RealT> step_sqp(*parlist);
1672 ::ROL::Algorithm<RealT> algo_sqp(Teuchos::rcp(&step_sqp,
false),Teuchos::rcp(&status_sqp,
false),
false);
1673 std::clock_t timer_sqp = std::clock();
1675 objVec.push_back(obj);
1677 objVec.push_back(pen);
1680 SumObjective<RealT> fullobj(objVec,types);
1681 algo_sqp.run(x,g,l,cc,fullobj,*con,
true,*outStream);
1682 out <<
"\n Solution " << std::endl;
1683 for (
int i=0;i<nz;i++)
1685 *outStream <<
paramNameVec_[i] <<
" = " << (*z_rcp)[i] << std::endl;
1687 out <<
"Composite-Step SQP required " << (std::clock()-timer_sqp)/(RealT)CLOCKS_PER_SEC
1693 catch (std::logic_error err)
1712 bool integration_status =
true;
1721 int currentStep = 0;
1723 while (currentStep < finalStep)
1736 Xyce::dout() <<
"ROL DC Sweep # " << currentStep <<
"\t" << (*it);
1739 if (currentStep != 0 && reset)
1782 return integration_status;
1827 Linear::System & linear_system,
1830 Topo::Topology & topology,
1831 IO::InitialConditionsManager & initial_conditions_manager)
1843 virtual ~ROLFactory()
1865 step->setAnalysisParams(*it);
1886 void setROLAnalysisOptionBlock(
const Util::OptionBlock &option_block)
1890 if (Util::compareParamLists(option_block, *it))
1892 (*it) = option_block;
1901 std::string param_name;
1904 param_name = (*it).getName();
1905 std::cout <<
"parameter = " << param_name << std::endl;
1926 bool setTimeIntegratorOptionBlock(
const Util::OptionBlock &option_block)
1947 struct ROLAnalysisReg :
public IO::PkgOptionsReg
1950 ROLFactory & factory)
1954 bool operator()(
const Util::OptionBlock &option_block)
1956 factory_.setROLAnalysisOptionBlock(option_block);
1979 IO::PkgOptionsMgr & options_manager,
1980 IO::CircuitBlock & circuit_block,
1981 const std::string & netlist_filename,
1982 const IO::TokenVector & parsed_line)
1984 Util::OptionBlock option_block(
"ROL", Util::OptionBlock::ALLOW_EXPRESSIONS, netlist_filename, parsed_line[0].lineNumber_);
1986 int numFields = parsed_line.size();
1992 bool typeExplicitSetLinDecOct =
false;
1993 bool typeExplicitSetList =
false;
1994 std::string type(
"LIN");
1995 while ( pos1 < numFields )
1997 ExtendedString stringVal ( parsed_line[pos1].string_ );
1998 stringVal.toUpper ();
1999 if (stringVal ==
"LIN" ||
2000 stringVal ==
"DEC" ||
2003 typeExplicitSetLinDecOct =
true;
2006 else if (stringVal ==
"LIST")
2008 typeExplicitSetList =
true;
2017 if (typeExplicitSetLinDecOct)
2022 if (!typeExplicitSetList)
2024 if ( (numFields-offset)%4 != 0 )
2026 Report::UserError0().at(netlist_filename, parsed_line[0].lineNumber_)
2027 <<
".ROL line not formatted correctly.";
2032 int linePosition = 1;
2033 Util::Param parameter(
"",
"");
2036 parameter.setTag(
"TYPE" );
2037 parameter.setVal( type );
2038 option_block.addParam( parameter );
2042 if (typeExplicitSetLinDecOct) linePosition=2;
2043 while ( linePosition < numFields )
2045 parameter.setTag(
"PARAM" );
2046 parameter.setVal(std::string(ExtendedString(parsed_line[linePosition].string_).toUpper()));
2047 option_block.addParam( parameter );
2050 parameter.setTag(
"START" );
2051 parameter.setVal( parsed_line[linePosition].string_ );
2052 option_block.addParam( parameter );
2055 parameter.setTag(
"STOP" );
2056 parameter.setVal( parsed_line[linePosition].string_ );
2057 option_block.addParam( parameter );
2060 parameter.setTag(
"ROL" );
2061 parameter.setVal( parsed_line[linePosition].string_ );
2062 option_block.addParam( parameter );
2066 else if (type==
"DEC")
2068 if (typeExplicitSetLinDecOct) linePosition=2;
2070 while ( linePosition < numFields )
2072 parameter.setTag(
"PARAM" );
2073 parameter.setVal(std::string(ExtendedString(parsed_line[linePosition].string_).toUpper()));
2074 option_block.addParam( parameter );
2077 parameter.setTag(
"START" );
2078 parameter.setVal( parsed_line[linePosition].string_ );
2079 option_block.addParam( parameter );
2082 parameter.setTag(
"STOP" );
2083 parameter.setVal( parsed_line[linePosition].string_ );
2084 option_block.addParam( parameter );
2087 parameter.setTag(
"NUMROLS" );
2088 parameter.setVal( parsed_line[linePosition].string_ );
2089 option_block.addParam( parameter );
2093 else if (type==
"OCT")
2095 if (typeExplicitSetLinDecOct) linePosition=2;
2097 while ( linePosition < numFields )
2099 parameter.setTag(
"PARAM" );
2100 parameter.setVal(std::string(ExtendedString(parsed_line[linePosition].string_).toUpper()));
2101 option_block.addParam( parameter );
2104 parameter.setTag(
"START" );
2105 parameter.setVal( parsed_line[linePosition].string_ );
2106 option_block.addParam( parameter );
2109 parameter.setTag(
"STOP" );
2110 parameter.setVal( parsed_line[linePosition].string_ );
2111 option_block.addParam( parameter );
2114 parameter.setTag(
"NUMROLS" );
2115 parameter.setVal( parsed_line[linePosition].string_ );
2116 option_block.addParam( parameter );
2121 else if (type==
"LIST")
2123 parameter.setTag(
"PARAM" );
2124 parameter.setVal(std::string(ExtendedString(parsed_line[1].string_).toUpper()));
2125 option_block.addParam( parameter );
2128 while (linePosition<numFields)
2130 parameter.setTag(
"VAL" );
2131 parameter.setVal( parsed_line[linePosition].string_ );
2132 option_block.addParam( parameter );
2138 Report::UserError0().at(netlist_filename, parsed_line[0].lineNumber_)
2139 <<
".ROL line contains an unrecognized type";
2142 circuit_block.addOptions(option_block);
2158 factory_block.
optionsManager_.addCommandParser(
".ROL", extractROLData);
2160 factory_block.
optionsManager_.addCommandProcessor(
"ROL",
new ROLAnalysisReg(*factory));
2162 factory_block.
optionsManager_.addOptionsProcessor(
"TIMEINT", IO::createRegistrationOptions(*factory, &ROLFactory::setTimeIntegratorOptionBlock));
bool doProcessSuccessfulStep()
bool enableSensitivity(TimeIntg::DataStore &data_store, Parallel::Manager ¶llel_manager, Topo::Topology &topology)
int setupSweepLoop(Parallel::Machine comm, Loader::Loader &loader, std::vector< SweepParam >::iterator begin, std::vector< SweepParam >::iterator end)
void setSweepValue(int step)
IO::PkgOptionsMgr & optionsManager_
SweepVector stepSweepVector_
void setDAEStateDerivFlag(bool state)
unsigned int successStepsThisParameter_
unsigned int successfulStepsTaken_
Number of consecutive successful time-integration steps.
int newtonConvergenceStatus
virtual bool setInitialGuess(Linear::Vector *solVectorPtr)
TwoLevelMode getTwoLevelMode() const
std::vector< Linear::Vector * > mysensRHSPtrVector_
void setDCAnalysisStepNumber(int num)
std::vector< int > rolSweepFailures_
bool setTimeIntegratorOption(const Util::Param ¶m)
bool doProcessFailedStep()
std::vector< std::string > paramNameVec_
void evaluateStepError(const Loader::Loader &loader, const TIAParams &tia_params)
Pure virtual class to augment a linear system.
virtual void stepFailure(Analysis::TwoLevelMode analysis)
Util::OptionBlock timeIntegratorOptionBlock_
bool doAllocations(int nc, int nz)
virtual bool outputPlotFiles() const
unsigned int stepNumber
Time-integration step number counter.
IO::InitialConditionsManager & initialConditionsManager_
void outputSolDataArrays(std::ostream &os)
bool updateSweepParams(Loader::Loader &loader, int step_count, std::vector< SweepParam >::iterator begin, std::vector< SweepParam >::iterator end, bool overrideOriginal)
void setAnalysisMode(Mode analysis_mode)
AnalysisManager & analysisManager_
Topo::Topology & topology_
void gatherStepStatistics(StatCounts &stats, Nonlinear::NonLinearSolver &nonlinear_solver, int newton_convergence_status)
Topo::Topology & topology_
void createTimeIntegratorMethod(const TimeIntg::TIAParams &tia_params, const unsigned int integration_method)
virtual int getDoubleDCOPStep() const
Parallel::Machine getComm() const
void setAnalysisMode(AnalysisMode mode)
unsigned int failedStepsAttempted_
Total number of failed time-integration steps.
void obtainCorrectorDeriv()
void setStepSweepVector(const Analysis::SweepVector &sweep_vector)
Parallel::Manager * getPDSManager() const
bool setDCOPOption(const Util::Param ¶m)
TimeIntg::StepErrorControl & getStepErrorControl()
void updateSolDataArrays()
bool getBeginningIntegrationFlag() const
void computeDividedDifferences()
NonLinearSolver & getNonlinearSolver()
std::vector< Linear::Vector * > statePtrVector_
Linear::Vector * daeQVectorPtr
void setConstantHistory()
virtual bool startTimeStep(bool beginIntegrationFlag, double nextTimeStep, double nextTime, int currentOrder)
void setErrorWtVector(const TIAParams &tia_params)
Nonlinear::Manager & nonlinearManager_
virtual bool isPDESystem() const
bool registerROLFactory(FactoryBlock &factory_block)
Linear::Vector * daeFVectorPtr
IO::InitialConditionsManager & initialConditionsManager_
The FactoryBlock contains parameters needed by the analysis creation functions.
Linear::System & linearSystem_
IO::InitialConditionsManager & initialConditionsManager_
Nonlinear::AnalysisMode nonlinearAnalysisMode(Mode mode)
Returns the nonlinear analysis mode given the analysis mode.
Nonlinear::Manager & nonlinearManager_
TimeIntg::TIAParams tiaParams_
virtual bool updateSources()
std::vector< Linear::Vector * > mydqdpPtrVector_
unsigned int solutionSize
AnalysisManager & analysisManager_
void initializeSolution_()
ROL(AnalysisManager &analysis_manager, Nonlinear::Manager &nonlinear_manager, Loader::Loader &loader, Linear::System &linear_system, Topo::Topology &topology, IO::InitialConditionsManager &initial_conditions_manager)
SweepParam parseSweepParams(Util::ParamList::const_iterator first, Util::ParamList::const_iterator last)
Populate the sweep params from the parameter list.
Linear::Vector * dFdxdVpVectorPtr
Loader::NonlinearEquationLoader & getNonlinearEquationLoader()
void setDoubleDCOPEnabled(bool enable)
int numberSuccessiveFailures
AnalysisManager & analysisManager_
Nonlinear::Manager & nonlinearManager_
std::vector< Linear::Vector * > constraintPtrVector_
std::vector< Util::OptionBlock > stepSweepAnalysisOptionBlock_
TimeIntegrationMethod *(* Factory)(const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store)
Linear::Vector * nextSolutionPtr
std::vector< Linear::Vector * > solutionPtrVector_
std::vector< Linear::Vector * > testPtrVector_
void addAnalysisFactory(FactoryBlock &factory_block, Util::Factory< AnalysisBase, void > *factory)
std::vector< std::string > uncertainParams_
bool getDoubleDCOPEnabled() const
void setInputOPFlag(bool initial_conditions_loaded)
TimeIntg::WorkingIntegrationMethod & getWorkingIntegrationMethod()
std::vector< Linear::Vector * > mydbdpPtrVector_
void setSweepSourceResetFlag(bool reset)
const IO::CmdParse & getCommandLine() const
void obtainPredictorDeriv()
Linear::Vector * currSolutionPtr
bool firstDoubleDCOPStep() const
TimeIntg::DataStore * getDataStore()
std::vector< Linear::Vector * > mydfdpPtrVector_
unsigned int baseIntegrationMethod_
Current time-integration method flag.
std::vector< Linear::Vector * > jvecPtrVector_
Parallel::Machine getComm()
bool setTimeIntegratorOptions(const Util::OptionBlock &option_block)
virtual void stepSuccess(Analysis::TwoLevelMode analysis)
OutputMgrAdapter & outputManagerAdapter_
Linear::System & linearSystem_
Linear::Vector * flagSolutionPtr
Topo::Topology & topology_
Linear::Vector * daeBVectorPtr
bool setReturnCodeOption(const Util::Param ¶m)
const TimeIntg::TIAParams & getTIAParams() const
Linear::System & linearSystem_
bool setAnalysisParams(const Util::OptionBlock ¶msBlock)