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

Function main

snopt-interface/cppexamples/sntoyC.cpp:43–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43int main(int argc, char **argv) {
44 snoptProblemC ToyProb("ToyC");
45
46 int n = 2;
47 int m = 3;
48 int ne = 5;
49 int nnCon = 2;
50 int nnObj = 0;
51 int nnJac = 2;
52 int negCon = 4; // size of gCon
53
54 int nS = 0, nInf;
55 double objective, sInf;
56
57 int *indJ = new int[ne];
58 int *locJ = new int[n+1];
59 double *valJ = new double[ne];
60
61 double *x = new double[n+m];
62 double *bl = new double[n+m];
63 double *bu = new double[n+m];
64 double *pi = new double[m];
65 double *rc = new double[n+m];
66 int *hs = new int[n+m];
67
68 int iObj = 2;
69 double ObjAdd = 0;
70
71 int Cold = 0, Basis = 1, Warm = 2;
72
73
74 // Set the upper and lower bounds.
75 bl[0] = 0; bu[0] = 1e20;
76 bl[1] = -1e20; bu[1] = 1e20;
77 bl[2] = -1e20; bu[2] = 4;
78 bl[3] = -1e20; bu[3] = 5;
79 bl[4] = -1e20; bu[4] = 1e20;
80
81 // Initialize states, x and multipliers
82 for (int i = 0; i < n+m; i++) {
83 hs[i] = 0;
84 x[i] = 0;
85 rc[i] = 0;
86 }
87
88 for (int i = 0; i < m; i++) {
89 pi[i] = 0;
90 }
91
92 x[0] = 1.0;
93 x[1] = 1.0;
94
95 // Set up the Jacobian matrix
96 // Column 1
97 locJ[0] = 0;
98
99 indJ[0] = 0;
100 valJ[0] = 0;

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