CONOPT
Loading...
Searching...
No Matches
pinadd2.c
Go to the documentation of this file.
1
6
7#include <stdlib.h>
8#include <stdio.h>
9#include <math.h>
10#include <string.h>
11#include "coiheader.h"
12
13#include "comdecl.h"
14int T = 16; /* Number of time periods */
15#define Tmin 16
16#define Tmax 20
17#define Vpp 7 /* Variables per period */
18#define Epp 6 /* Equations per period */
19#define Hpp 5 /* Hessian elements per period -- se below */
20double Xkeep[Tmax*Vpp]; /* Space for storing solutions */
21int Xstat[Tmax*Vpp]; /* Space for storing status info */
22int Estat[Tmax*Epp]; /* Space for storing status info */
23
24
29int COI_CALLCONV Pin_ReadMatrix( double LOWER[], double CURR[], double UPPER[], int VSTA[], int TYPE[],
30 double RHS[], int ESTA[], int COLSTA[], int ROWNO[], double VALUE[],
31 int NLFLAG[], int NUMVAR, int NUMCON, int NUMNZ, void* USRMEM )
32{
33 int it, is, i, icol, iz, iold;
34/*
35 Define the information for the columns.
36
37 We should not supply status information, VSTA.
38
39 We order the variables as follows:
40 0: td, 1: cs, 2: s, 3: d, 4: r, 5: p, and 6: rev. All variables for
41 period 1 appears first followed by all variables for period 2 etc.
42
43 td, cs, s, and d have lower bounds of 0, r and p have lower
44 bounds of 1, and rev has no lower bound.
45 All have infinite upper bounds (default).
46 The initial value of td is 18, s is 7, cs is 7*t, d is td-s,
47 p is 14, and r is r(t-1)-d. No initial value for rev. */
48
49 for ( it=1; it<=T; it++ ) {
50 is = Vpp*(it-1);
51 LOWER[is ] = 0;
52 LOWER[is+1] = 0;
53 LOWER[is+2] = 0;
54 LOWER[is+3] = 0;
55 LOWER[is+4] = 1;
56 LOWER[is+5] = 1;
57 CURR[is ] = 18;
58 CURR[is+1] = 7*it;
59 CURR[is+2] = 7;
60 CURR[is+3] = CURR[is] - CURR[is+2];
61 if ( it > 1 )
62 CURR[is+4] = CURR[is+4-Vpp] - CURR[is+3];
63 else
64 CURR[is+4] = 500 - CURR[is+3];
65 CURR[is+5] = 14;
66 }
67 if ( T > Tmin ) {
68
69/* This is a restart: Use the initial values from last solve for
70 the variables in the first periods and extrapolate the last
71 period using a linear extrapolation between the last two */
72
73 iold = Vpp*(T-1);
74 for ( i = 0; i < iold; i++ )
75 CURR[i] = Xkeep[i];
76 for ( i = 0; i < Vpp; i++ )
77 CURR[iold+i] = CURR[iold+i-Vpp] + (CURR[iold+i-Vpp]-CURR[iold+i-2*Vpp]);
78
79/* The variables from the last solve are given the old status and
80 the variables in the new period are given those in the last
81 pariod. Similarly with the Equation status: */
82
83 for ( i = 0; i < iold; i++ )
84 VSTA[i] = Xstat[i];
85 for ( i = 0; i < Vpp; i++ )
86 VSTA[iold+i] = Xstat[iold+i-Vpp];
87 iold = Epp*(T-1)+1;
88 for ( i = 0; i < iold; i++ )
89 ESTA[i] = Estat[i];
90 for ( i = 0; i < Epp; i++ )
91 ESTA[iold+i] = Estat[iold+i-Epp];
92 }
93/*
94 Define the information for the rows
95
96 We order the constraints as follows: The objective is first,
97 followed by tddef, sdef, csdef, ddef, rdef, and revdef for
98 the first period, the same for the second period, etc.
99
100 The objective is a nonbinding constraint: */
101
102 TYPE[0] = 3;
103
104/* All others are equalities: */
105
106 for ( i = 1; i < NUMCON; i++ )
107 TYPE[i] = 0;
108/*
109 Right hand sides: In all periods except the first, only tddef
110 has a nonzero right hand side of 1+2.3*1.015**(t-1).
111 In the initial period there are contributions from lagged
112 variables in the constraints that have lagged variables. */
113
114 for ( it = 1; it<=T; it++ ) {
115 is = 1 + 6*(it-1);
116 RHS[is] = 1.0+2.3*pow(1.015,(it-1.));
117 }
118
119/* tddef: + 0.87*td(0) */
120
121 RHS[1] = RHS[1]+ 0.87*18.;
122
123/* sdef: +0.75*s(0) */
124
125 RHS[2] = 0.75*6.5;
126
127/* csdef: +1*cs(0) */
128
129 RHS[3] = 0;
130
131/* rdef: +1*r(0) */
132
133 RHS[5] = 500;
134
135/*
136 Define the structure and content of the Jacobian:
137 To help define the Jacobian pattern and values it can be useful to
138 make a picture of the Jacobian. We describe the variables for one
139 period and the constraints they are part of:
140
141 td cs s d r p rev
142 0 1 2 3 4 5 6
143 0: Obj (1+r)**(1-t)
144 Period t:
145 0: tddef 1.0 0.13
146 1: sdef NL 1.0 NL
147 2: csdef 1.0 -1.0
148 3: ddef -1.0 1.0 1.0
149 4: rdef 1.0 1.0
150 5: revdef NL NL NL 1.0
151 Period t+1:
152 0: tddef -0.87
153 1: sdef -0.75
154 2: csdef -1.0
155 3: ddef
156 4: rdef -1.0
157 5: revdef
158
159 The Jacobian has to be sorted column-wise so we will just define
160 the elements column by column according to the table above: */
161
162 iz = 0; /* Running index for Jacobian in C convention 0 to nz-1 */
163 icol = 0; /* Running column index in C convention 0 to N-1 */
164 for ( it = 1; it <= T; it++ )
165 {
166
167/* is points to the position before the first equation for the period */
168
169 is = 1 + 6*(it-1); /* 1 correspond to the objective in row 0 */
170
171/* Column td: */
172 COLSTA[icol] = iz;
173 icol = icol + 1;
174 ROWNO[iz] = is;
175 VALUE[iz] = +1.0;
176 NLFLAG[iz] = 0;
177 iz = iz + 1;
178 ROWNO[iz] = is+3;
179 VALUE[iz] = -1.0;
180 NLFLAG[iz] = 0;
181 iz = iz + 1;
182 if ( it < T ) {
183 ROWNO[iz] = is+Epp;
184 VALUE[iz] = -0.87;
185 NLFLAG[iz] = 0;
186 iz = iz + 1;
187 }
188
189/* Column cs */
190 COLSTA[icol] = iz;
191 icol = icol + 1;
192 ROWNO[iz] = is+1;
193 NLFLAG[iz] = 1;
194 iz = iz + 1;
195 ROWNO[iz] = is+2;
196 VALUE[iz] = +1.0;
197 NLFLAG[iz] = 0;
198 iz = iz + 1;
199 if ( it < T ) {
200 ROWNO[iz] = is+2+Epp;
201 VALUE[iz] = -1.0;
202 NLFLAG[iz] = 0;
203 iz = iz + 1;
204 }
205
206/* Column s */
207 COLSTA[icol] = iz;
208 icol = icol + 1;
209 ROWNO[iz] = is+1;
210 VALUE[iz] = +1.0;
211 NLFLAG[iz] = 0;
212 iz = iz + 1;
213 ROWNO[iz] = is+2;
214 VALUE[iz] = -1.0;
215 NLFLAG[iz] = 0;
216 iz = iz + 1;
217 ROWNO[iz] = is+3;
218 VALUE[iz] = +1.0;
219 NLFLAG[iz] = 0;
220 iz = iz + 1;
221 if ( it < T ) {
222 ROWNO[iz] = is+1+Epp;
223 VALUE[iz] = -0.75;
224 NLFLAG[iz] = 0;
225 iz = iz + 1;
226 }
227
228/* Column d: */
229 COLSTA[icol] = iz;
230 icol = icol + 1;
231 ROWNO[iz] = is+3;
232 VALUE[iz] = +1.0;
233 NLFLAG[iz] = 0;
234 iz = iz + 1;
235 ROWNO[iz] = is+4;
236 VALUE[iz] = +1.0;
237 NLFLAG[iz] = 0;
238 iz = iz + 1;
239 ROWNO[iz] = is+5;
240 NLFLAG[iz] = 1;
241 iz = iz + 1;
242
243/* Column r: */
244 COLSTA[icol] = iz;
245 icol = icol + 1;
246 ROWNO[iz] = is+4;
247 VALUE[iz] = +1.0;
248 NLFLAG[iz] = 0;
249 iz = iz + 1;
250 ROWNO[iz] = is+5;
251 NLFLAG[iz] = 1;
252 iz = iz + 1;
253 if ( it < T ) {
254 ROWNO[iz] = is+4+Epp;
255 VALUE[iz] = -1.0;
256 NLFLAG[iz] = 0;
257 iz = iz + 1;
258 }
259
260/* Column p: */
261 COLSTA[icol] = iz;
262 icol = icol + 1;
263 ROWNO[iz] = is;
264 VALUE[iz] = +0.13;
265 NLFLAG[iz] = 0;
266 iz = iz + 1;
267 ROWNO[iz] = is+1;
268 NLFLAG[iz] = 1;
269 iz = iz + 1;
270 ROWNO[iz] = is+5;
271 NLFLAG[iz] = 1;
272 iz = iz + 1;
273
274/* Column rev: */
275 COLSTA[icol] = iz;
276 icol = icol + 1;
277 ROWNO[iz] = +0; /* Objective -- no is term */
278 VALUE[iz] = pow(1.05,(1.0-it));
279 NLFLAG[iz] = 0;
280 iz = iz + 1;
281 ROWNO[iz] = is+5;
282 VALUE[iz] = 1.0;
283 NLFLAG[iz] = 0;
284 iz = iz + 1;
285 }
286 COLSTA[icol] = iz; /* First elements past last column */
287
288 return 0;
289}
290/*
291 =====================================================================
292 Compute nonlinear terms and non-constant Jacobian elements */
293
294
299int COI_CALLCONV Pin_FDEval( const double X[], double* G, double JAC[], int ROWNO, const int JACNUM[], int MODE,
300 int IGNERR, int* ERRCNT, int NUMVAR, int NUMJAC, int THREAD, void* USRMEM )
301{
302
303 int it, is;
304 double h1, h2;
305
306/* Compute the number of the period, it */
307
308 it = (ROWNO+Epp-1) / Epp;
309 is = Vpp*(it-1);
310 if ( 1+(it-1)*Epp+1 == ROWNO ) {
311
312/* sdef equation. Nonlinear term = -(1.1+0.1*p)*1.02**(-cs/7) */
313
314 h1 = (1.1+0.1*X[is+5]);
315 h2 = pow(1.02,-X[is+1]/7.0);
316 if ( 1 == MODE || 3 == MODE )
317 *G = -h1*h2;
318 if ( 2 == MODE || 3 == MODE ) {
319 JAC[is+1] = h1*h2*log(1.02)/7.0;
320 JAC[is+5] = -h2*0.1;
321 }
322 }
323 else if ( 1+(it-1)*Epp+5 == ROWNO ) {
324
325/* revdef equation. Nonlinear term = -d*(p-250/r) */
326
327 if ( 1 == MODE || 3 == MODE )
328 *G = -X[is+3]*(X[is+5]-250./X[is+4]);
329 if ( 2 == MODE || 3 == MODE ) {
330 JAC[is+3] = -(X[is+5]-250./X[is+4]);
331 JAC[is+4] = -X[is+3]*250./pow(X[is+4],2);
332 JAC[is+5] = -X[is+3];
333 }
334 }
335 else {
336
337/* Error - this equation is not nonlinear */
338
339 printf("\nError. Pin_FDEval called with ROWNO = %d. MODE = %d\n\n", ROWNO, MODE);
340 return 1;
341 };
342 return 0;
343}
344
345int COI_CALLCONV Pin_Solution( const double XVAL[], const double XMAR[], const int XBAS[], const int XSTA[],
346 const double YVAL[], const double YMAR[], const int YBAS[], const int YSTA[],
347 int NUMVAR, int NUMCON, void* USRMEM )
348{
349/* Specialized Solution routine */
350 int i;
351 char *status[4] = {"Lower","Upper","Basic","Super"};
352 if ( T < Tmax ) {
353 printf("Saving primal solution and status information for T = %d\n",T);
354 for ( i = 0; i < NUMVAR; i++ ) {
355 Xkeep[i] = XVAL[i];
356 Xstat[i] = XBAS[i];
357 }
358 for ( i = 0; i < NUMCON; i++ )
359 Estat[i] = YBAS[i];
360 return 0;
361 }
362 fprintf(fd,"\n Variable Solution value Reduced cost Status\n\n");
363 for ( i=0; i<NUMVAR; i++ )
364 fprintf(fd,"%6d%18f%18f%10s\n", i, XVAL[i], XMAR[i], status[XBAS[i]] );
365 fprintf(fd,"\n Constrnt Activity level Marginal cost Status\n\n");
366 for ( i=0; i<NUMCON; i++ )
367 fprintf(fd,"%6d%18f%18f%10s\n", i, YVAL[i], YMAR[i], status[YBAS[i]] );
368
369 return 0;
370}
371
372
377int COI_CALLCONV Pin_2DLagrStr( int HSRW[], int HSCL[], int* NODRV,
378 int NUMVAR, int NUMCON, int NHESS, void* USRMEM )
379{
380 int it, is, ic;
381/*
382 There are two nonlinear constraints, Sdef and RevDef and they have
383 the following Hessians (for each time period):
384
385 Revdef equation. Nonlinear term = -d*(p-250/r)
386 Hessian (diagonal and lower triangle): A total of 3 nonzero elements per period
387 3 4 5
388 d r p
389 3 : d
390 4 : r -250/r**2 500*d/r**3
391 5 : p -1
392
393 Sdef: Nonlinear term = -(1.1+0.1p)*1.02**(-cs/7)
394 Hessian (diagonal and lower triangle): A total of 2 nonzero elements per period
395 1 5
396 cs p
397 1 : cs -(1.1+0.1p)*1.02**(-cs/7)*(log(1.02)/7)**2
398 5 : p 0.1*1.02**(-cs/7)*(log(1.02)72)
399
400 The two Hessian matrices do not overlap so the total number of nonzeros is
401 5 per period. The structure using numerical indices for rows and columns and
402 running indices for the Hessian element is:
403
404 1 3 4 5
405 1 0
406 3
407 4 2 4
408 5 1 3
409
410 and the same with names of variables and contributing equations
411 cs d r p
412 cs sdef
413 d
414 r revdef revdef
415 p sdef revdef
416*/
417/* Define structure of Hessian */
418
419 for ( it = 1; it <= T; it++ ) {
420 is = Hpp*(it-1);
421 ic = Vpp*(it-1);
422 HSCL[is ] = ic+1; HSRW[is ] = ic+1;
423 HSCL[is+1] = ic+1; HSRW[is+1] = ic+5;
424 HSCL[is+2] = ic+3; HSRW[is+2] = ic+4;
425 HSCL[is+3] = ic+3; HSRW[is+3] = ic+5;
426 HSCL[is+4] = ic+4; HSRW[is+4] = ic+4;
427 };
428 return 0;
429}
430
431
436int COI_CALLCONV Pin_2DLagrVal( const double X[], const double U[], const int HSRW[], const int HSCL[],
437 double HSVL[], int* NODRV, int NUMVAR, int NUMCON, int NHESS, void* USRMEM )
438{
439 int it, is, ic, ie;
440 double cs, d, r, p;
441 double h1, h2;
442
443/* For comments see above */
444
445/* Normal Evaluation mode */
446
447 for ( it = 1; it <= T; it++ ) {
448 is = Hpp*(it-1);
449 ic = Vpp*(it-1);
450 ie = Epp*(it-1) + 1;
451 cs = X[ic+1];
452 d = X[ic+3];
453 r = X[ic+4];
454 p = X[ic+5];
455 h1 = 1.1+0.1*p;
456 h2 = pow(1.02,-cs/7.0);
457 HSVL[is ] = -h1*h2*pow(log(1.02)/7.0,2) * U[ie+1]; /* Sdef = equation 1 */
458 HSVL[is+1] = 0.1*h2*(log(1.02)/7.) * U[ie+1];
459 HSVL[is+2] = -250.0/pow(r,2) * U[ie+5]; /* Revdef = equation 5 */
460 HSVL[is+3] = -1.0 * U[ie+5];
461 HSVL[is+4] = 500.0*d/pow(r,3) * U[ie+5];
462 };
463 return 0;
464}
465
466#include "std.c"
467
470int main(int argc, char** argv)
471{
472 c_log( "Starting to execute", START );
473
474 T = Tmin;
475
476/* Tell CONOPT about the sizes in the model */
477/* Number of variables (excl. slacks): 7 per period */
478
480
481/* Number of equations: 1 objective + 6 per period */
482
483 COI_Error += COIDEF_NumCon ( CntVect, 1+6*T );
484
485/* Number of nonzeros in the Jacobian. See the counting in */
486/* ReadMatrix above. For each period there is 1 in the objective, 16 */
487/* for unlagged variables and 4 for lagged variables. */
488
489 COI_Error += COIDEF_NumNz ( CntVect, 17*T+4*(T-1) );
490
491/* Number of nonlinear nonzeros. 5 unlagged for each period. */
492
494
495/* Number of Hessian elements. 5 = Hpp for each period. */
496
498
499/* Objective: Maximize Constraint no 0 */
500
503
504/* Turn debugging of FDEval on or off */
505
507
508/* Turn debugging of 2DLagr on or off: -1 means first call only */
510/* Register the options file */
511 COI_Error += COIDEF_Optfile ( CntVect, "pindyck.opt");
512 /*
513 Register the necessary callback routines with CONOPT
514 */
515 COI_Error += COIDEF_Message ( CntVect, &Std_Message ); /* Register the callback Message */
516 COI_Error += COIDEF_ErrMsg ( CntVect, &Std_ErrMsg ); /* Register the callback ErrMsg */
517 COI_Error += COIDEF_Status ( CntVect, &Std_Status ); /* Register the callback Status */
518 COI_Error += COIDEF_Solution ( CntVect, &Pin_Solution ); /* Register the callback Solution */
519 COI_Error += COIDEF_ReadMatrix( CntVect, &Pin_ReadMatrix); /* Register the callback ReadMatrix */
520 COI_Error += COIDEF_FDEval ( CntVect, &Pin_FDEval); /* Register the callback FDEval */
521 COI_Error += COIDEF_2DLagrStr ( CntVect, &Pin_2DLagrStr); /* Register the callback 2DLagrStr */
522 COI_Error += COIDEF_2DLagrVal ( CntVect, &Pin_2DLagrVal); /* Register the callback 2DLagrVal */
523
524#if defined(LICENSE_INT_1) && defined(LICENSE_INT_2) && defined(LICENSE_INT_3) && defined(LICENSE_TEXT)
525 COI_Error += COIDEF_License ( CntVect, LICENSE_INT_1, LICENSE_INT_2, LICENSE_INT_3, LICENSE_TEXT);
526#endif
527
528 if ( COI_Error ) {
529 printf("Skipping COI_Solve due to setup errors. COI_Error = %d\n",COI_Error);
530 c_log( "Skipping Solve due to setup errors", COI_Error);
531 }
532 COI_Error = COI_Solve ( CntVect ); /* Optimize */
533 printf("After solving. COI_Error =%d\n",COI_Error);
534 if ( COI_Error ) {
535 c_log( "Errors encountered during first solve", COI_Error);
536 }
537 else if ( mstat != 2 || sstat != 1 ) {
538 c_log( "Incorrect Model or Solver Status during first solve", -1);
539 }
540
541/* Now increase the time horizon gradually up to 20.
542 All sizes that depend on T must be registered again. */
543
544 for ( T = Tmin+1; T <= Tmax; T++ ) {
546 COI_Error += COIDEF_NumCon ( CntVect, 1+6*T );
547 COI_Error += COIDEF_NumNz ( CntVect, 17*T+4*(T-1) );
550
551/* This time we have status information copied from a previous solve,
552 i.e. IniStat = 2 */
554
555/* Turn debugging of 2nd derivative off again */
557 if ( COI_Error ) {
558 printf("\n**** Fatal Error while revising CONOPT Sizes.\n");
559 c_log( "Errors encountered while revising model sizes", COI_Error);
560 }
562 if ( COI_Error ) {
563 printf("\n**** Fatal Error while Solving for T=%d\n",T);
564 c_log( "Errors encountered during later solve", COI_Error);
565 }
566 else if ( mstat != 2 || sstat != 1 ) {
567 printf("\n**** Incorrect Model or Solver Status during later solve for T=%d\n",T);
568 c_log( "Incorrect Model or Solver Status during later solve", -1);
569 }
570 }
571 printf("\nEnd of Pinadd2 Model. Return code=%d\n",COI_Error);
572 c_log( "Successful Solve", OK );
573}
C language header file for direct linking against the COI library generated by apiwrapper for GAMS Ve...
coiHandle_t CntVect
Definition comdecl.h:14
#define START
Definition comdecl.h:13
FILE * fd
Definition comdecl.h:3
int mstat
Definition comdecl.h:7
#define OK
Definition comdecl.h:12
int sstat
Definition comdecl.h:8
int COI_Error
Definition comdecl.h:15
int COI_CALLCONV COIDEF_ReadMatrix(coiHandle_t cntvect, COI_READMATRIX_t coi_readmatrix)
define callback routine for providing the matrix data to CONOPT.
int COI_CALLCONV COIDEF_Message(coiHandle_t cntvect, COI_MESSAGE_t coi_message)
define callback routine for handling messages returned during the solution process.
int COI_CALLCONV COIDEF_Solution(coiHandle_t cntvect, COI_SOLUTION_t coi_solution)
define callback routine for returning the final solution values.
int COI_CALLCONV COIDEF_Status(coiHandle_t cntvect, COI_STATUS_t coi_status)
define callback routine for returning the completion status.
int COI_CALLCONV COIDEF_ErrMsg(coiHandle_t cntvect, COI_ERRMSG_t coi_errmsg)
define callback routine for returning error messages for row, column or Jacobian elements.
int COI_CALLCONV COIDEF_FDEval(coiHandle_t cntvect, COI_FDEVAL_t coi_fdeval)
define callback routine for performing function and derivative evaluations.
int COI_CALLCONV COIDEF_2DLagrVal(coiHandle_t cntvect, COI_2DLAGRVAL_t coi_2dlagrval)
define callback routine for computing the values of the second derivatives of the Lagrangian.
int COI_CALLCONV COIDEF_2DLagrStr(coiHandle_t cntvect, COI_2DLAGRSTR_t coi_2dlagrstr)
define callback routine for providing the structure of the second derivatives of the Lagrangian.
int COI_CALLCONV COIDEF_Optfile(coiHandle_t cntvect, const char *optfile)
define callback routine for defining an options file.
int COI_CALLCONV COIDEF_DebugFV(coiHandle_t cntvect, int debugfv)
turn Debugging of FDEval on and off.
int COI_CALLCONV COIDEF_License(coiHandle_t cntvect, int licint1, int licint2, int licint3, const char *licstring)
define the License Information.
int COI_CALLCONV COIDEF_Debug2D(coiHandle_t cntvect, int debug2d)
turn debugging of 2nd derivatives on and off.
int COI_CALLCONV COIDEF_IniStat(coiHandle_t cntvect, int inistat)
handling of the initial status values.
int COI_CALLCONV COIDEF_NumHess(coiHandle_t cntvect, int numhess)
defines the Number of Hessian Nonzeros.
int COI_CALLCONV COIDEF_ObjCon(coiHandle_t cntvect, int objcon)
defines the Objective Constraint.
int COI_CALLCONV COIDEF_NumVar(coiHandle_t cntvect, int numvar)
defines the number of variables in the model.
int COI_CALLCONV COIDEF_NumNz(coiHandle_t cntvect, int numnz)
defines the number of nonzero elements in the Jacobian.
int COI_CALLCONV COIDEF_NumCon(coiHandle_t cntvect, int numcon)
defines the number of constraints in the model.
int COI_CALLCONV COIDEF_OptDir(coiHandle_t cntvect, int optdir)
defines the Optimization Direction.
int COI_CALLCONV COIDEF_NumNlNz(coiHandle_t cntvect, int numnlnz)
defines the Number of Nonlinear Nonzeros.
int COI_CALLCONV COI_Solve(coiHandle_t cntvect)
method for starting the solving process of CONOPT.
int COI_CALLCONV Pin_2DLagrVal(const double X[], const double U[], const int HSRW[], const int HSCL[], double HSVL[], int *NODRV, int NUMVAR, int NUMCON, int NHESS, void *USRMEM)
Compute the Lagrangian of the Hessian.
Definition pinadd2.c:436
int COI_CALLCONV Pin_ReadMatrix(double LOWER[], double CURR[], double UPPER[], int VSTA[], int TYPE[], double RHS[], int ESTA[], int COLSTA[], int ROWNO[], double VALUE[], int NLFLAG[], int NUMVAR, int NUMCON, int NUMNZ, void *USRMEM)
Define information about the model.
Definition pinadd2.c:29
int main(int argc, char **argv)
Main program. A simple setup and call of CONOPT.
Definition pinadd2.c:470
int COI_CALLCONV Pin_Solution(const double XVAL[], const double XMAR[], const int XBAS[], const int XSTA[], const double YVAL[], const double YMAR[], const int YBAS[], const int YSTA[], int NUMVAR, int NUMCON, void *USRMEM)
Definition pinadd2.c:345
int COI_CALLCONV Pin_FDEval(const double X[], double *G, double JAC[], int ROWNO, const int JACNUM[], int MODE, int IGNERR, int *ERRCNT, int NUMVAR, int NUMJAC, int THREAD, void *USRMEM)
Compute nonlinear terms and non-constant Jacobian elements.
Definition pinadd2.c:299
int COI_CALLCONV Pin_2DLagrStr(int HSRW[], int HSCL[], int *NODRV, int NUMVAR, int NUMCON, int NHESS, void *USRMEM)
Specify the structure of the Lagrangian of the Hessian.
Definition pinadd2.c:377
#define Hpp
Definition pinadd2.c:19
int COI_CALLCONV Pin_ReadMatrix(double LOWER[], double CURR[], double UPPER[], int VSTA[], int TYPE[], double RHS[], int ESTA[], int COLSTA[], int ROWNO[], double VALUE[], int NLFLAG[], int NUMVAR, int NUMCON, int NUMNZ, void *USRMEM)
Define information about the model.
Definition pinadd.c:28
int Xstat[Tmax *Vpp]
Definition pinadd.c:20
int COI_CALLCONV Pin_Solution(const double XVAL[], const double XMAR[], const int XBAS[], const int XSTA[], const double YVAL[], const double YMAR[], const int YBAS[], const int YSTA[], int NUMVAR, int NUMCON, void *USRMEM)
Definition pinadd.c:344
double Xkeep[Tmax *Vpp]
Definition pinadd.c:19
int COI_CALLCONV Pin_FDEval(const double X[], double *G, double JAC[], int ROWNO, const int JACNUM[], int MODE, int IGNERR, int *ERRCNT, int NUMVAR, int NUMJAC, int THREAD, void *USRMEM)
Compute nonlinear terms and non-constant Jacobian elements.
Definition pinadd.c:298
int T
Definition pinadd.c:14
#define Tmin
Definition pinadd.c:15
int Estat[Tmax *Epp]
Definition pinadd.c:21
#define Epp
Definition pinadd.c:18
#define Tmax
Definition pinadd.c:16
#define Vpp
Definition pinadd.c:17
int COI_CALLCONV Std_Status(int MODSTA, int SOLSTA, int ITER, double OBJVAL, void *USRMEM)
Definition std.c:45
int COI_CALLCONV Std_Message(int SMSG, int DMSG, int NMSG, char *MSGV[], void *USRMEM)
Definition std.c:8
void c_log(char *msgt, int code)
Definition std.c:202
int COI_CALLCONV Std_ErrMsg(int ROWNO, int COLNO, int POSNO, const char *MSG, void *USRMEM)
Definition std.c:26