8 #ifndef QPGENSTOCHDRIVER 9 #define QPGENSTOCHDRIVER 19 #include <sys/resource.h> 27 #include "MehrotraSolver.h" 65 template<
class SOLVER,
class FORMULATION>
72 MPI_Init(&argc, &argv);
87 template<
class SOLVER,
class FORMULATION>
96 getrusage( RUSAGE_SELF, &before_read );
99 FORMULATION* qp =
new FORMULATION(tree);
103 #ifdef HAVE_GETRUSAGE 105 getrusage( RUSAGE_SELF, &after_read );
109 Residuals * resid = qp->makeResiduals( prob );
110 SOLVER * s =
new SOLVER( qp, prob );
119 #ifdef HAVE_GETRUSAGE 121 getrusage( RUSAGE_SELF, &before_solve );
127 int result = s->solve(prob, vars, resid);
131 int rank=0, size; MPI_Comm_size(MPI_COMM_WORLD, &size);
132 if(size>1) MPI_Comm_rank(MPI_COMM_WORLD, &rank);
136 #ifdef HAVE_GETRUSAGE 138 getrusage( RUSAGE_SELF, &after_solve );
155 sTree* stTree = qp->tree;
156 cout << stTree->
N <<
" variables, " 157 << stTree->
MY <<
" equality constraints, " 158 << stTree->
MZ <<
" inequality constraints.\n";
164 printf(
"NITER %d\n", s->iter);
165 printf(
"SOL %f\n", objective);
166 printf(
"TOTTIME %f SEC\n", execTmMonitor.
tmIterate);
168 cout <<
"Iterates: " << s->iter
169 <<
", Optimal Solution: " << objective << endl;
171 cout <<
"Problem solved in " << execTmMonitor.
tmIterate <<
" sec" << endl;
174 cout <<
"The x-solution is:\n";
181 cout <<
"Could not solve this QP.\n";
182 cout <<
"Terminated with code " << result;
183 if( result > 0 && result <=
UNKNOWN ) {
196 cout <<
"Maximum memory usage: " <<
208 catch( logic_error &e ) {
209 cerr <<
"Elemental error: " << e.what() << endl;
213 cerr <<
"\nOops, out of memory\n";
long long MZ
Definition: sTree.h:114
int printLevel
Definition: sDriver.h:43
int printx
Definition: sDriver.h:42
virtual void recIterateTm_stop()
Definition: StochResourcesMonitor.C:222
long long N
Definition: sTree.h:114
int scale
Definition: sDriver.h:41
OoqpVectorHandle x
Definition: NlpGenVars.h:50
Definition: Residuals.h:22
Definition: StochResourcesMonitor.h:107
StochRunParams * defaultStochRunParams()
Definition: sDriver.h:52
int gOoqpPrintLevel
!
Definition: Solver.C:17
Definition: NlpGenVars.h:27
long long MY
Definition: sTree.h:114
virtual double objectiveValue(Variables *vars)
Definition: NlpGenData.C:659
virtual void recIterateTm_start()
Definition: StochResourcesMonitor.C:216
const char * TerminationStrings[]
Definition: Status.C:9
int nb
Definition: sDriver.h:49
int nlpstoch_solve(int argc, char *argv[], StochInputTree *tree, StochRunParams *params, SOLVER *s, FORMULATION *qp)
Definition: sDriver.h:66
int nscaprocs
Definition: sDriver.h:48
virtual void writeToStream(std::ostream &out) const =0
Definition: StochMonitor.h:16
double tmIterate
Definition: StochResourcesMonitor.h:118
Definition: NlpGenData.h:32
static unsigned long getMaxMemUsage()
Definition: StochResourcesMonitor.C:230