PaGMO  1.1.5
snoptProblem_PAGMO.h
1 #ifndef SNOPTPROBLEM_PAGMO
2 #define SNOPTPROBLEM_PAGMO
3 
4 #include "snopt_PAGMO.h"
5 #include "../../problem/base.h"
6 #include "../../algorithm/snopt.h"
7 
8 
9 // class snoptProblem_PAGMO performs problem set-up, initialization,
10 // and problem-specific variable storage.
11 class snoptProblem_PAGMO {
12 protected:
13  //************************************************************
14  // The variables below must be set by the user with initialize
15  char Prob[200];
16 
17  integer n, neF;
18  integer ObjRow;
19  doublereal ObjAdd;
20 
21  integer lenA, neA;
22  integer *iAfun, *jAvar;
23  doublereal *A;
24  integer lenG, neG;
25  integer *iGfun, *jGvar;
26 
27  doublereal *x, *xlow, *xupp, *xmul;
28  doublereal *F, *Flow, *Fupp, *Fmul;
29 
30  integer *xstate, *Fstate;
31 
32  char *xnames, *Fnames;
33  integer nxnames, nFnames;
34 
35  My_fp usrfun;
36  //***********************************************************
37  //***********************************************************
38  void userDataSet();
39  void errMsgExit( const char *var );
40 
41  integer inform, fortranStyleObj, fortranStyleAG;
42  integer minrw, miniw, mincw;
43  integer lenrw, leniw, lencw;
44  doublereal *rw;
45  integer *iw;
46  char *cw;
47 
48  integer iSpecs, iSumm, iPrint;
49  integer initCalled;
50  char specname[200], printname[200];
51  integer spec_len, prnt_len;
52 
53  //added for PAGMO compatibility
54  char *cu;
55  integer lencu;
56  double *ru;
57  integer lenru;
58 
59  void init2zero();
60  void setMemory();
61  void alloc ( integer lencw, integer leniw, integer lenrw );
62  void realloc ( integer lencw, integer leniw, integer lenrw );
63  void memcpyIn ( char *tcw, integer *tiw, doublereal *trw,
64  integer tlencw, integer tleniw, integer tlenrw);
65  void memcpyOut( char *tcw, integer *tiw, doublereal *trw,
66  integer tlencw, integer tleniw, integer tlenrw);
67 public:
68  snoptProblem_PAGMO(const pagmo::problem::base& problem, pagmo::algorithm::snopt::preallocated_memory *di_comodo);
69  ~snoptProblem_PAGMO();
70  void increment();
71  void decrement();
72  void computeJac();
73 
74  int snmema( integer &mincw, integer &miniw, integer &minrw);
75 
76  void init();
77  void setParameter ( char *stroptin );
78  void getParameter ( char *stroptin, char *stroptout );
79  void setIntParameter ( const char *stropt, integer opt );
80  void getIntParameter ( const char *stropt, integer &opt );
81  void setRealParameter( const char *stropt, doublereal opt );
82  void getRealParameter( const char *stropt, doublereal &opt );
83  void solve ( integer starttype );
84  void setPrintFile ( const char printname[] );
85  void setSpecFile ( char specname[] );
86 
87  // Functions that set up the problem data:
88  void setProblemSize( integer n, integer neF );
89  void setObjective ( integer ObjRow, doublereal ObjAdd );
90  void setA ( integer lenA, integer *iAfun, integer *jAvar,
91  doublereal *A );
92  void setNeA ( integer neA );
93  void setG ( integer lenG, integer *iGfun, integer *jGvar );
94  void setNeG ( integer neG );
95  integer getNeG (){return neG;}
96  void setX ( doublereal *x, doublereal *xlow, doublereal *xupp,
97  doublereal *xmul, integer *xstate );
98  void setF ( doublereal *F, doublereal *Flow, doublereal *Fupp,
99  doublereal *Fmul, integer *Fstate );
100  void setXNames ( char *xnames, integer nxnames );
101  void setFNames ( char *Fnames, integer nFnames );
102  void setProbName ( const char *Prob );
103  void setUserFun ( My_fp usrfun );
104  void activate_screen_output() {iSumm = 6;}
105  void deactivate_screen_output() {iSumm = 0;}
106 };
107 
108 #endif
Base problem class.
Definition: problem/base.h:148