MCPcopy Create free account
hub / github.com/PSOPT/psopt / main

Function main

snopt-interface/cppexamples/sntoyB_w.cpp:67–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65/*--------------------------------------------------------------------*/
66
67int main(int argc, char **argv) {
68 int n = 2;
69 int m = 3;
70 int ne = 5;
71 int nnCon = 2;
72 int nnObj = 0;
73 int nnJac = 2;
74 int negCon = -1; // if you don't know the size of gCon
75
76 int nS = 0, nInf;
77 double objective, sInf;
78
79 int leniw = 1000;
80 int lenrw = 1000;
81 int *iw = new int[leniw];
82 double *rw = new double[lenrw];
83
84 snoptProblemB ToyProb("ToyB", iw, leniw, rw, lenrw);
85
86 int *indJ = new int[ne];
87 int *locJ = new int[n+1];
88 double *valJ = new double[ne];
89
90 double *x = new double[n+m];
91 double *bl = new double[n+m];
92 double *bu = new double[n+m];
93 double *pi = new double[m];
94 double *rc = new double[n+m];
95 int *hs = new int[n+m];
96
97 int iObj = 2;
98 double ObjAdd = 0;
99
100 int Cold = 0, Basis = 1, Warm = 2;
101
102
103 // Set the upper and lower bounds.
104 bl[0] = 0; bu[0] = 1e20;
105 bl[1] = -1e20; bu[1] = 1e20;
106 bl[2] = -1e20; bu[2] = 4;
107 bl[3] = -1e20; bu[3] = 5;
108 bl[4] = -1e20; bu[4] = 1e20;
109
110 // Initialize states, x and multipliers
111 for (int i = 0; i < n+m; i++) {
112 hs[i] = 0;
113 x[i] = 0;
114 rc[i] = 0;
115 }
116
117 for (int i = 0; i < m; i++) {
118 pi[i] = 0;
119 }
120
121 x[0] = 1.0;
122 x[1] = 1.0;
123
124 // Set up the Jacobian matrix

Callers

nothing calls this directly

Calls 4

initializeMethod · 0.80
setSpecsFileMethod · 0.80
setIntParameterMethod · 0.80
solveMethod · 0.80

Tested by

no test coverage detected